path
stringlengths 5
304
| repo_name
stringlengths 6
79
| content
stringlengths 27
1.05M
|
|---|---|---|
examples/src/components/DisabledUpsellOptions.js
|
lemming/react-select
|
import React from 'react';
import Select from 'react-select';
function logChange() {
console.log.apply(console, [].concat(['Select value changed:'], Array.prototype.slice.apply(arguments)));
}
var DisabledUpsellOptions = React.createClass({
displayName: 'DisabledUpsellOptions',
propTypes: {
label: React.PropTypes.string,
},
onLabelClick: function (data, event) {
console.log(data, event);
},
renderLink: function() {
return <a style={{ marginLeft: 5 }} href="/upgrade" target="_blank">Upgrade here!</a>;
},
renderOption: function(option) {
return <span>{option.label} {option.link} </span>;
},
render: function() {
var ops = [
{ label: 'Basic customer support', value: 'basic' },
{ label: 'Premium customer support', value: 'premium' },
{ label: 'Pro customer support', value: 'pro', disabled: true, link: this.renderLink() },
];
return (
<div className="section">
<h3 className="section-heading">{this.props.label}</h3>
<Select
onOptionLabelClick={this.onLabelClick}
placeholder="Select your support level"
options={ops}
optionRenderer={this.renderOption}
onChange={logChange} />
</div>
);
}
});
module.exports = DisabledUpsellOptions;
|
app/components/molecules/TitleBlock/presenter.js
|
altiore/webpack_config_example
|
import React from 'react'
import FlatButton from 'material-ui/FlatButton'
import { NavLink } from 'react-router-dom'
import './style.scss'
const Title = () => (
<div className='l-header-title'>
<div className='b-header-title'>
<FlatButton
className='b-header-title__button'
hoverColor='#fff'
containerElement={
<NavLink to='/' activeClassName='active' />
}
>
<h1>3tarelki.com</h1>
<div className='b-header-title__desc'>Кулинарные шедевры на каждый день</div>
</FlatButton>
</div>
</div>
)
export default Title
|
app/javascript/mastodon/components/__tests__/avatar-test.js
|
rutan/mastodon
|
import React from 'react';
import renderer from 'react-test-renderer';
import { fromJS } from 'immutable';
import Avatar from '../avatar';
describe('<Avatar />', () => {
const account = fromJS({
username: 'alice',
acct: 'alice',
display_name: 'Alice',
avatar: '/animated/alice.gif',
avatar_static: '/static/alice.jpg',
});
const size = 100;
describe('Autoplay', () => {
it('renders a animated avatar', () => {
const component = renderer.create(<Avatar account={account} animate size={size} />);
const tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
describe('Still', () => {
it('renders a still avatar', () => {
const component = renderer.create(<Avatar account={account} size={size} />);
const tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
// TODO add autoplay test if possible
});
|
docs/app/components/editor/index.js
|
jasonleibowitz/react-toolbox
|
import React from 'react';
import style from './style';
import CodeMirror from 'codemirror';
import 'codemirror/mode/javascript/javascript';
class Editor extends React.Component {
static propTypes = {
className: React.PropTypes.string,
codeText: React.PropTypes.string,
lineNumbers: React.PropTypes.bool,
onChange: React.PropTypes.func,
readOnly: React.PropTypes.bool,
tabSize: React.PropTypes.number,
theme: React.PropTypes.string
};
static defaultProps = {
className: '',
lineNumbers: false,
readOnly: false,
tabSize: 2,
theme: 'one-dark'
};
componentDidMount () {
this.editor = CodeMirror.fromTextArea(this.refs.editor, {
mode: 'javascript',
lineNumbers: this.props.lineNumbers,
smartIndent: false,
tabSize: this.props.tabSize,
matchBrackets: true,
theme: this.props.theme,
readOnly: this.props.readOnly
});
this.editor.on('change', this.handleChange);
}
componentDidUpdate () {
if (this.props.readOnly) {
this.editor.setValue(this.props.codeText);
}
}
handleChange = () => {
if (!this.props.readOnly && this.props.onChange) {
this.props.onChange(this.editor.getValue());
}
};
setCode (code) {
this.editor.getDoc().setValue(code);
this.handleChange();
}
render () {
let className = style.editor;
if (this.props.className) className += ` ${this.props.className}`;
return (
<div className={className}>
<textarea ref="editor" defaultValue={this.props.codeText} />
</div>
);
}
}
export default Editor;
|
src/components/Sleepover.js
|
evelinalaroussi/evelinalaroussi.github.io
|
import React from 'react';
import Interactive from 'react-interactive';
import { Link } from 'react-router-dom';
//import { Code } from '../styles/style';
//import s from '../styles/home.style';
export default class Sleepover extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div id="siteContainer" className="thissite">
<Link to="/head"><div><img className="logo-img" src="/logo.png"/></div></Link>
<div className = "this-img">
<div className="head"><p>Sleepover Buddy - interactive toy for children with separation anxiety</p></div>
<hr id="headLine"/>
<Link to="/work"><div className="button-div"><button id="button">Back to listing</button></div></Link>
<iframe width="560" height="315" src="https://www.youtube.com/embed/74K0bihOPPs" frameborder="0" allowfullscreen></iframe>
<img id="sleepover_screens" src="/work_images/sleepover.png"/>
</div>
<div className="this-text">
<div className="tech">
<h3>FRAMEWORKS AND TOOLS</h3>
<hr id="miniheadLine"/>
<div>
<p>- Arduino UNO + feather huzzah with wifi connection </p>
<p>- LED lights, speaker, heatpad and vibrator motors (and a lot of wires) </p>
<p>- javascript, HTML and CSS for working application</p>
<p>- Invision and illustrator for not wokring prototype and design</p>
</div>
</div>
<div className="desc"><h3>DESCRIPTION</h3>
<hr id="miniheadLine"/>
<div><p>Sleepover buddy is a Hifi-prototype of an interactive toy made for children with separation anxiety and their parents. The product contains of an application (for the parents) and three physical modules (for the children). The three modules consist of the four modalities light, sound, vibration and heat, and they can be attached to soft toys or other soft surfaces. The modalites are connected to the application in which special messages can be created, for example "my favourite" could be pink pulsing light with heartbeat vibration, heat and purring sound. When the children are away from their parents and feel anxious they can push a button at one of the modules and a notification is sent to the parents phones. Thye can then answer the child with the costum messages and the modalities will be active during a selected period of time. My part of the project was to develope the application and connect it to the physical electronics. </p></div>
</div>
</div>
</div>
)
}
};
|
packages/material-ui-icons/src/QuestionAnswerSharp.js
|
Kagami/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M22 6h-3v9H6v3h12l4 4V6zm-5 7V2H2v15l4-4h11z" /></React.Fragment>
, 'QuestionAnswerSharp');
|
ajax/libs/webshim/1.15.7/dev/shims/moxie/js/moxie-html4.js
|
jackdoyle/cdnjs
|
/**
* mOxie - multi-runtime File API & XMLHttpRequest L2 Polyfill
* v1.2.1
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*
* Date: 2014-05-14
*/
/**
* Compiled inline version. (Library mode)
*/
/*jshint smarttabs:true, undef:true, latedef:true, curly:true, bitwise:true, camelcase:true */
/*globals $code */
(function(exports, undefined) {
"use strict";
var modules = {};
function require(ids, callback) {
var module, defs = [];
for (var i = 0; i < ids.length; ++i) {
module = modules[ids[i]] || resolve(ids[i]);
if (!module) {
throw 'module definition dependecy not found: ' + ids[i];
}
defs.push(module);
}
callback.apply(null, defs);
}
function define(id, dependencies, definition) {
if (typeof id !== 'string') {
throw 'invalid module definition, module id must be defined and be a string';
}
if (dependencies === undefined) {
throw 'invalid module definition, dependencies must be specified';
}
if (definition === undefined) {
throw 'invalid module definition, definition function must be specified';
}
require(dependencies, function() {
modules[id] = definition.apply(null, arguments);
});
}
function defined(id) {
return !!modules[id];
}
function resolve(id) {
var target = exports;
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length; ++fi) {
if (!target[fragments[fi]]) {
return;
}
target = target[fragments[fi]];
}
return target;
}
function expose(ids) {
for (var i = 0; i < ids.length; i++) {
var target = exports;
var id = ids[i];
var fragments = id.split(/[.\/]/);
for (var fi = 0; fi < fragments.length - 1; ++fi) {
if (target[fragments[fi]] === undefined) {
target[fragments[fi]] = {};
}
target = target[fragments[fi]];
}
target[fragments[fragments.length - 1]] = modules[id];
}
}
// Included from: src/javascript/core/utils/Basic.js
/**
* Basic.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Basic', [], function() {
/**
Gets the true type of the built-in object (better version of typeof).
@author Angus Croll (http://javascriptweblog.wordpress.com/)
@method typeOf
@for Utils
@static
@param {Object} o Object to check.
@return {String} Object [[Class]]
*/
var typeOf = function(o) {
var undef;
if (o === undef) {
return 'undefined';
} else if (o === null) {
return 'null';
} else if (o.nodeType) {
return 'node';
}
// the snippet below is awesome, however it fails to detect null, undefined and arguments types in IE lte 8
return ({}).toString.call(o).match(/\s([a-z|A-Z]+)/)[1].toLowerCase();
};
/**
Extends the specified object with another object.
@method extend
@static
@param {Object} target Object to extend.
@param {Object} [obj]* Multiple objects to extend with.
@return {Object} Same as target, the extended object.
*/
var extend = function(target) {
var undef;
each(arguments, function(arg, i) {
if (i > 0) {
each(arg, function(value, key) {
if (value !== undef) {
if (typeOf(target[key]) === typeOf(value) && !!~inArray(typeOf(value), ['array', 'object'])) {
extend(target[key], value);
} else {
target[key] = value;
}
}
});
}
});
return target;
};
/**
Executes the callback function for each item in array/object. If you return false in the
callback it will break the loop.
@method each
@static
@param {Object} obj Object to iterate.
@param {function} callback Callback function to execute for each item.
*/
var each = function(obj, callback) {
var length, key, i, undef;
if (obj) {
try {
length = obj.length;
} catch(ex) {
length = undef;
}
if (length === undef) {
// Loop object items
for (key in obj) {
if (obj.hasOwnProperty(key)) {
if (callback(obj[key], key) === false) {
return;
}
}
}
} else {
// Loop array items
for (i = 0; i < length; i++) {
if (callback(obj[i], i) === false) {
return;
}
}
}
}
};
/**
Checks if object is empty.
@method isEmptyObj
@static
@param {Object} o Object to check.
@return {Boolean}
*/
var isEmptyObj = function(obj) {
var prop;
if (!obj || typeOf(obj) !== 'object') {
return true;
}
for (prop in obj) {
return false;
}
return true;
};
/**
Recieve an array of functions (usually async) to call in sequence, each function
receives a callback as first argument that it should call, when it completes. Finally,
after everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the sequence and invoke main callback
immediately.
@method inSeries
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of error
*/
var inSeries = function(queue, cb) {
var i = 0, length = queue.length;
if (typeOf(cb) !== 'function') {
cb = function() {};
}
if (!queue || !queue.length) {
cb();
}
function callNext(i) {
if (typeOf(queue[i]) === 'function') {
queue[i](function(error) {
/*jshint expr:true */
++i < length && !error ? callNext(i) : cb(error);
});
}
}
callNext(i);
};
/**
Recieve an array of functions (usually async) to call in parallel, each function
receives a callback as first argument that it should call, when it completes. After
everything is complete, main callback is called. Passing truthy value to the
callback as a first argument will interrupt the process and invoke main callback
immediately.
@method inParallel
@static
@param {Array} queue Array of functions to call in sequence
@param {Function} cb Main callback that is called in the end, or in case of erro
*/
var inParallel = function(queue, cb) {
var count = 0, num = queue.length, cbArgs = new Array(num);
each(queue, function(fn, i) {
fn(function(error) {
if (error) {
return cb(error);
}
var args = [].slice.call(arguments);
args.shift(); // strip error - undefined or not
cbArgs[i] = args;
count++;
if (count === num) {
cbArgs.unshift(null);
cb.apply(this, cbArgs);
}
});
});
};
/**
Find an element in array and return it's index if present, otherwise return -1.
@method inArray
@static
@param {Mixed} needle Element to find
@param {Array} array
@return {Int} Index of the element, or -1 if not found
*/
var inArray = function(needle, array) {
if (array) {
if (Array.prototype.indexOf) {
return Array.prototype.indexOf.call(array, needle);
}
for (var i = 0, length = array.length; i < length; i++) {
if (array[i] === needle) {
return i;
}
}
}
return -1;
};
/**
Returns elements of first array if they are not present in second. And false - otherwise.
@private
@method arrayDiff
@param {Array} needles
@param {Array} array
@return {Array|Boolean}
*/
var arrayDiff = function(needles, array) {
var diff = [];
if (typeOf(needles) !== 'array') {
needles = [needles];
}
if (typeOf(array) !== 'array') {
array = [array];
}
for (var i in needles) {
if (inArray(needles[i], array) === -1) {
diff.push(needles[i]);
}
}
return diff.length ? diff : false;
};
/**
Find intersection of two arrays.
@private
@method arrayIntersect
@param {Array} array1
@param {Array} array2
@return {Array} Intersection of two arrays or null if there is none
*/
var arrayIntersect = function(array1, array2) {
var result = [];
each(array1, function(item) {
if (inArray(item, array2) !== -1) {
result.push(item);
}
});
return result.length ? result : null;
};
/**
Forces anything into an array.
@method toArray
@static
@param {Object} obj Object with length field.
@return {Array} Array object containing all items.
*/
var toArray = function(obj) {
var i, arr = [];
for (i = 0; i < obj.length; i++) {
arr[i] = obj[i];
}
return arr;
};
/**
Generates an unique ID. This is 99.99% unique since it takes the current time and 5 random numbers.
The only way a user would be able to get the same ID is if the two persons at the same exact milisecond manages
to get 5 the same random numbers between 0-65535 it also uses a counter so each call will be guaranteed to be page unique.
It's more probable for the earth to be hit with an ansteriod. Y
@method guid
@static
@param {String} prefix to prepend (by default 'o' will be prepended).
@method guid
@return {String} Virtually unique id.
*/
var guid = (function() {
var counter = 0;
return function(prefix) {
var guid = new Date().getTime().toString(32), i;
for (i = 0; i < 5; i++) {
guid += Math.floor(Math.random() * 65535).toString(32);
}
return (prefix || 'o_') + guid + (counter++).toString(32);
};
}());
/**
Trims white spaces around the string
@method trim
@static
@param {String} str
@return {String}
*/
var trim = function(str) {
if (!str) {
return str;
}
return String.prototype.trim ? String.prototype.trim.call(str) : str.toString().replace(/^\s*/, '').replace(/\s*$/, '');
};
/**
Parses the specified size string into a byte value. For example 10kb becomes 10240.
@method parseSizeStr
@static
@param {String/Number} size String to parse or number to just pass through.
@return {Number} Size in bytes.
*/
var parseSizeStr = function(size) {
if (typeof(size) !== 'string') {
return size;
}
var muls = {
t: 1099511627776,
g: 1073741824,
m: 1048576,
k: 1024
},
mul;
size = /^([0-9]+)([mgk]?)$/.exec(size.toLowerCase().replace(/[^0-9mkg]/g, ''));
mul = size[2];
size = +size[1];
if (muls.hasOwnProperty(mul)) {
size *= muls[mul];
}
return size;
};
return {
guid: guid,
typeOf: typeOf,
extend: extend,
each: each,
isEmptyObj: isEmptyObj,
inSeries: inSeries,
inParallel: inParallel,
inArray: inArray,
arrayDiff: arrayDiff,
arrayIntersect: arrayIntersect,
toArray: toArray,
trim: trim,
parseSizeStr: parseSizeStr
};
});
// Included from: src/javascript/core/I18n.js
/**
* I18n.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/I18n", [
"moxie/core/utils/Basic"
], function(Basic) {
var i18n = {};
return {
/**
* Extends the language pack object with new items.
*
* @param {Object} pack Language pack items to add.
* @return {Object} Extended language pack object.
*/
addI18n: function(pack) {
return Basic.extend(i18n, pack);
},
/**
* Translates the specified string by checking for the english string in the language pack lookup.
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
translate: function(str) {
return i18n[str] || str;
},
/**
* Shortcut for translate function
*
* @param {String} str String to look for.
* @return {String} Translated string or the input string if it wasn't found.
*/
_: function(str) {
return this.translate(str);
},
/**
* Pseudo sprintf implementation - simple way to replace tokens with specified values.
*
* @param {String} str String with tokens
* @return {String} String with replaced tokens
*/
sprintf: function(str) {
var args = [].slice.call(arguments, 1);
return str.replace(/%[a-z]/g, function() {
var value = args.shift();
return Basic.typeOf(value) !== 'undefined' ? value : '';
});
}
};
});
// Included from: src/javascript/core/utils/Mime.js
/**
* Mime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Mime", [
"moxie/core/utils/Basic",
"moxie/core/I18n"
], function(Basic, I18n) {
var mimeData = "" +
"application/msword,doc dot," +
"application/pdf,pdf," +
"application/pgp-signature,pgp," +
"application/postscript,ps ai eps," +
"application/rtf,rtf," +
"application/vnd.ms-excel,xls xlb," +
"application/vnd.ms-powerpoint,ppt pps pot," +
"application/zip,zip," +
"application/x-shockwave-flash,swf swfl," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.document,docx," +
"application/vnd.openxmlformats-officedocument.wordprocessingml.template,dotx," +
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,xlsx," +
"application/vnd.openxmlformats-officedocument.presentationml.presentation,pptx," +
"application/vnd.openxmlformats-officedocument.presentationml.template,potx," +
"application/vnd.openxmlformats-officedocument.presentationml.slideshow,ppsx," +
"application/x-javascript,js," +
"application/json,json," +
"audio/mpeg,mp3 mpga mpega mp2," +
"audio/x-wav,wav," +
"audio/x-m4a,m4a," +
"audio/ogg,oga ogg," +
"audio/aiff,aiff aif," +
"audio/flac,flac," +
"audio/aac,aac," +
"audio/ac3,ac3," +
"audio/x-ms-wma,wma," +
"image/bmp,bmp," +
"image/gif,gif," +
"image/jpeg,jpg jpeg jpe," +
"image/photoshop,psd," +
"image/png,png," +
"image/svg+xml,svg svgz," +
"image/tiff,tiff tif," +
"text/plain,asc txt text diff log," +
"text/html,htm html xhtml," +
"text/css,css," +
"text/csv,csv," +
"text/rtf,rtf," +
"video/mpeg,mpeg mpg mpe m2v," +
"video/quicktime,qt mov," +
"video/mp4,mp4," +
"video/x-m4v,m4v," +
"video/x-flv,flv," +
"video/x-ms-wmv,wmv," +
"video/avi,avi," +
"video/webm,webm," +
"video/3gpp,3gpp 3gp," +
"video/3gpp2,3g2," +
"video/vnd.rn-realvideo,rv," +
"video/ogg,ogv," +
"video/x-matroska,mkv," +
"application/vnd.oasis.opendocument.formula-template,otf," +
"application/octet-stream,exe";
var Mime = {
mimes: {},
extensions: {},
// Parses the default mime types string into a mimes and extensions lookup maps
addMimeType: function (mimeData) {
var items = mimeData.split(/,/), i, ii, ext;
for (i = 0; i < items.length; i += 2) {
ext = items[i + 1].split(/ /);
// extension to mime lookup
for (ii = 0; ii < ext.length; ii++) {
this.mimes[ext[ii]] = items[i];
}
// mime to extension lookup
this.extensions[items[i]] = ext;
}
},
extList2mimes: function (filters, addMissingExtensions) {
var self = this, ext, i, ii, type, mimes = [];
// convert extensions to mime types list
for (i = 0; i < filters.length; i++) {
ext = filters[i].extensions.split(/\s*,\s*/);
for (ii = 0; ii < ext.length; ii++) {
// if there's an asterisk in the list, then accept attribute is not required
if (ext[ii] === '*') {
return [];
}
type = self.mimes[ext[ii]];
if (!type) {
if (addMissingExtensions && /^\w+$/.test(ext[ii])) {
mimes.push('.' + ext[ii]);
} else {
return []; // accept all
}
} else if (Basic.inArray(type, mimes) === -1) {
mimes.push(type);
}
}
}
return mimes;
},
mimes2exts: function(mimes) {
var self = this, exts = [];
Basic.each(mimes, function(mime) {
if (mime === '*') {
exts = [];
return false;
}
// check if this thing looks like mime type
var m = mime.match(/^(\w+)\/(\*|\w+)$/);
if (m) {
if (m[2] === '*') {
// wildcard mime type detected
Basic.each(self.extensions, function(arr, mime) {
if ((new RegExp('^' + m[1] + '/')).test(mime)) {
[].push.apply(exts, self.extensions[mime]);
}
});
} else if (self.extensions[mime]) {
[].push.apply(exts, self.extensions[mime]);
}
}
});
return exts;
},
mimes2extList: function(mimes) {
var accept = [], exts = [];
if (Basic.typeOf(mimes) === 'string') {
mimes = Basic.trim(mimes).split(/\s*,\s*/);
}
exts = this.mimes2exts(mimes);
accept.push({
title: I18n.translate('Files'),
extensions: exts.length ? exts.join(',') : '*'
});
// save original mimes string
accept.mimes = mimes;
return accept;
},
getFileExtension: function(fileName) {
var matches = fileName && fileName.match(/\.([^.]+)$/);
if (matches) {
return matches[1].toLowerCase();
}
return '';
},
getFileMime: function(fileName) {
return this.mimes[this.getFileExtension(fileName)] || '';
}
};
Mime.addMimeType(mimeData);
return Mime;
});
// Included from: src/javascript/core/utils/Env.js
/**
* Env.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/core/utils/Env", [
"moxie/core/utils/Basic"
], function(Basic) {
// UAParser.js v0.6.2
// Lightweight JavaScript-based User-Agent string parser
// https://github.com/faisalman/ua-parser-js
//
// Copyright © 2012-2013 Faisalman <fyzlman@gmail.com>
// Dual licensed under GPLv2 & MIT
var UAParser = (function (undefined) {
//////////////
// Constants
/////////////
var EMPTY = '',
UNKNOWN = '?',
FUNC_TYPE = 'function',
UNDEF_TYPE = 'undefined',
OBJ_TYPE = 'object',
MAJOR = 'major',
MODEL = 'model',
NAME = 'name',
TYPE = 'type',
VENDOR = 'vendor',
VERSION = 'version',
ARCHITECTURE= 'architecture',
CONSOLE = 'console',
MOBILE = 'mobile',
TABLET = 'tablet';
///////////
// Helper
//////////
var util = {
has : function (str1, str2) {
return str2.toLowerCase().indexOf(str1.toLowerCase()) !== -1;
},
lowerize : function (str) {
return str.toLowerCase();
}
};
///////////////
// Map helper
//////////////
var mapper = {
rgx : function () {
// loop through all regexes maps
for (var result, i = 0, j, k, p, q, matches, match, args = arguments; i < args.length; i += 2) {
var regex = args[i], // even sequence (0,2,4,..)
props = args[i + 1]; // odd sequence (1,3,5,..)
// construct object barebones
if (typeof(result) === UNDEF_TYPE) {
result = {};
for (p in props) {
q = props[p];
if (typeof(q) === OBJ_TYPE) {
result[q[0]] = undefined;
} else {
result[q] = undefined;
}
}
}
// try matching uastring with regexes
for (j = k = 0; j < regex.length; j++) {
matches = regex[j].exec(this.getUA());
if (!!matches) {
for (p = 0; p < props.length; p++) {
match = matches[++k];
q = props[p];
// check if given property is actually array
if (typeof(q) === OBJ_TYPE && q.length > 0) {
if (q.length == 2) {
if (typeof(q[1]) == FUNC_TYPE) {
// assign modified match
result[q[0]] = q[1].call(this, match);
} else {
// assign given value, ignore regex match
result[q[0]] = q[1];
}
} else if (q.length == 3) {
// check whether function or regex
if (typeof(q[1]) === FUNC_TYPE && !(q[1].exec && q[1].test)) {
// call function (usually string mapper)
result[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;
} else {
// sanitize match using given regex
result[q[0]] = match ? match.replace(q[1], q[2]) : undefined;
}
} else if (q.length == 4) {
result[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;
}
} else {
result[q] = match ? match : undefined;
}
}
break;
}
}
if(!!matches) break; // break the loop immediately if match found
}
return result;
},
str : function (str, map) {
for (var i in map) {
// check if array
if (typeof(map[i]) === OBJ_TYPE && map[i].length > 0) {
for (var j = 0; j < map[i].length; j++) {
if (util.has(map[i][j], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
} else if (util.has(map[i], str)) {
return (i === UNKNOWN) ? undefined : i;
}
}
return str;
}
};
///////////////
// String map
//////////////
var maps = {
browser : {
oldsafari : {
major : {
'1' : ['/8', '/1', '/3'],
'2' : '/4',
'?' : '/'
},
version : {
'1.0' : '/8',
'1.2' : '/1',
'1.3' : '/3',
'2.0' : '/412',
'2.0.2' : '/416',
'2.0.3' : '/417',
'2.0.4' : '/419',
'?' : '/'
}
}
},
device : {
sprint : {
model : {
'Evo Shift 4G' : '7373KT'
},
vendor : {
'HTC' : 'APA',
'Sprint' : 'Sprint'
}
}
},
os : {
windows : {
version : {
'ME' : '4.90',
'NT 3.11' : 'NT3.51',
'NT 4.0' : 'NT4.0',
'2000' : 'NT 5.0',
'XP' : ['NT 5.1', 'NT 5.2'],
'Vista' : 'NT 6.0',
'7' : 'NT 6.1',
'8' : 'NT 6.2',
'8.1' : 'NT 6.3',
'RT' : 'ARM'
}
}
}
};
//////////////
// Regex map
/////////////
var regexes = {
browser : [[
// Presto based
/(opera\smini)\/((\d+)?[\w\.-]+)/i, // Opera Mini
/(opera\s[mobiletab]+).+version\/((\d+)?[\w\.-]+)/i, // Opera Mobi/Tablet
/(opera).+version\/((\d+)?[\w\.]+)/i, // Opera > 9.80
/(opera)[\/\s]+((\d+)?[\w\.]+)/i // Opera < 9.80
], [NAME, VERSION, MAJOR], [
/\s(opr)\/((\d+)?[\w\.]+)/i // Opera Webkit
], [[NAME, 'Opera'], VERSION, MAJOR], [
// Mixed
/(kindle)\/((\d+)?[\w\.]+)/i, // Kindle
/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?((\d+)?[\w\.]+)*/i,
// Lunascape/Maxthon/Netfront/Jasmine/Blazer
// Trident based
/(avant\s|iemobile|slim|baidu)(?:browser)?[\/\s]?((\d+)?[\w\.]*)/i,
// Avant/IEMobile/SlimBrowser/Baidu
/(?:ms|\()(ie)\s((\d+)?[\w\.]+)/i, // Internet Explorer
// Webkit/KHTML based
/(rekonq)((?:\/)[\w\.]+)*/i, // Rekonq
/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron)\/((\d+)?[\w\.-]+)/i
// Chromium/Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron
], [NAME, VERSION, MAJOR], [
/(trident).+rv[:\s]((\d+)?[\w\.]+).+like\sgecko/i // IE11
], [[NAME, 'IE'], VERSION, MAJOR], [
/(yabrowser)\/((\d+)?[\w\.]+)/i // Yandex
], [[NAME, 'Yandex'], VERSION, MAJOR], [
/(comodo_dragon)\/((\d+)?[\w\.]+)/i // Comodo Dragon
], [[NAME, /_/g, ' '], VERSION, MAJOR], [
/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?((\d+)?[\w\.]+)/i
// Chrome/OmniWeb/Arora/Tizen/Nokia
], [NAME, VERSION, MAJOR], [
/(dolfin)\/((\d+)?[\w\.]+)/i // Dolphin
], [[NAME, 'Dolphin'], VERSION, MAJOR], [
/((?:android.+)crmo|crios)\/((\d+)?[\w\.]+)/i // Chrome for Android/iOS
], [[NAME, 'Chrome'], VERSION, MAJOR], [
/((?:android.+))version\/((\d+)?[\w\.]+)\smobile\ssafari/i // Android Browser
], [[NAME, 'Android Browser'], VERSION, MAJOR], [
/version\/((\d+)?[\w\.]+).+?mobile\/\w+\s(safari)/i // Mobile Safari
], [VERSION, MAJOR, [NAME, 'Mobile Safari']], [
/version\/((\d+)?[\w\.]+).+?(mobile\s?safari|safari)/i // Safari & Safari Mobile
], [VERSION, MAJOR, NAME], [
/webkit.+?(mobile\s?safari|safari)((\/[\w\.]+))/i // Safari < 3.0
], [NAME, [MAJOR, mapper.str, maps.browser.oldsafari.major], [VERSION, mapper.str, maps.browser.oldsafari.version]], [
/(konqueror)\/((\d+)?[\w\.]+)/i, // Konqueror
/(webkit|khtml)\/((\d+)?[\w\.]+)/i
], [NAME, VERSION, MAJOR], [
// Gecko based
/(navigator|netscape)\/((\d+)?[\w\.-]+)/i // Netscape
], [[NAME, 'Netscape'], VERSION, MAJOR], [
/(swiftfox)/i, // Swiftfox
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?((\d+)?[\w\.\+]+)/i,
// IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror
/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix)\/((\d+)?[\w\.-]+)/i,
// Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix
/(mozilla)\/((\d+)?[\w\.]+).+rv\:.+gecko\/\d+/i, // Mozilla
// Other
/(uc\s?browser|polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|qqbrowser)[\/\s]?((\d+)?[\w\.]+)/i,
// UCBrowser/Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/QQBrowser
/(links)\s\(((\d+)?[\w\.]+)/i, // Links
/(gobrowser)\/?((\d+)?[\w\.]+)*/i, // GoBrowser
/(ice\s?browser)\/v?((\d+)?[\w\._]+)/i, // ICE Browser
/(mosaic)[\/\s]((\d+)?[\w\.]+)/i // Mosaic
], [NAME, VERSION, MAJOR]
],
engine : [[
/(presto)\/([\w\.]+)/i, // Presto
/(webkit|trident|netfront|netsurf|amaya|lynx|w3m)\/([\w\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m
/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i, // KHTML/Tasman/Links
/(icab)[\/\s]([23]\.[\d\.]+)/i // iCab
], [NAME, VERSION], [
/rv\:([\w\.]+).*(gecko)/i // Gecko
], [VERSION, NAME]
],
os : [[
// Windows based
/(windows)\snt\s6\.2;\s(arm)/i, // Windows RT
/(windows\sphone(?:\sos)*|windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i
], [NAME, [VERSION, mapper.str, maps.os.windows.version]], [
/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i
], [[NAME, 'Windows'], [VERSION, mapper.str, maps.os.windows.version]], [
// Mobile/Embedded OS
/\((bb)(10);/i // BlackBerry 10
], [[NAME, 'BlackBerry'], VERSION], [
/(blackberry)\w*\/?([\w\.]+)*/i, // Blackberry
/(tizen)\/([\w\.]+)/i, // Tizen
/(android|webos|palm\os|qnx|bada|rim\stablet\sos|meego)[\/\s-]?([\w\.]+)*/i
// Android/WebOS/Palm/QNX/Bada/RIM/MeeGo
], [NAME, VERSION], [
/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]+)*/i // Symbian
], [[NAME, 'Symbian'], VERSION],[
/mozilla.+\(mobile;.+gecko.+firefox/i // Firefox OS
], [[NAME, 'Firefox OS'], VERSION], [
// Console
/(nintendo|playstation)\s([wids3portablevu]+)/i, // Nintendo/Playstation
// GNU/Linux based
/(mint)[\/\s\(]?(\w+)*/i, // Mint
/(joli|[kxln]?ubuntu|debian|[open]*suse|gentoo|arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk)[\/\s-]?([\w\.-]+)*/i,
// Joli/Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware
// Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk
/(hurd|linux)\s?([\w\.]+)*/i, // Hurd/Linux
/(gnu)\s?([\w\.]+)*/i // GNU
], [NAME, VERSION], [
/(cros)\s[\w]+\s([\w\.]+\w)/i // Chromium OS
], [[NAME, 'Chromium OS'], VERSION],[
// Solaris
/(sunos)\s?([\w\.]+\d)*/i // Solaris
], [[NAME, 'Solaris'], VERSION], [
// BSD based
/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]+)*/i // FreeBSD/NetBSD/OpenBSD/PC-BSD/DragonFly
], [NAME, VERSION],[
/(ip[honead]+)(?:.*os\s*([\w]+)*\slike\smac|;\sopera)/i // iOS
], [[NAME, 'iOS'], [VERSION, /_/g, '.']], [
/(mac\sos\sx)\s?([\w\s\.]+\w)*/i // Mac OS
], [NAME, [VERSION, /_/g, '.']], [
// Other
/(haiku)\s(\w+)/i, // Haiku
/(aix)\s((\d)(?=\.|\)|\s)[\w\.]*)*/i, // AIX
/(macintosh|mac(?=_powerpc)|plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos)/i,
// Plan9/Minix/BeOS/OS2/AmigaOS/MorphOS/RISCOS
/(unix)\s?([\w\.]+)*/i // UNIX
], [NAME, VERSION]
]
};
/////////////////
// Constructor
////////////////
var UAParser = function (uastring) {
var ua = uastring || ((window && window.navigator && window.navigator.userAgent) ? window.navigator.userAgent : EMPTY);
this.getBrowser = function () {
return mapper.rgx.apply(this, regexes.browser);
};
this.getEngine = function () {
return mapper.rgx.apply(this, regexes.engine);
};
this.getOS = function () {
return mapper.rgx.apply(this, regexes.os);
};
this.getResult = function() {
return {
ua : this.getUA(),
browser : this.getBrowser(),
engine : this.getEngine(),
os : this.getOS()
};
};
this.getUA = function () {
return ua;
};
this.setUA = function (uastring) {
ua = uastring;
return this;
};
this.setUA(ua);
};
return new UAParser().getResult();
})();
function version_compare(v1, v2, operator) {
// From: http://phpjs.org/functions
// + original by: Philippe Jausions (http://pear.php.net/user/jausions)
// + original by: Aidan Lister (http://aidanlister.com/)
// + reimplemented by: Kankrelune (http://www.webfaktory.info/)
// + improved by: Brett Zamir (http://brett-zamir.me)
// + improved by: Scott Baker
// + improved by: Theriault
// * example 1: version_compare('8.2.5rc', '8.2.5a');
// * returns 1: 1
// * example 2: version_compare('8.2.50', '8.2.52', '<');
// * returns 2: true
// * example 3: version_compare('5.3.0-dev', '5.3.0');
// * returns 3: -1
// * example 4: version_compare('4.1.0.52','4.01.0.51');
// * returns 4: 1
// Important: compare must be initialized at 0.
var i = 0,
x = 0,
compare = 0,
// vm maps textual PHP versions to negatives so they're less than 0.
// PHP currently defines these as CASE-SENSITIVE. It is important to
// leave these as negatives so that they can come before numerical versions
// and as if no letters were there to begin with.
// (1alpha is < 1 and < 1.1 but > 1dev1)
// If a non-numerical value can't be mapped to this table, it receives
// -7 as its value.
vm = {
'dev': -6,
'alpha': -5,
'a': -5,
'beta': -4,
'b': -4,
'RC': -3,
'rc': -3,
'#': -2,
'p': 1,
'pl': 1
},
// This function will be called to prepare each version argument.
// It replaces every _, -, and + with a dot.
// It surrounds any nonsequence of numbers/dots with dots.
// It replaces sequences of dots with a single dot.
// version_compare('4..0', '4.0') == 0
// Important: A string of 0 length needs to be converted into a value
// even less than an unexisting value in vm (-7), hence [-8].
// It's also important to not strip spaces because of this.
// version_compare('', ' ') == 1
prepVersion = function (v) {
v = ('' + v).replace(/[_\-+]/g, '.');
v = v.replace(/([^.\d]+)/g, '.$1.').replace(/\.{2,}/g, '.');
return (!v.length ? [-8] : v.split('.'));
},
// This converts a version component to a number.
// Empty component becomes 0.
// Non-numerical component becomes a negative number.
// Numerical component becomes itself as an integer.
numVersion = function (v) {
return !v ? 0 : (isNaN(v) ? vm[v] || -7 : parseInt(v, 10));
};
v1 = prepVersion(v1);
v2 = prepVersion(v2);
x = Math.max(v1.length, v2.length);
for (i = 0; i < x; i++) {
if (v1[i] == v2[i]) {
continue;
}
v1[i] = numVersion(v1[i]);
v2[i] = numVersion(v2[i]);
if (v1[i] < v2[i]) {
compare = -1;
break;
} else if (v1[i] > v2[i]) {
compare = 1;
break;
}
}
if (!operator) {
return compare;
}
// Important: operator is CASE-SENSITIVE.
// "No operator" seems to be treated as "<."
// Any other values seem to make the function return null.
switch (operator) {
case '>':
case 'gt':
return (compare > 0);
case '>=':
case 'ge':
return (compare >= 0);
case '<=':
case 'le':
return (compare <= 0);
case '==':
case '=':
case 'eq':
return (compare === 0);
case '<>':
case '!=':
case 'ne':
return (compare !== 0);
case '':
case '<':
case 'lt':
return (compare < 0);
default:
return null;
}
}
var can = (function() {
var caps = {
define_property: (function() {
/* // currently too much extra code required, not exactly worth it
try { // as of IE8, getters/setters are supported only on DOM elements
var obj = {};
if (Object.defineProperty) {
Object.defineProperty(obj, 'prop', {
enumerable: true,
configurable: true
});
return true;
}
} catch(ex) {}
if (Object.prototype.__defineGetter__ && Object.prototype.__defineSetter__) {
return true;
}*/
return false;
}()),
create_canvas: (function() {
// On the S60 and BB Storm, getContext exists, but always returns undefined
// so we actually have to call getContext() to verify
// github.com/Modernizr/Modernizr/issues/issue/97/
var el = document.createElement('canvas');
return !!(el.getContext && el.getContext('2d'));
}()),
return_response_type: function(responseType) {
try {
if (Basic.inArray(responseType, ['', 'text', 'document']) !== -1) {
return true;
} else if (window.XMLHttpRequest) {
var xhr = new XMLHttpRequest();
xhr.open('get', '/'); // otherwise Gecko throws an exception
if ('responseType' in xhr) {
xhr.responseType = responseType;
// as of 23.0.1271.64, Chrome switched from throwing exception to merely logging it to the console (why? o why?)
if (xhr.responseType !== responseType) {
return false;
}
return true;
}
}
} catch (ex) {}
return false;
},
// ideas for this heavily come from Modernizr (http://modernizr.com/)
use_data_uri: (function() {
var du = new Image();
du.onload = function() {
caps.use_data_uri = (du.width === 1 && du.height === 1);
};
setTimeout(function() {
du.src = "data:image/gif;base64,R0lGODlhAQABAIAAAP8AAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
}, 1);
return false;
}()),
use_data_uri_over32kb: function() { // IE8
return caps.use_data_uri && (Env.browser !== 'IE' || Env.version >= 9);
},
use_data_uri_of: function(bytes) {
return (caps.use_data_uri && bytes < 33000 || caps.use_data_uri_over32kb());
},
use_fileinput: function() {
var el = document.createElement('input');
el.setAttribute('type', 'file');
return !el.disabled;
}
};
return function(cap) {
var args = [].slice.call(arguments);
args.shift(); // shift of cap
return Basic.typeOf(caps[cap]) === 'function' ? caps[cap].apply(this, args) : !!caps[cap];
};
}());
var Env = {
can: can,
browser: UAParser.browser.name,
version: parseFloat(UAParser.browser.major),
os: UAParser.os.name, // everybody intuitively types it in a lowercase for some reason
osVersion: UAParser.os.version,
verComp: version_compare,
swf_url: "../flash/Moxie.swf",
xap_url: "../silverlight/Moxie.xap",
global_event_dispatcher: "moxie.core.EventTarget.instance.dispatchEvent"
};
// for backward compatibility
// @deprecated Use `Env.os` instead
Env.OS = Env.os;
return Env;
});
// Included from: src/javascript/core/utils/Dom.js
/**
* Dom.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Dom', ['moxie/core/utils/Env'], function(Env) {
/**
Get DOM Element by it's id.
@method get
@for Utils
@param {String} id Identifier of the DOM Element
@return {DOMElement}
*/
var get = function(id) {
if (typeof id !== 'string') {
return id;
}
return document.getElementById(id);
};
/**
Checks if specified DOM element has specified class.
@method hasClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var hasClass = function(obj, name) {
if (!obj.className) {
return false;
}
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
return regExp.test(obj.className);
};
/**
Adds specified className to specified DOM element.
@method addClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var addClass = function(obj, name) {
if (!hasClass(obj, name)) {
obj.className = !obj.className ? name : obj.className.replace(/\s+$/, '') + ' ' + name;
}
};
/**
Removes specified className from specified DOM element.
@method removeClass
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Class name
*/
var removeClass = function(obj, name) {
if (obj.className) {
var regExp = new RegExp("(^|\\s+)"+name+"(\\s+|$)");
obj.className = obj.className.replace(regExp, function($0, $1, $2) {
return $1 === ' ' && $2 === ' ' ? ' ' : '';
});
}
};
/**
Returns a given computed style of a DOM element.
@method getStyle
@static
@param {Object} obj DOM element like object.
@param {String} name Style you want to get from the DOM element
*/
var getStyle = function(obj, name) {
if (obj.currentStyle) {
return obj.currentStyle[name];
} else if (window.getComputedStyle) {
return window.getComputedStyle(obj, null)[name];
}
};
/**
Returns the absolute x, y position of an Element. The position will be returned in a object with x, y fields.
@method getPos
@static
@param {Element} node HTML element or element id to get x, y position from.
@param {Element} root Optional root element to stop calculations at.
@return {object} Absolute position of the specified element object with x, y fields.
*/
var getPos = function(node, root) {
var x = 0, y = 0, parent, doc = document, nodeRect, rootRect;
node = node;
root = root || doc.body;
// Returns the x, y cordinate for an element on IE 6 and IE 7
function getIEPos(node) {
var bodyElm, rect, x = 0, y = 0;
if (node) {
rect = node.getBoundingClientRect();
bodyElm = doc.compatMode === "CSS1Compat" ? doc.documentElement : doc.body;
x = rect.left + bodyElm.scrollLeft;
y = rect.top + bodyElm.scrollTop;
}
return {
x : x,
y : y
};
}
// Use getBoundingClientRect on IE 6 and IE 7 but not on IE 8 in standards mode
if (node && node.getBoundingClientRect && Env.browser === 'IE' && (!doc.documentMode || doc.documentMode < 8)) {
nodeRect = getIEPos(node);
rootRect = getIEPos(root);
return {
x : nodeRect.x - rootRect.x,
y : nodeRect.y - rootRect.y
};
}
parent = node;
while (parent && parent != root && parent.nodeType) {
x += parent.offsetLeft || 0;
y += parent.offsetTop || 0;
parent = parent.offsetParent;
}
parent = node.parentNode;
while (parent && parent != root && parent.nodeType) {
x -= parent.scrollLeft || 0;
y -= parent.scrollTop || 0;
parent = parent.parentNode;
}
return {
x : x,
y : y
};
};
/**
Returns the size of the specified node in pixels.
@method getSize
@static
@param {Node} node Node to get the size of.
@return {Object} Object with a w and h property.
*/
var getSize = function(node) {
return {
w : node.offsetWidth || node.clientWidth,
h : node.offsetHeight || node.clientHeight
};
};
return {
get: get,
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
getStyle: getStyle,
getPos: getPos,
getSize: getSize
};
});
// Included from: src/javascript/core/Exceptions.js
/**
* Exceptions.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/Exceptions', [
'moxie/core/utils/Basic'
], function(Basic) {
function _findKey(obj, value) {
var key;
for (key in obj) {
if (obj[key] === value) {
return key;
}
}
return null;
}
return {
RuntimeError: (function() {
var namecodes = {
NOT_INIT_ERR: 1,
NOT_SUPPORTED_ERR: 9,
JS_ERR: 4
};
function RuntimeError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": RuntimeError " + this.code;
}
Basic.extend(RuntimeError, namecodes);
RuntimeError.prototype = Error.prototype;
return RuntimeError;
}()),
OperationNotAllowedException: (function() {
function OperationNotAllowedException(code) {
this.code = code;
this.name = 'OperationNotAllowedException';
}
Basic.extend(OperationNotAllowedException, {
NOT_ALLOWED_ERR: 1
});
OperationNotAllowedException.prototype = Error.prototype;
return OperationNotAllowedException;
}()),
ImageError: (function() {
var namecodes = {
WRONG_FORMAT: 1,
MAX_RESOLUTION_ERR: 2
};
function ImageError(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": ImageError " + this.code;
}
Basic.extend(ImageError, namecodes);
ImageError.prototype = Error.prototype;
return ImageError;
}()),
FileException: (function() {
var namecodes = {
NOT_FOUND_ERR: 1,
SECURITY_ERR: 2,
ABORT_ERR: 3,
NOT_READABLE_ERR: 4,
ENCODING_ERR: 5,
NO_MODIFICATION_ALLOWED_ERR: 6,
INVALID_STATE_ERR: 7,
SYNTAX_ERR: 8
};
function FileException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": FileException " + this.code;
}
Basic.extend(FileException, namecodes);
FileException.prototype = Error.prototype;
return FileException;
}()),
DOMException: (function() {
var namecodes = {
INDEX_SIZE_ERR: 1,
DOMSTRING_SIZE_ERR: 2,
HIERARCHY_REQUEST_ERR: 3,
WRONG_DOCUMENT_ERR: 4,
INVALID_CHARACTER_ERR: 5,
NO_DATA_ALLOWED_ERR: 6,
NO_MODIFICATION_ALLOWED_ERR: 7,
NOT_FOUND_ERR: 8,
NOT_SUPPORTED_ERR: 9,
INUSE_ATTRIBUTE_ERR: 10,
INVALID_STATE_ERR: 11,
SYNTAX_ERR: 12,
INVALID_MODIFICATION_ERR: 13,
NAMESPACE_ERR: 14,
INVALID_ACCESS_ERR: 15,
VALIDATION_ERR: 16,
TYPE_MISMATCH_ERR: 17,
SECURITY_ERR: 18,
NETWORK_ERR: 19,
ABORT_ERR: 20,
URL_MISMATCH_ERR: 21,
QUOTA_EXCEEDED_ERR: 22,
TIMEOUT_ERR: 23,
INVALID_NODE_TYPE_ERR: 24,
DATA_CLONE_ERR: 25
};
function DOMException(code) {
this.code = code;
this.name = _findKey(namecodes, code);
this.message = this.name + ": DOMException " + this.code;
}
Basic.extend(DOMException, namecodes);
DOMException.prototype = Error.prototype;
return DOMException;
}()),
EventException: (function() {
function EventException(code) {
this.code = code;
this.name = 'EventException';
}
Basic.extend(EventException, {
UNSPECIFIED_EVENT_TYPE_ERR: 0
});
EventException.prototype = Error.prototype;
return EventException;
}())
};
});
// Included from: src/javascript/core/EventTarget.js
/**
* EventTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/EventTarget', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic'
], function(x, Basic) {
/**
Parent object for all event dispatching components and objects
@class EventTarget
@constructor EventTarget
*/
function EventTarget() {
// hash of event listeners by object uid
var eventpool = {};
Basic.extend(this, {
/**
Unique id of the event dispatcher, usually overriden by children
@property uid
@type String
*/
uid: null,
/**
Can be called from within a child in order to acquire uniqie id in automated manner
@method init
*/
init: function() {
if (!this.uid) {
this.uid = Basic.guid('uid_');
}
},
/**
Register a handler to a specific event dispatched by the object
@method addEventListener
@param {String} type Type or basically a name of the event to subscribe to
@param {Function} fn Callback function that will be called when event happens
@param {Number} [priority=0] Priority of the event handler - handlers with higher priorities will be called first
@param {Object} [scope=this] A scope to invoke event handler in
*/
addEventListener: function(type, fn, priority, scope) {
var self = this, list;
type = Basic.trim(type);
if (/\s/.test(type)) {
// multiple event types were passed for one handler
Basic.each(type.split(/\s+/), function(type) {
self.addEventListener(type, fn, priority, scope);
});
return;
}
type = type.toLowerCase();
priority = parseInt(priority, 10) || 0;
list = eventpool[this.uid] && eventpool[this.uid][type] || [];
list.push({fn : fn, priority : priority, scope : scope || this});
if (!eventpool[this.uid]) {
eventpool[this.uid] = {};
}
eventpool[this.uid][type] = list;
},
/**
Check if any handlers were registered to the specified event
@method hasEventListener
@param {String} type Type or basically a name of the event to check
@return {Mixed} Returns a handler if it was found and false, if - not
*/
hasEventListener: function(type) {
return type ? !!(eventpool[this.uid] && eventpool[this.uid][type]) : !!eventpool[this.uid];
},
/**
Unregister the handler from the event, or if former was not specified - unregister all handlers
@method removeEventListener
@param {String} type Type or basically a name of the event
@param {Function} [fn] Handler to unregister
*/
removeEventListener: function(type, fn) {
type = type.toLowerCase();
var list = eventpool[this.uid] && eventpool[this.uid][type], i;
if (list) {
if (fn) {
for (i = list.length - 1; i >= 0; i--) {
if (list[i].fn === fn) {
list.splice(i, 1);
break;
}
}
} else {
list = [];
}
// delete event list if it has become empty
if (!list.length) {
delete eventpool[this.uid][type];
// and object specific entry in a hash if it has no more listeners attached
if (Basic.isEmptyObj(eventpool[this.uid])) {
delete eventpool[this.uid];
}
}
}
},
/**
Remove all event handlers from the object
@method removeAllEventListeners
*/
removeAllEventListeners: function() {
if (eventpool[this.uid]) {
delete eventpool[this.uid];
}
},
/**
Dispatch the event
@method dispatchEvent
@param {String/Object} Type of event or event object to dispatch
@param {Mixed} [...] Variable number of arguments to be passed to a handlers
@return {Boolean} true by default and false if any handler returned false
*/
dispatchEvent: function(type) {
var uid, list, args, tmpEvt, evt = {}, result = true, undef;
if (Basic.typeOf(type) !== 'string') {
// we can't use original object directly (because of Silverlight)
tmpEvt = type;
if (Basic.typeOf(tmpEvt.type) === 'string') {
type = tmpEvt.type;
if (tmpEvt.total !== undef && tmpEvt.loaded !== undef) { // progress event
evt.total = tmpEvt.total;
evt.loaded = tmpEvt.loaded;
}
evt.async = tmpEvt.async || false;
} else {
throw new x.EventException(x.EventException.UNSPECIFIED_EVENT_TYPE_ERR);
}
}
// check if event is meant to be dispatched on an object having specific uid
if (type.indexOf('::') !== -1) {
(function(arr) {
uid = arr[0];
type = arr[1];
}(type.split('::')));
} else {
uid = this.uid;
}
type = type.toLowerCase();
list = eventpool[uid] && eventpool[uid][type];
if (list) {
// sort event list by prority
list.sort(function(a, b) { return b.priority - a.priority; });
args = [].slice.call(arguments);
// first argument will be pseudo-event object
args.shift();
evt.type = type;
args.unshift(evt);
// Dispatch event to all listeners
var queue = [];
Basic.each(list, function(handler) {
// explicitly set the target, otherwise events fired from shims do not get it
args[0].target = handler.scope;
// if event is marked as async, detach the handler
if (evt.async) {
queue.push(function(cb) {
setTimeout(function() {
cb(handler.fn.apply(handler.scope, args) === false);
}, 1);
});
} else {
queue.push(function(cb) {
cb(handler.fn.apply(handler.scope, args) === false); // if handler returns false stop propagation
});
}
});
if (queue.length) {
Basic.inSeries(queue, function(err) {
result = !err;
});
}
}
return result;
},
/**
Alias for addEventListener
@method bind
@protected
*/
bind: function() {
this.addEventListener.apply(this, arguments);
},
/**
Alias for removeEventListener
@method unbind
@protected
*/
unbind: function() {
this.removeEventListener.apply(this, arguments);
},
/**
Alias for removeAllEventListeners
@method unbindAll
@protected
*/
unbindAll: function() {
this.removeAllEventListeners.apply(this, arguments);
},
/**
Alias for dispatchEvent
@method trigger
@protected
*/
trigger: function() {
return this.dispatchEvent.apply(this, arguments);
},
/**
Converts properties of on[event] type to corresponding event handlers,
is used to avoid extra hassle around the process of calling them back
@method convertEventPropsToHandlers
@private
*/
convertEventPropsToHandlers: function(handlers) {
var h;
if (Basic.typeOf(handlers) !== 'array') {
handlers = [handlers];
}
for (var i = 0; i < handlers.length; i++) {
h = 'on' + handlers[i];
if (Basic.typeOf(this[h]) === 'function') {
this.addEventListener(handlers[i], this[h]);
} else if (Basic.typeOf(this[h]) === 'undefined') {
this[h] = null; // object must have defined event properties, even if it doesn't make use of them
}
}
}
});
}
EventTarget.instance = new EventTarget();
return EventTarget;
});
// Included from: src/javascript/core/utils/Encode.js
/**
* Encode.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Encode', [], function() {
/**
Encode string with UTF-8
@method utf8_encode
@for Utils
@static
@param {String} str String to encode
@return {String} UTF-8 encoded string
*/
var utf8_encode = function(str) {
return unescape(encodeURIComponent(str));
};
/**
Decode UTF-8 encoded string
@method utf8_decode
@static
@param {String} str String to decode
@return {String} Decoded string
*/
var utf8_decode = function(str_data) {
return decodeURIComponent(escape(str_data));
};
/**
Decode Base64 encoded string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_decode.js
@method atob
@static
@param {String} data String to decode
@return {String} Decoded string
*/
var atob = function(data, utf8) {
if (typeof(window.atob) === 'function') {
return utf8 ? utf8_decode(window.atob(data)) : window.atob(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Thunder.m
// + input by: Aman Gupta
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Onno Marsman
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// * example 1: base64_decode('S2V2aW4gdmFuIFpvbm5ldmVsZA==');
// * returns 1: 'Kevin van Zonneveld'
// mozilla has this native
// - but breaks in 2.0.0.12!
//if (typeof this.window.atob == 'function') {
// return atob(data);
//}
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
dec = "",
tmp_arr = [];
if (!data) {
return data;
}
data += '';
do { // unpack four hexets into three octets using index points in b64
h1 = b64.indexOf(data.charAt(i++));
h2 = b64.indexOf(data.charAt(i++));
h3 = b64.indexOf(data.charAt(i++));
h4 = b64.indexOf(data.charAt(i++));
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4;
o1 = bits >> 16 & 0xff;
o2 = bits >> 8 & 0xff;
o3 = bits & 0xff;
if (h3 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1);
} else if (h4 == 64) {
tmp_arr[ac++] = String.fromCharCode(o1, o2);
} else {
tmp_arr[ac++] = String.fromCharCode(o1, o2, o3);
}
} while (i < data.length);
dec = tmp_arr.join('');
return utf8 ? utf8_decode(dec) : dec;
};
/**
Base64 encode string (uses browser's default method if available),
from: https://raw.github.com/kvz/phpjs/master/functions/url/base64_encode.js
@method btoa
@static
@param {String} data String to encode
@return {String} Base64 encoded string
*/
var btoa = function(data, utf8) {
if (utf8) {
utf8_encode(data);
}
if (typeof(window.btoa) === 'function') {
return window.btoa(data);
}
// http://kevin.vanzonneveld.net
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Bayron Guevara
// + improved by: Thunder.m
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Rafał Kukawski (http://kukawski.pl)
// * example 1: base64_encode('Kevin van Zonneveld');
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
// mozilla has this native
// - but breaks in 2.0.0.12!
var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
enc = "",
tmp_arr = [];
if (!data) {
return data;
}
do { // pack three octets into four hexets
o1 = data.charCodeAt(i++);
o2 = data.charCodeAt(i++);
o3 = data.charCodeAt(i++);
bits = o1 << 16 | o2 << 8 | o3;
h1 = bits >> 18 & 0x3f;
h2 = bits >> 12 & 0x3f;
h3 = bits >> 6 & 0x3f;
h4 = bits & 0x3f;
// use hexets to index into b64, and append result to encoded string
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
} while (i < data.length);
enc = tmp_arr.join('');
var r = data.length % 3;
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
};
return {
utf8_encode: utf8_encode,
utf8_decode: utf8_decode,
atob: atob,
btoa: btoa
};
});
// Included from: src/javascript/runtime/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/Runtime', [
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/EventTarget"
], function(Basic, Dom, EventTarget) {
var runtimeConstructors = {}, runtimes = {};
/**
Common set of methods and properties for every runtime instance
@class Runtime
@param {Object} options
@param {String} type Sanitized name of the runtime
@param {Object} [caps] Set of capabilities that differentiate specified runtime
@param {Object} [modeCaps] Set of capabilities that do require specific operational mode
@param {String} [preferredMode='browser'] Preferred operational mode to choose if no required capabilities were requested
*/
function Runtime(options, type, caps, modeCaps, preferredMode) {
/**
Dispatched when runtime is initialized and ready.
Results in RuntimeInit on a connected component.
@event Init
*/
/**
Dispatched when runtime fails to initialize.
Results in RuntimeError on a connected component.
@event Error
*/
var self = this
, _shim
, _uid = Basic.guid(type + '_')
, defaultMode = preferredMode || 'browser'
;
options = options || {};
// register runtime in private hash
runtimes[_uid] = this;
/**
Default set of capabilities, which can be redifined later by specific runtime
@private
@property caps
@type Object
*/
caps = Basic.extend({
// Runtime can:
// provide access to raw binary data of the file
access_binary: false,
// provide access to raw binary data of the image (image extension is optional)
access_image_binary: false,
// display binary data as thumbs for example
display_media: false,
// make cross-domain requests
do_cors: false,
// accept files dragged and dropped from the desktop
drag_and_drop: false,
// filter files in selection dialog by their extensions
filter_by_extension: true,
// resize image (and manipulate it raw data of any file in general)
resize_image: false,
// periodically report how many bytes of total in the file were uploaded (loaded)
report_upload_progress: false,
// provide access to the headers of http response
return_response_headers: false,
// support response of specific type, which should be passed as an argument
// e.g. runtime.can('return_response_type', 'blob')
return_response_type: false,
// return http status code of the response
return_status_code: true,
// send custom http header with the request
send_custom_headers: false,
// pick up the files from a dialog
select_file: false,
// select whole folder in file browse dialog
select_folder: false,
// select multiple files at once in file browse dialog
select_multiple: true,
// send raw binary data, that is generated after image resizing or manipulation of other kind
send_binary_string: false,
// send cookies with http request and therefore retain session
send_browser_cookies: true,
// send data formatted as multipart/form-data
send_multipart: true,
// slice the file or blob to smaller parts
slice_blob: false,
// upload file without preloading it to memory, stream it out directly from disk
stream_upload: false,
// programmatically trigger file browse dialog
summon_file_dialog: false,
// upload file of specific size, size should be passed as argument
// e.g. runtime.can('upload_filesize', '500mb')
upload_filesize: true,
// initiate http request with specific http method, method should be passed as argument
// e.g. runtime.can('use_http_method', 'put')
use_http_method: true
}, caps);
// default to the mode that is compatible with preferred caps
if (options.preferred_caps) {
defaultMode = Runtime.getMode(modeCaps, options.preferred_caps, defaultMode);
}
// small extension factory here (is meant to be extended with actual extensions constructors)
_shim = (function() {
var objpool = {};
return {
exec: function(uid, comp, fn, args) {
if (_shim[comp]) {
if (!objpool[uid]) {
objpool[uid] = {
context: this,
instance: new _shim[comp]()
};
}
if (objpool[uid].instance[fn]) {
return objpool[uid].instance[fn].apply(this, args);
}
}
},
removeInstance: function(uid) {
delete objpool[uid];
},
removeAllInstances: function() {
var self = this;
Basic.each(objpool, function(obj, uid) {
if (Basic.typeOf(obj.instance.destroy) === 'function') {
obj.instance.destroy.call(obj.context);
}
self.removeInstance(uid);
});
}
};
}());
// public methods
Basic.extend(this, {
/**
Specifies whether runtime instance was initialized or not
@property initialized
@type {Boolean}
@default false
*/
initialized: false, // shims require this flag to stop initialization retries
/**
Unique ID of the runtime
@property uid
@type {String}
*/
uid: _uid,
/**
Runtime type (e.g. flash, html5, etc)
@property type
@type {String}
*/
type: type,
/**
Runtime (not native one) may operate in browser or client mode.
@property mode
@private
@type {String|Boolean} current mode or false, if none possible
*/
mode: Runtime.getMode(modeCaps, (options.required_caps), defaultMode),
/**
id of the DOM container for the runtime (if available)
@property shimid
@type {String}
*/
shimid: _uid + '_container',
/**
Number of connected clients. If equal to zero, runtime can be destroyed
@property clients
@type {Number}
*/
clients: 0,
/**
Runtime initialization options
@property options
@type {Object}
*/
options: options,
/**
Checks if the runtime has specific capability
@method can
@param {String} cap Name of capability to check
@param {Mixed} [value] If passed, capability should somehow correlate to the value
@param {Object} [refCaps] Set of capabilities to check the specified cap against (defaults to internal set)
@return {Boolean} true if runtime has such capability and false, if - not
*/
can: function(cap, value) {
var refCaps = arguments[2] || caps;
// if cap var is a comma-separated list of caps, convert it to object (key/value)
if (Basic.typeOf(cap) === 'string' && Basic.typeOf(value) === 'undefined') {
cap = Runtime.parseCaps(cap);
}
if (Basic.typeOf(cap) === 'object') {
for (var key in cap) {
if (!this.can(key, cap[key], refCaps)) {
return false;
}
}
return true;
}
// check the individual cap
if (Basic.typeOf(refCaps[cap]) === 'function') {
return refCaps[cap].call(this, value);
} else {
return (value === refCaps[cap]);
}
},
/**
Returns container for the runtime as DOM element
@method getShimContainer
@return {DOMElement}
*/
getShimContainer: function() {
var container, shimContainer = Dom.get(this.shimid);
// if no container for shim, create one
if (!shimContainer) {
container = this.options.container ? Dom.get(this.options.container) : document.body;
// create shim container and insert it at an absolute position into the outer container
shimContainer = document.createElement('div');
shimContainer.id = this.shimid;
shimContainer.className = 'moxie-shim moxie-shim-' + this.type;
Basic.extend(shimContainer.style, {
position: 'absolute',
top: '0px',
left: '0px',
width: '1px',
height: '1px',
overflow: 'hidden'
});
container.appendChild(shimContainer);
container = null;
}
return shimContainer;
},
/**
Returns runtime as DOM element (if appropriate)
@method getShim
@return {DOMElement}
*/
getShim: function() {
return _shim;
},
/**
Invokes a method within the runtime itself (might differ across the runtimes)
@method shimExec
@param {Mixed} []
@protected
@return {Mixed} Depends on the action and component
*/
shimExec: function(component, action) {
var args = [].slice.call(arguments, 2);
return self.getShim().exec.call(this, this.uid, component, action, args);
},
/**
Operaional interface that is used by components to invoke specific actions on the runtime
(is invoked in the scope of component)
@method exec
@param {Mixed} []*
@protected
@return {Mixed} Depends on the action and component
*/
exec: function(component, action) { // this is called in the context of component, not runtime
var args = [].slice.call(arguments, 2);
if (self[component] && self[component][action]) {
return self[component][action].apply(this, args);
}
return self.shimExec.apply(this, arguments);
},
/**
Destroys the runtime (removes all events and deletes DOM structures)
@method destroy
*/
destroy: function() {
if (!self) {
return; // obviously already destroyed
}
var shimContainer = Dom.get(this.shimid);
if (shimContainer) {
shimContainer.parentNode.removeChild(shimContainer);
}
if (_shim) {
_shim.removeAllInstances();
}
this.unbindAll();
delete runtimes[this.uid];
this.uid = null; // mark this runtime as destroyed
_uid = self = _shim = shimContainer = null;
}
});
// once we got the mode, test against all caps
if (this.mode && options.required_caps && !this.can(options.required_caps)) {
this.mode = false;
}
}
/**
Default order to try different runtime types
@property order
@type String
@static
*/
Runtime.order = 'html5,flash,silverlight,html4';
/**
Retrieves runtime from private hash by it's uid
@method getRuntime
@private
@static
@param {String} uid Unique identifier of the runtime
@return {Runtime|Boolean} Returns runtime, if it exists and false, if - not
*/
Runtime.getRuntime = function(uid) {
return runtimes[uid] ? runtimes[uid] : false;
};
/**
Register constructor for the Runtime of new (or perhaps modified) type
@method addConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {Function} construct Constructor for the Runtime type
*/
Runtime.addConstructor = function(type, constructor) {
constructor.prototype = EventTarget.instance;
runtimeConstructors[type] = constructor;
};
/**
Get the constructor for the specified type.
method getConstructor
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@return {Function} Constructor for the Runtime type
*/
Runtime.getConstructor = function(type) {
return runtimeConstructors[type] || null;
};
/**
Get info about the runtime (uid, type, capabilities)
@method getInfo
@static
@param {String} uid Unique identifier of the runtime
@return {Mixed} Info object or null if runtime doesn't exist
*/
Runtime.getInfo = function(uid) {
var runtime = Runtime.getRuntime(uid);
if (runtime) {
return {
uid: runtime.uid,
type: runtime.type,
mode: runtime.mode,
can: function() {
return runtime.can.apply(runtime, arguments);
}
};
}
return null;
};
/**
Convert caps represented by a comma-separated string to the object representation.
@method parseCaps
@static
@param {String} capStr Comma-separated list of capabilities
@return {Object}
*/
Runtime.parseCaps = function(capStr) {
var capObj = {};
if (Basic.typeOf(capStr) !== 'string') {
return capStr || {};
}
Basic.each(capStr.split(','), function(key) {
capObj[key] = true; // we assume it to be - true
});
return capObj;
};
/**
Test the specified runtime for specific capabilities.
@method can
@static
@param {String} type Runtime type (e.g. flash, html5, etc)
@param {String|Object} caps Set of capabilities to check
@return {Boolean} Result of the test
*/
Runtime.can = function(type, caps) {
var runtime
, constructor = Runtime.getConstructor(type)
, mode
;
if (constructor) {
runtime = new constructor({
required_caps: caps
});
mode = runtime.mode;
runtime.destroy();
return !!mode;
}
return false;
};
/**
Figure out a runtime that supports specified capabilities.
@method thatCan
@static
@param {String|Object} caps Set of capabilities to check
@param {String} [runtimeOrder] Comma-separated list of runtimes to check against
@return {String} Usable runtime identifier or null
*/
Runtime.thatCan = function(caps, runtimeOrder) {
var types = (runtimeOrder || Runtime.order).split(/\s*,\s*/);
for (var i in types) {
if (Runtime.can(types[i], caps)) {
return types[i];
}
}
return null;
};
/**
Figure out an operational mode for the specified set of capabilities.
@method getMode
@static
@param {Object} modeCaps Set of capabilities that depend on particular runtime mode
@param {Object} [requiredCaps] Supplied set of capabilities to find operational mode for
@param {String|Boolean} [defaultMode='browser'] Default mode to use
@return {String|Boolean} Compatible operational mode
*/
Runtime.getMode = function(modeCaps, requiredCaps, defaultMode) {
var mode = null;
if (Basic.typeOf(defaultMode) === 'undefined') { // only if not specified
defaultMode = 'browser';
}
if (requiredCaps && !Basic.isEmptyObj(modeCaps)) {
// loop over required caps and check if they do require the same mode
Basic.each(requiredCaps, function(value, cap) {
if (modeCaps.hasOwnProperty(cap)) {
var capMode = modeCaps[cap](value);
// make sure we always have an array
if (typeof(capMode) === 'string') {
capMode = [capMode];
}
if (!mode) {
mode = capMode;
} else if (!(mode = Basic.arrayIntersect(mode, capMode))) {
// if cap requires conflicting mode - runtime cannot fulfill required caps
return (mode = false);
}
}
});
if (mode) {
return Basic.inArray(defaultMode, mode) !== -1 ? defaultMode : mode[0];
} else if (mode === false) {
return false;
}
}
return defaultMode;
};
/**
Capability check that always returns true
@private
@static
@return {True}
*/
Runtime.capTrue = function() {
return true;
};
/**
Capability check that always returns false
@private
@static
@return {False}
*/
Runtime.capFalse = function() {
return false;
};
/**
Evaluate the expression to boolean value and create a function that always returns it.
@private
@static
@param {Mixed} expr Expression to evaluate
@return {Function} Function returning the result of evaluation
*/
Runtime.capTest = function(expr) {
return function() {
return !!expr;
};
};
return Runtime;
});
// Included from: src/javascript/runtime/RuntimeClient.js
/**
* RuntimeClient.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeClient', [
'moxie/core/Exceptions',
'moxie/core/utils/Basic',
'moxie/runtime/Runtime'
], function(x, Basic, Runtime) {
/**
Set of methods and properties, required by a component to acquire ability to connect to a runtime
@class RuntimeClient
*/
return function RuntimeClient() {
var runtime;
Basic.extend(this, {
/**
Connects to the runtime specified by the options. Will either connect to existing runtime or create a new one.
Increments number of clients connected to the specified runtime.
@method connectRuntime
@param {Mixed} options Can be a runtme uid or a set of key-value pairs defining requirements and pre-requisites
*/
connectRuntime: function(options) {
var comp = this, ruid;
function initialize(items) {
var type, constructor;
// if we ran out of runtimes
if (!items.length) {
comp.trigger('RuntimeError', new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR));
runtime = null;
return;
}
type = items.shift();
constructor = Runtime.getConstructor(type);
if (!constructor) {
initialize(items);
return;
}
// try initializing the runtime
runtime = new constructor(options);
runtime.bind('Init', function() {
// mark runtime as initialized
runtime.initialized = true;
// jailbreak ...
setTimeout(function() {
runtime.clients++;
// this will be triggered on component
comp.trigger('RuntimeInit', runtime);
}, 1);
});
runtime.bind('Error', function() {
runtime.destroy(); // runtime cannot destroy itself from inside at a right moment, thus we do it here
initialize(items);
});
/*runtime.bind('Exception', function() { });*/
// check if runtime managed to pick-up operational mode
if (!runtime.mode) {
runtime.trigger('Error');
return;
}
runtime.init();
}
// check if a particular runtime was requested
if (Basic.typeOf(options) === 'string') {
ruid = options;
} else if (Basic.typeOf(options.ruid) === 'string') {
ruid = options.ruid;
}
if (ruid) {
runtime = Runtime.getRuntime(ruid);
if (runtime) {
runtime.clients++;
return runtime;
} else {
// there should be a runtime and there's none - weird case
throw new x.RuntimeError(x.RuntimeError.NOT_INIT_ERR);
}
}
// initialize a fresh one, that fits runtime list and required features best
initialize((options.runtime_order || Runtime.order).split(/\s*,\s*/));
},
/**
Returns the runtime to which the client is currently connected.
@method getRuntime
@return {Runtime} Runtime or null if client is not connected
*/
getRuntime: function() {
if (runtime && runtime.uid) {
return runtime;
}
runtime = null; // make sure we do not leave zombies rambling around
return null;
},
/**
Disconnects from the runtime. Decrements number of clients connected to the specified runtime.
@method disconnectRuntime
*/
disconnectRuntime: function() {
if (runtime && --runtime.clients <= 0) {
runtime.destroy();
runtime = null;
}
}
});
};
});
// Included from: src/javascript/file/Blob.js
/**
* Blob.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/Blob', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/runtime/RuntimeClient'
], function(Basic, Encode, RuntimeClient) {
var blobpool = {};
/**
@class Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} blob Object "Native" blob object, as it is represented in the runtime
*/
function Blob(ruid, blob) {
function _sliceDetached(start, end, type) {
var blob, data = blobpool[this.uid];
if (Basic.typeOf(data) !== 'string' || !data.length) {
return null; // or throw exception
}
blob = new Blob(null, {
type: type,
size: end - start
});
blob.detach(data.substr(start, blob.size));
return blob;
}
RuntimeClient.call(this);
if (ruid) {
this.connectRuntime(ruid);
}
if (!blob) {
blob = {};
} else if (Basic.typeOf(blob) === 'string') { // dataUrl or binary string
blob = { data: blob };
}
Basic.extend(this, {
/**
Unique id of the component
@property uid
@type {String}
*/
uid: blob.uid || Basic.guid('uid_'),
/**
Unique id of the connected runtime, if falsy, then runtime will have to be initialized
before this Blob can be used, modified or sent
@property ruid
@type {String}
*/
ruid: ruid,
/**
Size of blob
@property size
@type {Number}
@default 0
*/
size: blob.size || 0,
/**
Mime type of blob
@property type
@type {String}
@default ''
*/
type: blob.type || '',
/**
@method slice
@param {Number} [start=0]
*/
slice: function(start, end, type) {
if (this.isDetached()) {
return _sliceDetached.apply(this, arguments);
}
return this.getRuntime().exec.call(this, 'Blob', 'slice', this.getSource(), start, end, type);
},
/**
Returns "native" blob object (as it is represented in connected runtime) or null if not found
@method getSource
@return {Blob} Returns "native" blob object or null if not found
*/
getSource: function() {
if (!blobpool[this.uid]) {
return null;
}
return blobpool[this.uid];
},
/**
Detaches blob from any runtime that it depends on and initialize with standalone value
@method detach
@protected
@param {DOMString} [data=''] Standalone value
*/
detach: function(data) {
if (this.ruid) {
this.getRuntime().exec.call(this, 'Blob', 'destroy');
this.disconnectRuntime();
this.ruid = null;
}
data = data || '';
// if dataUrl, convert to binary string
var matches = data.match(/^data:([^;]*);base64,/);
if (matches) {
this.type = matches[1];
data = Encode.atob(data.substring(data.indexOf('base64,') + 7));
}
this.size = data.length;
blobpool[this.uid] = data;
},
/**
Checks if blob is standalone (detached of any runtime)
@method isDetached
@protected
@return {Boolean}
*/
isDetached: function() {
return !this.ruid && Basic.typeOf(blobpool[this.uid]) === 'string';
},
/**
Destroy Blob and free any resources it was using
@method destroy
*/
destroy: function() {
this.detach();
delete blobpool[this.uid];
}
});
if (blob.data) {
this.detach(blob.data); // auto-detach if payload has been passed
} else {
blobpool[this.uid] = blob;
}
}
return Blob;
});
// Included from: src/javascript/file/File.js
/**
* File.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/File', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/file/Blob'
], function(Basic, Mime, Blob) {
/**
@class File
@extends Blob
@constructor
@param {String} ruid Unique id of the runtime, to which this blob belongs to
@param {Object} file Object "Native" file object, as it is represented in the runtime
*/
function File(ruid, file) {
var name, type;
if (!file) { // avoid extra errors in case we overlooked something
file = {};
}
// figure out the type
if (file.type && file.type !== '') {
type = file.type;
} else {
type = Mime.getFileMime(file.name);
}
// sanitize file name or generate new one
if (file.name) {
name = file.name.replace(/\\/g, '/');
name = name.substr(name.lastIndexOf('/') + 1);
} else {
var prefix = type.split('/')[0];
name = Basic.guid((prefix !== '' ? prefix : 'file') + '_');
if (Mime.extensions[type]) {
name += '.' + Mime.extensions[type][0]; // append proper extension if possible
}
}
Blob.apply(this, arguments);
Basic.extend(this, {
/**
File mime type
@property type
@type {String}
@default ''
*/
type: type || '',
/**
File name
@property name
@type {String}
@default UID
*/
name: name || Basic.guid('file_'),
/**
Relative path to the file inside a directory
@property relativePath
@type {String}
@default ''
*/
relativePath: '',
/**
Date of last modification
@property lastModifiedDate
@type {String}
@default now
*/
lastModifiedDate: file.lastModifiedDate || (new Date()).toLocaleString() // Thu Aug 23 2012 19:40:00 GMT+0400 (GET)
});
}
File.prototype = Blob.prototype;
return File;
});
// Included from: src/javascript/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileInput', [
'moxie/core/utils/Basic',
'moxie/core/utils/Mime',
'moxie/core/utils/Dom',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/core/I18n',
'moxie/file/File',
'moxie/runtime/Runtime',
'moxie/runtime/RuntimeClient'
], function(Basic, Mime, Dom, x, EventTarget, I18n, File, Runtime, RuntimeClient) {
/**
Provides a convenient way to create cross-browser file-picker. Generates file selection dialog on click,
converts selected files to _File_ objects, to be used in conjunction with _Image_, preloaded in memory
with _FileReader_ or uploaded to a server through _XMLHttpRequest_.
@class FileInput
@constructor
@extends EventTarget
@uses RuntimeClient
@param {Object|String|DOMElement} options If options is string or node, argument is considered as _browse\_button_.
@param {String|DOMElement} options.browse_button DOM Element to turn into file picker.
@param {Array} [options.accept] Array of mime types to accept. By default accepts all.
@param {String} [options.file='file'] Name of the file field (not the filename).
@param {Boolean} [options.multiple=false] Enable selection of multiple files.
@param {Boolean} [options.directory=false] Turn file input into the folder input (cannot be both at the same time).
@param {String|DOMElement} [options.container] DOM Element to use as a container for file-picker. Defaults to parentNode
for _browse\_button_.
@param {Object|String} [options.required_caps] Set of required capabilities, that chosen runtime must support.
@example
<div id="container">
<a id="file-picker" href="javascript:;">Browse...</a>
</div>
<script>
var fileInput = new mOxie.FileInput({
browse_button: 'file-picker', // or document.getElementById('file-picker')
container: 'container',
accept: [
{title: "Image files", extensions: "jpg,gif,png"} // accept only images
],
multiple: true // allow multiple file selection
});
fileInput.onchange = function(e) {
// do something to files array
console.info(e.target.files); // or this.files or fileInput.files
};
fileInput.init(); // initialize
</script>
*/
var dispatches = [
/**
Dispatched when runtime is connected and file-picker is ready to be used.
@event ready
@param {Object} event
*/
'ready',
/**
Dispatched right after [ready](#event_ready) event, and whenever [refresh()](#method_refresh) is invoked.
Check [corresponding documentation entry](#method_refresh) for more info.
@event refresh
@param {Object} event
*/
/**
Dispatched when selection of files in the dialog is complete.
@event change
@param {Object} event
*/
'change',
'cancel', // TODO: might be useful
/**
Dispatched when mouse cursor enters file-picker area. Can be used to style element
accordingly.
@event mouseenter
@param {Object} event
*/
'mouseenter',
/**
Dispatched when mouse cursor leaves file-picker area. Can be used to style element
accordingly.
@event mouseleave
@param {Object} event
*/
'mouseleave',
/**
Dispatched when functional mouse button is pressed on top of file-picker area.
@event mousedown
@param {Object} event
*/
'mousedown',
/**
Dispatched when functional mouse button is released on top of file-picker area.
@event mouseup
@param {Object} event
*/
'mouseup'
];
function FileInput(options) {
var self = this,
container, browseButton, defaults;
// if flat argument passed it should be browse_button id
if (Basic.inArray(Basic.typeOf(options), ['string', 'node']) !== -1) {
options = { browse_button : options };
}
// this will help us to find proper default container
browseButton = Dom.get(options.browse_button);
if (!browseButton) {
// browse button is required
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
// figure out the options
defaults = {
accept: [{
title: I18n.translate('All Files'),
extensions: '*'
}],
name: 'file',
multiple: false,
required_caps: false,
container: browseButton.parentNode || document.body
};
options = Basic.extend({}, defaults, options);
// convert to object representation
if (typeof(options.required_caps) === 'string') {
options.required_caps = Runtime.parseCaps(options.required_caps);
}
// normalize accept option (could be list of mime types or array of title/extensions pairs)
if (typeof(options.accept) === 'string') {
options.accept = Mime.mimes2extList(options.accept);
}
container = Dom.get(options.container);
// make sure we have container
if (!container) {
container = document.body;
}
// make container relative, if it's not
if (Dom.getStyle(container, 'position') === 'static') {
container.style.position = 'relative';
}
container = browseButton = null; // IE
RuntimeClient.call(self);
Basic.extend(self, {
/**
Unique id of the component
@property uid
@protected
@readOnly
@type {String}
@default UID
*/
uid: Basic.guid('uid_'),
/**
Unique id of the connected runtime, if any.
@property ruid
@protected
@type {String}
*/
ruid: null,
/**
Unique id of the runtime container. Useful to get hold of it for various manipulations.
@property shimid
@protected
@type {String}
*/
shimid: null,
/**
Array of selected mOxie.File objects
@property files
@type {Array}
@default null
*/
files: null,
/**
Initializes the file-picker, connects it to runtime and dispatches event ready when done.
@method init
*/
init: function() {
self.convertEventPropsToHandlers(dispatches);
self.bind('RuntimeInit', function(e, runtime) {
self.ruid = runtime.uid;
self.shimid = runtime.shimid;
self.bind("Ready", function() {
self.trigger("Refresh");
}, 999);
self.bind("Change", function() {
var files = runtime.exec.call(self, 'FileInput', 'getFiles');
self.files = [];
Basic.each(files, function(file) {
// ignore empty files (IE10 for example hangs if you try to send them via XHR)
if (file.size === 0) {
return true;
}
self.files.push(new File(self.ruid, file));
});
}, 999);
// re-position and resize shim container
self.bind('Refresh', function() {
var pos, size, browseButton, shimContainer;
browseButton = Dom.get(options.browse_button);
shimContainer = Dom.get(runtime.shimid); // do not use runtime.getShimContainer(), since it will create container if it doesn't exist
if (browseButton) {
pos = Dom.getPos(browseButton, Dom.get(options.container));
size = Dom.getSize(browseButton);
if (shimContainer) {
Basic.extend(shimContainer.style, {
top : pos.y + 'px',
left : pos.x + 'px',
width : size.w + 'px',
height : size.h + 'px'
});
}
}
shimContainer = browseButton = null;
});
runtime.exec.call(self, 'FileInput', 'init', options);
});
// runtime needs: options.required_features, options.runtime_order and options.container
self.connectRuntime(Basic.extend({}, options, {
required_caps: {
select_file: true
}
}));
},
/**
Disables file-picker element, so that it doesn't react to mouse clicks.
@method disable
@param {Boolean} [state=true] Disable component if - true, enable if - false
*/
disable: function(state) {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'disable', Basic.typeOf(state) === 'undefined' ? true : state);
}
},
/**
Reposition and resize dialog trigger to match the position and size of browse_button element.
@method refresh
*/
refresh: function() {
self.trigger("Refresh");
},
/**
Destroy component.
@method destroy
*/
destroy: function() {
var runtime = this.getRuntime();
if (runtime) {
runtime.exec.call(this, 'FileInput', 'destroy');
this.disconnectRuntime();
}
if (Basic.typeOf(this.files) === 'array') {
// no sense in leaving associated files behind
Basic.each(this.files, function(file) {
file.destroy();
});
}
this.files = null;
}
});
}
FileInput.prototype = EventTarget.instance;
return FileInput;
});
// Included from: src/javascript/runtime/RuntimeTarget.js
/**
* RuntimeTarget.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/runtime/RuntimeTarget', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
"moxie/core/EventTarget"
], function(Basic, RuntimeClient, EventTarget) {
/**
Instance of this class can be used as a target for the events dispatched by shims,
when allowing them onto components is for either reason inappropriate
@class RuntimeTarget
@constructor
@protected
@extends EventTarget
*/
function RuntimeTarget() {
this.uid = Basic.guid('uid_');
RuntimeClient.call(this);
this.destroy = function() {
this.disconnectRuntime();
this.unbindAll();
};
}
RuntimeTarget.prototype = EventTarget.instance;
return RuntimeTarget;
});
// Included from: src/javascript/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReader', [
'moxie/core/utils/Basic',
'moxie/core/utils/Encode',
'moxie/core/Exceptions',
'moxie/core/EventTarget',
'moxie/file/Blob',
'moxie/file/File',
'moxie/runtime/RuntimeTarget'
], function(Basic, Encode, x, EventTarget, Blob, File, RuntimeTarget) {
/**
Utility for preloading o.Blob/o.File objects in memory. By design closely follows [W3C FileReader](http://www.w3.org/TR/FileAPI/#dfn-filereader)
interface. Where possible uses native FileReader, where - not falls back to shims.
@class FileReader
@constructor FileReader
@extends EventTarget
@uses RuntimeClient
*/
var dispatches = [
/**
Dispatched when the read starts.
@event loadstart
@param {Object} event
*/
'loadstart',
/**
Dispatched while reading (and decoding) blob, and reporting partial Blob data (progess.loaded/progress.total).
@event progress
@param {Object} event
*/
'progress',
/**
Dispatched when the read has successfully completed.
@event load
@param {Object} event
*/
'load',
/**
Dispatched when the read has been aborted. For instance, by invoking the abort() method.
@event abort
@param {Object} event
*/
'abort',
/**
Dispatched when the read has failed.
@event error
@param {Object} event
*/
'error',
/**
Dispatched when the request has completed (either in success or failure).
@event loadend
@param {Object} event
*/
'loadend'
];
function FileReader() {
var self = this, _fr;
Basic.extend(this, {
/**
UID of the component instance.
@property uid
@type {String}
*/
uid: Basic.guid('uid_'),
/**
Contains current state of FileReader object. Can take values of FileReader.EMPTY, FileReader.LOADING
and FileReader.DONE.
@property readyState
@type {Number}
@default FileReader.EMPTY
*/
readyState: FileReader.EMPTY,
/**
Result of the successful read operation.
@property result
@type {String}
*/
result: null,
/**
Stores the error of failed asynchronous read operation.
@property error
@type {DOMError}
*/
error: null,
/**
Initiates reading of File/Blob object contents to binary string.
@method readAsBinaryString
@param {Blob|File} blob Object to preload
*/
readAsBinaryString: function(blob) {
_read.call(this, 'readAsBinaryString', blob);
},
/**
Initiates reading of File/Blob object contents to dataURL string.
@method readAsDataURL
@param {Blob|File} blob Object to preload
*/
readAsDataURL: function(blob) {
_read.call(this, 'readAsDataURL', blob);
},
/**
Initiates reading of File/Blob object contents to string.
@method readAsText
@param {Blob|File} blob Object to preload
*/
readAsText: function(blob) {
_read.call(this, 'readAsText', blob);
},
/**
Aborts preloading process.
@method abort
*/
abort: function() {
this.result = null;
if (Basic.inArray(this.readyState, [FileReader.EMPTY, FileReader.DONE]) !== -1) {
return;
} else if (this.readyState === FileReader.LOADING) {
this.readyState = FileReader.DONE;
}
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'abort');
}
this.trigger('abort');
this.trigger('loadend');
},
/**
Destroy component and release resources.
@method destroy
*/
destroy: function() {
this.abort();
if (_fr) {
_fr.getRuntime().exec.call(this, 'FileReader', 'destroy');
_fr.disconnectRuntime();
}
self = _fr = null;
}
});
function _read(op, blob) {
_fr = new RuntimeTarget();
function error(err) {
self.readyState = FileReader.DONE;
self.error = err;
self.trigger('error');
loadEnd();
}
function loadEnd() {
_fr.destroy();
_fr = null;
self.trigger('loadend');
}
function exec(runtime) {
_fr.bind('Error', function(e, err) {
error(err);
});
_fr.bind('Progress', function(e) {
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
});
_fr.bind('Load', function(e) {
self.readyState = FileReader.DONE;
self.result = runtime.exec.call(_fr, 'FileReader', 'getResult');
self.trigger(e);
loadEnd();
});
runtime.exec.call(_fr, 'FileReader', 'read', op, blob);
}
this.convertEventPropsToHandlers(dispatches);
if (this.readyState === FileReader.LOADING) {
return error(new x.DOMException(x.DOMException.INVALID_STATE_ERR));
}
this.readyState = FileReader.LOADING;
this.trigger('loadstart');
// if source is o.Blob/o.File
if (blob instanceof Blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsText':
case 'readAsBinaryString':
this.result = src;
break;
case 'readAsDataURL':
this.result = 'data:' + blob.type + ';base64,' + Encode.btoa(src);
break;
}
this.readyState = FileReader.DONE;
this.trigger('load');
loadEnd();
} else {
exec(_fr.connectRuntime(blob.ruid));
}
} else {
error(new x.DOMException(x.DOMException.NOT_FOUND_ERR));
}
}
}
/**
Initial FileReader state
@property EMPTY
@type {Number}
@final
@static
@default 0
*/
FileReader.EMPTY = 0;
/**
FileReader switches to this state when it is preloading the source
@property LOADING
@type {Number}
@final
@static
@default 1
*/
FileReader.LOADING = 1;
/**
Preloading is complete, this is a final state
@property DONE
@type {Number}
@final
@static
@default 2
*/
FileReader.DONE = 2;
FileReader.prototype = EventTarget.instance;
return FileReader;
});
// Included from: src/javascript/core/utils/Url.js
/**
* Url.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Url', [], function() {
/**
Parse url into separate components and fill in absent parts with parts from current url,
based on https://raw.github.com/kvz/phpjs/master/functions/url/parse_url.js
@method parseUrl
@for Utils
@static
@param {String} url Url to parse (defaults to empty string if undefined)
@return {Object} Hash containing extracted uri components
*/
var parseUrl = function(url, currentUrl) {
var key = ['source', 'scheme', 'authority', 'userInfo', 'user', 'pass', 'host', 'port', 'relative', 'path', 'directory', 'file', 'query', 'fragment']
, i = key.length
, ports = {
http: 80,
https: 443
}
, uri = {}
, regex = /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\\?([^#]*))?(?:#(.*))?)/
, m = regex.exec(url || '')
;
while (i--) {
if (m[i]) {
uri[key[i]] = m[i];
}
}
// when url is relative, we set the origin and the path ourselves
if (!uri.scheme) {
// come up with defaults
if (!currentUrl || typeof(currentUrl) === 'string') {
currentUrl = parseUrl(currentUrl || document.location.href);
}
uri.scheme = currentUrl.scheme;
uri.host = currentUrl.host;
uri.port = currentUrl.port;
var path = '';
// for urls without trailing slash we need to figure out the path
if (/^[^\/]/.test(uri.path)) {
path = currentUrl.path;
// if path ends with a filename, strip it
if (!/(\/|\/[^\.]+)$/.test(path)) {
path = path.replace(/\/[^\/]+$/, '/');
} else {
path += '/';
}
}
uri.path = path + (uri.path || ''); // site may reside at domain.com or domain.com/subdir
}
if (!uri.port) {
uri.port = ports[uri.scheme] || 80;
}
uri.port = parseInt(uri.port, 10);
if (!uri.path) {
uri.path = "/";
}
delete uri.source;
return uri;
};
/**
Resolve url - among other things will turn relative url to absolute
@method resolveUrl
@static
@param {String} url Either absolute or relative
@return {String} Resolved, absolute url
*/
var resolveUrl = function(url) {
var ports = { // we ignore default ports
http: 80,
https: 443
}
, urlp = parseUrl(url)
;
return urlp.scheme + '://' + urlp.host + (urlp.port !== ports[urlp.scheme] ? ':' + urlp.port : '') + urlp.path + (urlp.query ? urlp.query : '');
};
/**
Check if specified url has the same origin as the current document
@method hasSameOrigin
@param {String|Object} url
@return {Boolean}
*/
var hasSameOrigin = function(url) {
function origin(url) {
return [url.scheme, url.host, url.port].join('/');
}
if (typeof url === 'string') {
url = parseUrl(url);
}
return origin(parseUrl()) === origin(url);
};
return {
parseUrl: parseUrl,
resolveUrl: resolveUrl,
hasSameOrigin: hasSameOrigin
};
});
// Included from: src/javascript/file/FileReaderSync.js
/**
* FileReaderSync.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/file/FileReaderSync', [
'moxie/core/utils/Basic',
'moxie/runtime/RuntimeClient',
'moxie/core/utils/Encode'
], function(Basic, RuntimeClient, Encode) {
/**
Synchronous FileReader implementation. Something like this is available in WebWorkers environment, here
it can be used to read only preloaded blobs/files and only below certain size (not yet sure what that'd be,
but probably < 1mb). Not meant to be used directly by user.
@class FileReaderSync
@private
@constructor
*/
return function() {
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
readAsBinaryString: function(blob) {
return _read.call(this, 'readAsBinaryString', blob);
},
readAsDataURL: function(blob) {
return _read.call(this, 'readAsDataURL', blob);
},
/*readAsArrayBuffer: function(blob) {
return _read.call(this, 'readAsArrayBuffer', blob);
},*/
readAsText: function(blob) {
return _read.call(this, 'readAsText', blob);
}
});
function _read(op, blob) {
if (blob.isDetached()) {
var src = blob.getSource();
switch (op) {
case 'readAsBinaryString':
return src;
case 'readAsDataURL':
return 'data:' + blob.type + ';base64,' + Encode.btoa(src);
case 'readAsText':
var txt = '';
for (var i = 0, length = src.length; i < length; i++) {
txt += String.fromCharCode(src[i]);
}
return txt;
}
} else {
var result = this.connectRuntime(blob.ruid).exec.call(this, 'FileReaderSync', 'read', op, blob);
this.disconnectRuntime();
return result;
}
}
};
});
// Included from: src/javascript/xhr/FormData.js
/**
* FormData.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/FormData", [
"moxie/core/Exceptions",
"moxie/core/utils/Basic",
"moxie/file/Blob"
], function(x, Basic, Blob) {
/**
FormData
@class FormData
@constructor
*/
function FormData() {
var _blob, _fields = [];
Basic.extend(this, {
/**
Append another key-value pair to the FormData object
@method append
@param {String} name Name for the new field
@param {String|Blob|Array|Object} value Value for the field
*/
append: function(name, value) {
var self = this, valueType = Basic.typeOf(value);
// according to specs value might be either Blob or String
if (value instanceof Blob) {
_blob = {
name: name,
value: value // unfortunately we can only send single Blob in one FormData
};
} else if ('array' === valueType) {
name += '[]';
Basic.each(value, function(value) {
self.append(name, value);
});
} else if ('object' === valueType) {
Basic.each(value, function(value, key) {
self.append(name + '[' + key + ']', value);
});
} else if ('null' === valueType || 'undefined' === valueType || 'number' === valueType && isNaN(value)) {
self.append(name, "false");
} else {
_fields.push({
name: name,
value: value.toString()
});
}
},
/**
Checks if FormData contains Blob.
@method hasBlob
@return {Boolean}
*/
hasBlob: function() {
return !!this.getBlob();
},
/**
Retrieves blob.
@method getBlob
@return {Object} Either Blob if found or null
*/
getBlob: function() {
return _blob && _blob.value || null;
},
/**
Retrieves blob field name.
@method getBlobName
@return {String} Either Blob field name or null
*/
getBlobName: function() {
return _blob && _blob.name || null;
},
/**
Loop over the fields in FormData and invoke the callback for each of them.
@method each
@param {Function} cb Callback to call for each field
*/
each: function(cb) {
Basic.each(_fields, function(field) {
cb(field.value, field.name);
});
if (_blob) {
cb(_blob.value, _blob.name);
}
},
destroy: function() {
_blob = null;
_fields = [];
}
});
}
return FormData;
});
// Included from: src/javascript/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/xhr/XMLHttpRequest", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/core/EventTarget",
"moxie/core/utils/Encode",
"moxie/core/utils/Url",
"moxie/runtime/Runtime",
"moxie/runtime/RuntimeTarget",
"moxie/file/Blob",
"moxie/file/FileReaderSync",
"moxie/xhr/FormData",
"moxie/core/utils/Env",
"moxie/core/utils/Mime"
], function(Basic, x, EventTarget, Encode, Url, Runtime, RuntimeTarget, Blob, FileReaderSync, FormData, Env, Mime) {
var httpCode = {
100: 'Continue',
101: 'Switching Protocols',
102: 'Processing',
200: 'OK',
201: 'Created',
202: 'Accepted',
203: 'Non-Authoritative Information',
204: 'No Content',
205: 'Reset Content',
206: 'Partial Content',
207: 'Multi-Status',
226: 'IM Used',
300: 'Multiple Choices',
301: 'Moved Permanently',
302: 'Found',
303: 'See Other',
304: 'Not Modified',
305: 'Use Proxy',
306: 'Reserved',
307: 'Temporary Redirect',
400: 'Bad Request',
401: 'Unauthorized',
402: 'Payment Required',
403: 'Forbidden',
404: 'Not Found',
405: 'Method Not Allowed',
406: 'Not Acceptable',
407: 'Proxy Authentication Required',
408: 'Request Timeout',
409: 'Conflict',
410: 'Gone',
411: 'Length Required',
412: 'Precondition Failed',
413: 'Request Entity Too Large',
414: 'Request-URI Too Long',
415: 'Unsupported Media Type',
416: 'Requested Range Not Satisfiable',
417: 'Expectation Failed',
422: 'Unprocessable Entity',
423: 'Locked',
424: 'Failed Dependency',
426: 'Upgrade Required',
500: 'Internal Server Error',
501: 'Not Implemented',
502: 'Bad Gateway',
503: 'Service Unavailable',
504: 'Gateway Timeout',
505: 'HTTP Version Not Supported',
506: 'Variant Also Negotiates',
507: 'Insufficient Storage',
510: 'Not Extended'
};
function XMLHttpRequestUpload() {
this.uid = Basic.guid('uid_');
}
XMLHttpRequestUpload.prototype = EventTarget.instance;
/**
Implementation of XMLHttpRequest
@class XMLHttpRequest
@constructor
@uses RuntimeClient
@extends EventTarget
*/
var dispatches = ['loadstart', 'progress', 'abort', 'error', 'load', 'timeout', 'loadend']; // & readystatechange (for historical reasons)
var NATIVE = 1, RUNTIME = 2;
function XMLHttpRequest() {
var self = this,
// this (together with _p() @see below) is here to gracefully upgrade to setter/getter syntax where possible
props = {
/**
The amount of milliseconds a request can take before being terminated. Initially zero. Zero means there is no timeout.
@property timeout
@type Number
@default 0
*/
timeout: 0,
/**
Current state, can take following values:
UNSENT (numeric value 0)
The object has been constructed.
OPENED (numeric value 1)
The open() method has been successfully invoked. During this state request headers can be set using setRequestHeader() and the request can be made using the send() method.
HEADERS_RECEIVED (numeric value 2)
All redirects (if any) have been followed and all HTTP headers of the final response have been received. Several response members of the object are now available.
LOADING (numeric value 3)
The response entity body is being received.
DONE (numeric value 4)
@property readyState
@type Number
@default 0 (UNSENT)
*/
readyState: XMLHttpRequest.UNSENT,
/**
True when user credentials are to be included in a cross-origin request. False when they are to be excluded
in a cross-origin request and when cookies are to be ignored in its response. Initially false.
@property withCredentials
@type Boolean
@default false
*/
withCredentials: false,
/**
Returns the HTTP status code.
@property status
@type Number
@default 0
*/
status: 0,
/**
Returns the HTTP status text.
@property statusText
@type String
*/
statusText: "",
/**
Returns the response type. Can be set to change the response type. Values are:
the empty string (default), "arraybuffer", "blob", "document", "json", and "text".
@property responseType
@type String
*/
responseType: "",
/**
Returns the document response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "document".
@property responseXML
@type Document
*/
responseXML: null,
/**
Returns the text response entity body.
Throws an "InvalidStateError" exception if responseType is not the empty string or "text".
@property responseText
@type String
*/
responseText: null,
/**
Returns the response entity body (http://www.w3.org/TR/XMLHttpRequest/#response-entity-body).
Can become: ArrayBuffer, Blob, Document, JSON, Text
@property response
@type Mixed
*/
response: null
},
_async = true,
_url,
_method,
_headers = {},
_user,
_password,
_encoding = null,
_mimeType = null,
// flags
_sync_flag = false,
_send_flag = false,
_upload_events_flag = false,
_upload_complete_flag = false,
_error_flag = false,
_same_origin_flag = false,
// times
_start_time,
_timeoutset_time,
_finalMime = null,
_finalCharset = null,
_options = {},
_xhr,
_responseHeaders = '',
_responseHeadersBag
;
Basic.extend(this, props, {
/**
Unique id of the component
@property uid
@type String
*/
uid: Basic.guid('uid_'),
/**
Target for Upload events
@property upload
@type XMLHttpRequestUpload
*/
upload: new XMLHttpRequestUpload(),
/**
Sets the request method, request URL, synchronous flag, request username, and request password.
Throws a "SyntaxError" exception if one of the following is true:
method is not a valid HTTP method.
url cannot be resolved.
url contains the "user:password" format in the userinfo production.
Throws a "SecurityError" exception if method is a case-insensitive match for CONNECT, TRACE or TRACK.
Throws an "InvalidAccessError" exception if one of the following is true:
Either user or password is passed as argument and the origin of url does not match the XMLHttpRequest origin.
There is an associated XMLHttpRequest document and either the timeout attribute is not zero,
the withCredentials attribute is true, or the responseType attribute is not the empty string.
@method open
@param {String} method HTTP method to use on request
@param {String} url URL to request
@param {Boolean} [async=true] If false request will be done in synchronous manner. Asynchronous by default.
@param {String} [user] Username to use in HTTP authentication process on server-side
@param {String} [password] Password to use in HTTP authentication process on server-side
*/
open: function(method, url, async, user, password) {
var urlp;
// first two arguments are required
if (!method || !url) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 2 - check if any code point in method is higher than U+00FF or after deflating method it does not match the method
if (/[\u0100-\uffff]/.test(method) || Encode.utf8_encode(method) !== method) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3
if (!!~Basic.inArray(method.toUpperCase(), ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'TRACE', 'TRACK'])) {
_method = method.toUpperCase();
}
// 4 - allowing these methods poses a security risk
if (!!~Basic.inArray(_method, ['CONNECT', 'TRACE', 'TRACK'])) {
throw new x.DOMException(x.DOMException.SECURITY_ERR);
}
// 5
url = Encode.utf8_encode(url);
// 6 - Resolve url relative to the XMLHttpRequest base URL. If the algorithm returns an error, throw a "SyntaxError".
urlp = Url.parseUrl(url);
_same_origin_flag = Url.hasSameOrigin(urlp);
// 7 - manually build up absolute url
_url = Url.resolveUrl(url);
// 9-10, 12-13
if ((user || password) && !_same_origin_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
_user = user || urlp.user;
_password = password || urlp.pass;
// 11
_async = async || true;
if (_async === false && (_p('timeout') || _p('withCredentials') || _p('responseType') !== "")) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 14 - terminate abort()
// 15 - terminate send()
// 18
_sync_flag = !_async;
_send_flag = false;
_headers = {};
_reset.call(this);
// 19
_p('readyState', XMLHttpRequest.OPENED);
// 20
this.convertEventPropsToHandlers(['readystatechange']); // unify event handlers
this.dispatchEvent('readystatechange');
},
/**
Appends an header to the list of author request headers, or if header is already
in the list of author request headers, combines its value with value.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
Throws a "SyntaxError" exception if header is not a valid HTTP header field name or if value
is not a valid HTTP header field value.
@method setRequestHeader
@param {String} header
@param {String|Number} value
*/
setRequestHeader: function(header, value) {
var uaHeaders = [ // these headers are controlled by the user agent
"accept-charset",
"accept-encoding",
"access-control-request-headers",
"access-control-request-method",
"connection",
"content-length",
"cookie",
"cookie2",
"content-transfer-encoding",
"date",
"expect",
"host",
"keep-alive",
"origin",
"referer",
"te",
"trailer",
"transfer-encoding",
"upgrade",
"user-agent",
"via"
];
// 1-2
if (_p('readyState') !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
if (/[\u0100-\uffff]/.test(header) || Encode.utf8_encode(header) !== header) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 4
/* this step is seemingly bypassed in browsers, probably to allow various unicode characters in header values
if (/[\u0100-\uffff]/.test(value) || Encode.utf8_encode(value) !== value) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}*/
header = Basic.trim(header).toLowerCase();
// setting of proxy-* and sec-* headers is prohibited by spec
if (!!~Basic.inArray(header, uaHeaders) || /^(proxy\-|sec\-)/.test(header)) {
return false;
}
// camelize
// browsers lowercase header names (at least for custom ones)
// header = header.replace(/\b\w/g, function($1) { return $1.toUpperCase(); });
if (!_headers[header]) {
_headers[header] = value;
} else {
// http://tools.ietf.org/html/rfc2616#section-4.2 (last paragraph)
_headers[header] += ', ' + value;
}
return true;
},
/**
Returns all headers from the response, with the exception of those whose field name is Set-Cookie or Set-Cookie2.
@method getAllResponseHeaders
@return {String} reponse headers or empty string
*/
getAllResponseHeaders: function() {
return _responseHeaders || '';
},
/**
Returns the header field value from the response of which the field name matches header,
unless the field name is Set-Cookie or Set-Cookie2.
@method getResponseHeader
@param {String} header
@return {String} value(s) for the specified header or null
*/
getResponseHeader: function(header) {
header = header.toLowerCase();
if (_error_flag || !!~Basic.inArray(header, ['set-cookie', 'set-cookie2'])) {
return null;
}
if (_responseHeaders && _responseHeaders !== '') {
// if we didn't parse response headers until now, do it and keep for later
if (!_responseHeadersBag) {
_responseHeadersBag = {};
Basic.each(_responseHeaders.split(/\r\n/), function(line) {
var pair = line.split(/:\s+/);
if (pair.length === 2) { // last line might be empty, omit
pair[0] = Basic.trim(pair[0]); // just in case
_responseHeadersBag[pair[0].toLowerCase()] = { // simply to retain header name in original form
header: pair[0],
value: Basic.trim(pair[1])
};
}
});
}
if (_responseHeadersBag.hasOwnProperty(header)) {
return _responseHeadersBag[header].header + ': ' + _responseHeadersBag[header].value;
}
}
return null;
},
/**
Sets the Content-Type header for the response to mime.
Throws an "InvalidStateError" exception if the state is LOADING or DONE.
Throws a "SyntaxError" exception if mime is not a valid media type.
@method overrideMimeType
@param String mime Mime type to set
*/
overrideMimeType: function(mime) {
var matches, charset;
// 1
if (!!~Basic.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
mime = Basic.trim(mime.toLowerCase());
if (/;/.test(mime) && (matches = mime.match(/^([^;]+)(?:;\scharset\=)?(.*)$/))) {
mime = matches[1];
if (matches[2]) {
charset = matches[2];
}
}
if (!Mime.mimes[mime]) {
throw new x.DOMException(x.DOMException.SYNTAX_ERR);
}
// 3-4
_finalMime = mime;
_finalCharset = charset;
},
/**
Initiates the request. The optional argument provides the request entity body.
The argument is ignored if request method is GET or HEAD.
Throws an "InvalidStateError" exception if the state is not OPENED or if the send() flag is set.
@method send
@param {Blob|Document|String|FormData} [data] Request entity body
@param {Object} [options] Set of requirements and pre-requisities for runtime initialization
*/
send: function(data, options) {
if (Basic.typeOf(options) === 'string') {
_options = { ruid: options };
} else if (!options) {
_options = {};
} else {
_options = options;
}
this.convertEventPropsToHandlers(dispatches);
this.upload.convertEventPropsToHandlers(dispatches);
// 1-2
if (this.readyState !== XMLHttpRequest.OPENED || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3
// sending Blob
if (data instanceof Blob) {
_options.ruid = data.ruid;
_mimeType = data.type || 'application/octet-stream';
}
// FormData
else if (data instanceof FormData) {
if (data.hasBlob()) {
var blob = data.getBlob();
_options.ruid = blob.ruid;
_mimeType = blob.type || 'application/octet-stream';
}
}
// DOMString
else if (typeof data === 'string') {
_encoding = 'UTF-8';
_mimeType = 'text/plain;charset=UTF-8';
// data should be converted to Unicode and encoded as UTF-8
data = Encode.utf8_encode(data);
}
// if withCredentials not set, but requested, set it automatically
if (!this.withCredentials) {
this.withCredentials = (_options.required_caps && _options.required_caps.send_browser_cookies) && !_same_origin_flag;
}
// 4 - storage mutex
// 5
_upload_events_flag = (!_sync_flag && this.upload.hasEventListener()); // DSAP
// 6
_error_flag = false;
// 7
_upload_complete_flag = !data;
// 8 - Asynchronous steps
if (!_sync_flag) {
// 8.1
_send_flag = true;
// 8.2
// this.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
// 8.3
//if (!_upload_complete_flag) {
// this.upload.dispatchEvent('loadstart'); // will be dispatched either by native or runtime xhr
//}
}
// 8.5 - Return the send() method call, but continue running the steps in this algorithm.
_doXHR.call(this, data);
},
/**
Cancels any network activity.
@method abort
*/
abort: function() {
_error_flag = true;
_sync_flag = false;
if (!~Basic.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED, XMLHttpRequest.DONE])) {
_p('readyState', XMLHttpRequest.DONE);
_send_flag = false;
if (_xhr) {
_xhr.getRuntime().exec.call(_xhr, 'XMLHttpRequest', 'abort', _upload_complete_flag);
} else {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
_upload_complete_flag = true;
} else {
_p('readyState', XMLHttpRequest.UNSENT);
}
},
destroy: function() {
if (_xhr) {
if (Basic.typeOf(_xhr.destroy) === 'function') {
_xhr.destroy();
}
_xhr = null;
}
this.unbindAll();
if (this.upload) {
this.upload.unbindAll();
this.upload = null;
}
}
});
/* this is nice, but maybe too lengthy
// if supported by JS version, set getters/setters for specific properties
o.defineProperty(this, 'readyState', {
configurable: false,
get: function() {
return _p('readyState');
}
});
o.defineProperty(this, 'timeout', {
configurable: false,
get: function() {
return _p('timeout');
},
set: function(value) {
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// timeout still should be measured relative to the start time of request
_timeoutset_time = (new Date).getTime();
_p('timeout', value);
}
});
// the withCredentials attribute has no effect when fetching same-origin resources
o.defineProperty(this, 'withCredentials', {
configurable: false,
get: function() {
return _p('withCredentials');
},
set: function(value) {
// 1-2
if (!~o.inArray(_p('readyState'), [XMLHttpRequest.UNSENT, XMLHttpRequest.OPENED]) || _send_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 3-4
if (_anonymous_flag || _sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 5
_p('withCredentials', value);
}
});
o.defineProperty(this, 'status', {
configurable: false,
get: function() {
return _p('status');
}
});
o.defineProperty(this, 'statusText', {
configurable: false,
get: function() {
return _p('statusText');
}
});
o.defineProperty(this, 'responseType', {
configurable: false,
get: function() {
return _p('responseType');
},
set: function(value) {
// 1
if (!!~o.inArray(_p('readyState'), [XMLHttpRequest.LOADING, XMLHttpRequest.DONE])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2
if (_sync_flag) {
throw new x.DOMException(x.DOMException.INVALID_ACCESS_ERR);
}
// 3
_p('responseType', value.toLowerCase());
}
});
o.defineProperty(this, 'responseText', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'text'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseText');
}
});
o.defineProperty(this, 'responseXML', {
configurable: false,
get: function() {
// 1
if (!~o.inArray(_p('responseType'), ['', 'document'])) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// 2-3
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return _p('responseXML');
}
});
o.defineProperty(this, 'response', {
configurable: false,
get: function() {
if (!!~o.inArray(_p('responseType'), ['', 'text'])) {
if (_p('readyState') !== XMLHttpRequest.DONE && _p('readyState') !== XMLHttpRequest.LOADING || _error_flag) {
return '';
}
}
if (_p('readyState') !== XMLHttpRequest.DONE || _error_flag) {
return null;
}
return _p('response');
}
});
*/
function _p(prop, value) {
if (!props.hasOwnProperty(prop)) {
return;
}
if (arguments.length === 1) { // get
return Env.can('define_property') ? props[prop] : self[prop];
} else { // set
if (Env.can('define_property')) {
props[prop] = value;
} else {
self[prop] = value;
}
}
}
/*
function _toASCII(str, AllowUnassigned, UseSTD3ASCIIRules) {
// TODO: http://tools.ietf.org/html/rfc3490#section-4.1
return str.toLowerCase();
}
*/
function _doXHR(data) {
var self = this;
_start_time = new Date().getTime();
_xhr = new RuntimeTarget();
function loadEnd() {
if (_xhr) { // it could have been destroyed by now
_xhr.destroy();
_xhr = null;
}
self.dispatchEvent('loadend');
self = null;
}
function exec(runtime) {
_xhr.bind('LoadStart', function(e) {
_p('readyState', XMLHttpRequest.LOADING);
self.dispatchEvent('readystatechange');
self.dispatchEvent(e);
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
});
_xhr.bind('Progress', function(e) {
if (_p('readyState') !== XMLHttpRequest.LOADING) {
_p('readyState', XMLHttpRequest.LOADING); // LoadStart unreliable (in Flash for example)
self.dispatchEvent('readystatechange');
}
self.dispatchEvent(e);
});
_xhr.bind('UploadProgress', function(e) {
if (_upload_events_flag) {
self.upload.dispatchEvent({
type: 'progress',
lengthComputable: false,
total: e.total,
loaded: e.loaded
});
}
});
_xhr.bind('Load', function(e) {
_p('readyState', XMLHttpRequest.DONE);
_p('status', Number(runtime.exec.call(_xhr, 'XMLHttpRequest', 'getStatus') || 0));
_p('statusText', httpCode[_p('status')] || "");
_p('response', runtime.exec.call(_xhr, 'XMLHttpRequest', 'getResponse', _p('responseType')));
if (!!~Basic.inArray(_p('responseType'), ['text', ''])) {
_p('responseText', _p('response'));
} else if (_p('responseType') === 'document') {
_p('responseXML', _p('response'));
}
_responseHeaders = runtime.exec.call(_xhr, 'XMLHttpRequest', 'getAllResponseHeaders');
self.dispatchEvent('readystatechange');
if (_p('status') > 0) { // status 0 usually means that server is unreachable
if (_upload_events_flag) {
self.upload.dispatchEvent(e);
}
self.dispatchEvent(e);
} else {
_error_flag = true;
self.dispatchEvent('error');
}
loadEnd();
});
_xhr.bind('Abort', function(e) {
self.dispatchEvent(e);
loadEnd();
});
_xhr.bind('Error', function(e) {
_error_flag = true;
_p('readyState', XMLHttpRequest.DONE);
self.dispatchEvent('readystatechange');
_upload_complete_flag = true;
self.dispatchEvent(e);
loadEnd();
});
runtime.exec.call(_xhr, 'XMLHttpRequest', 'send', {
url: _url,
method: _method,
async: _async,
user: _user,
password: _password,
headers: _headers,
mimeType: _mimeType,
encoding: _encoding,
responseType: self.responseType,
withCredentials: self.withCredentials,
options: _options
}, data);
}
// clarify our requirements
if (typeof(_options.required_caps) === 'string') {
_options.required_caps = Runtime.parseCaps(_options.required_caps);
}
_options.required_caps = Basic.extend({}, _options.required_caps, {
return_response_type: self.responseType
});
if (data instanceof FormData) {
_options.required_caps.send_multipart = true;
}
if (!_same_origin_flag) {
_options.required_caps.do_cors = true;
}
if (_options.ruid) { // we do not need to wait if we can connect directly
exec(_xhr.connectRuntime(_options));
} else {
_xhr.bind('RuntimeInit', function(e, runtime) {
exec(runtime);
});
_xhr.bind('RuntimeError', function(e, err) {
self.dispatchEvent('RuntimeError', err);
});
_xhr.connectRuntime(_options);
}
}
function _reset() {
_p('responseText', "");
_p('responseXML', null);
_p('response', null);
_p('status', 0);
_p('statusText', "");
_start_time = _timeoutset_time = null;
}
}
XMLHttpRequest.UNSENT = 0;
XMLHttpRequest.OPENED = 1;
XMLHttpRequest.HEADERS_RECEIVED = 2;
XMLHttpRequest.LOADING = 3;
XMLHttpRequest.DONE = 4;
XMLHttpRequest.prototype = EventTarget.instance;
return XMLHttpRequest;
});
// Included from: src/javascript/runtime/Transporter.js
/**
* Transporter.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/runtime/Transporter", [
"moxie/core/utils/Basic",
"moxie/core/utils/Encode",
"moxie/runtime/RuntimeClient",
"moxie/core/EventTarget"
], function(Basic, Encode, RuntimeClient, EventTarget) {
function Transporter() {
var mod, _runtime, _data, _size, _pos, _chunk_size;
RuntimeClient.call(this);
Basic.extend(this, {
uid: Basic.guid('uid_'),
state: Transporter.IDLE,
result: null,
transport: function(data, type, options) {
var self = this;
options = Basic.extend({
chunk_size: 204798
}, options);
// should divide by three, base64 requires this
if ((mod = options.chunk_size % 3)) {
options.chunk_size += 3 - mod;
}
_chunk_size = options.chunk_size;
_reset.call(this);
_data = data;
_size = data.length;
if (Basic.typeOf(options) === 'string' || options.ruid) {
_run.call(self, type, this.connectRuntime(options));
} else {
// we require this to run only once
var cb = function(e, runtime) {
self.unbind("RuntimeInit", cb);
_run.call(self, type, runtime);
};
this.bind("RuntimeInit", cb);
this.connectRuntime(options);
}
},
abort: function() {
var self = this;
self.state = Transporter.IDLE;
if (_runtime) {
_runtime.exec.call(self, 'Transporter', 'clear');
self.trigger("TransportingAborted");
}
_reset.call(self);
},
destroy: function() {
this.unbindAll();
_runtime = null;
this.disconnectRuntime();
_reset.call(this);
}
});
function _reset() {
_size = _pos = 0;
_data = this.result = null;
}
function _run(type, runtime) {
var self = this;
_runtime = runtime;
//self.unbind("RuntimeInit");
self.bind("TransportingProgress", function(e) {
_pos = e.loaded;
if (_pos < _size && Basic.inArray(self.state, [Transporter.IDLE, Transporter.DONE]) === -1) {
_transport.call(self);
}
}, 999);
self.bind("TransportingComplete", function() {
_pos = _size;
self.state = Transporter.DONE;
_data = null; // clean a bit
self.result = _runtime.exec.call(self, 'Transporter', 'getAsBlob', type || '');
}, 999);
self.state = Transporter.BUSY;
self.trigger("TransportingStarted");
_transport.call(self);
}
function _transport() {
var self = this,
chunk,
bytesLeft = _size - _pos;
if (_chunk_size > bytesLeft) {
_chunk_size = bytesLeft;
}
chunk = Encode.btoa(_data.substr(_pos, _chunk_size));
_runtime.exec.call(self, 'Transporter', 'receive', chunk, _size);
}
}
Transporter.IDLE = 0;
Transporter.BUSY = 1;
Transporter.DONE = 2;
Transporter.prototype = EventTarget.instance;
return Transporter;
});
// Included from: src/javascript/image/Image.js
/**
* Image.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define("moxie/image/Image", [
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/Exceptions",
"moxie/file/FileReaderSync",
"moxie/xhr/XMLHttpRequest",
"moxie/runtime/Runtime",
"moxie/runtime/RuntimeClient",
"moxie/runtime/Transporter",
"moxie/core/utils/Env",
"moxie/core/EventTarget",
"moxie/file/Blob",
"moxie/file/File",
"moxie/core/utils/Encode"
], function(Basic, Dom, x, FileReaderSync, XMLHttpRequest, Runtime, RuntimeClient, Transporter, Env, EventTarget, Blob, File, Encode) {
/**
Image preloading and manipulation utility. Additionally it provides access to image meta info (Exif, GPS) and raw binary data.
@class Image
@constructor
@extends EventTarget
*/
var dispatches = [
'progress',
/**
Dispatched when loading is complete.
@event load
@param {Object} event
*/
'load',
'error',
/**
Dispatched when resize operation is complete.
@event resize
@param {Object} event
*/
'resize',
/**
Dispatched when visual representation of the image is successfully embedded
into the corresponsing container.
@event embedded
@param {Object} event
*/
'embedded'
];
function Image() {
RuntimeClient.call(this);
Basic.extend(this, {
/**
Unique id of the component
@property uid
@type {String}
*/
uid: Basic.guid('uid_'),
/**
Unique id of the connected runtime, if any.
@property ruid
@type {String}
*/
ruid: null,
/**
Name of the file, that was used to create an image, if available. If not equals to empty string.
@property name
@type {String}
@default ""
*/
name: "",
/**
Size of the image in bytes. Actual value is set only after image is preloaded.
@property size
@type {Number}
@default 0
*/
size: 0,
/**
Width of the image. Actual value is set only after image is preloaded.
@property width
@type {Number}
@default 0
*/
width: 0,
/**
Height of the image. Actual value is set only after image is preloaded.
@property height
@type {Number}
@default 0
*/
height: 0,
/**
Mime type of the image. Currently only image/jpeg and image/png are supported. Actual value is set only after image is preloaded.
@property type
@type {String}
@default ""
*/
type: "",
/**
Holds meta info (Exif, GPS). Is populated only for image/jpeg. Actual value is set only after image is preloaded.
@property meta
@type {Object}
@default {}
*/
meta: {},
/**
Alias for load method, that takes another mOxie.Image object as a source (see load).
@method clone
@param {Image} src Source for the image
@param {Boolean} [exact=false] Whether to activate in-depth clone mode
*/
clone: function() {
this.load.apply(this, arguments);
},
/**
Loads image from various sources. Currently the source for new image can be: mOxie.Image, mOxie.Blob/mOxie.File,
native Blob/File, dataUrl or URL. Depending on the type of the source, arguments - differ. When source is URL,
Image will be downloaded from remote destination and loaded in memory.
@example
var img = new mOxie.Image();
img.onload = function() {
var blob = img.getAsBlob();
var formData = new mOxie.FormData();
formData.append('file', blob);
var xhr = new mOxie.XMLHttpRequest();
xhr.onload = function() {
// upload complete
};
xhr.open('post', 'upload.php');
xhr.send(formData);
};
img.load("http://www.moxiecode.com/images/mox-logo.jpg"); // notice file extension (.jpg)
@method load
@param {Image|Blob|File|String} src Source for the image
@param {Boolean|Object} [mixed]
*/
load: function() {
// this is here because to bind properly we need an uid first, which is created above
this.bind('Load Resize', function() {
_updateInfo.call(this);
}, 999);
this.convertEventPropsToHandlers(dispatches);
_load.apply(this, arguments);
},
/**
Downsizes the image to fit the specified width/height. If crop is supplied, image will be cropped to exact dimensions.
@method downsize
@param {Number} width Resulting width
@param {Number} [height=width] Resulting height (optional, if not supplied will default to width)
@param {Boolean} [crop=false] Whether to crop the image to exact dimensions
@param {Boolean} [preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize)
*/
downsize: function(opts) {
var defaults = {
width: this.width,
height: this.height,
crop: false,
preserveHeaders: true
};
if (typeof(opts) === 'object') {
opts = Basic.extend(defaults, opts);
} else {
opts = Basic.extend(defaults, {
width: arguments[0],
height: arguments[1],
crop: arguments[2],
preserveHeaders: arguments[3]
});
}
try {
if (!this.size) { // only preloaded image objects can be used as source
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
// no way to reliably intercept the crash due to high resolution, so we simply avoid it
if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) {
throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
}
this.getRuntime().exec.call(this, 'Image', 'downsize', opts.width, opts.height, opts.crop, opts.preserveHeaders);
} catch(ex) {
// for now simply trigger error event
this.trigger('error', ex.code);
}
},
/**
Alias for downsize(width, height, true). (see downsize)
@method crop
@param {Number} width Resulting width
@param {Number} [height=width] Resulting height (optional, if not supplied will default to width)
@param {Boolean} [preserveHeaders=true] Whether to preserve meta headers (on JPEGs after resize)
*/
crop: function(width, height, preserveHeaders) {
this.downsize(width, height, true, preserveHeaders);
},
getAsCanvas: function() {
if (!Env.can('create_canvas')) {
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
}
var runtime = this.connectRuntime(this.ruid);
return runtime.exec.call(this, 'Image', 'getAsCanvas');
},
/**
Retrieves image in it's current state as mOxie.Blob object. Cannot be run on empty or image in progress (throws
DOMException.INVALID_STATE_ERR).
@method getAsBlob
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
@return {Blob} Image as Blob
*/
getAsBlob: function(type, quality) {
if (!this.size) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
if (!type) {
type = 'image/jpeg';
}
if (type === 'image/jpeg' && !quality) {
quality = 90;
}
return this.getRuntime().exec.call(this, 'Image', 'getAsBlob', type, quality);
},
/**
Retrieves image in it's current state as dataURL string. Cannot be run on empty or image in progress (throws
DOMException.INVALID_STATE_ERR).
@method getAsDataURL
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
@return {String} Image as dataURL string
*/
getAsDataURL: function(type, quality) {
if (!this.size) {
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
return this.getRuntime().exec.call(this, 'Image', 'getAsDataURL', type, quality);
},
/**
Retrieves image in it's current state as binary string. Cannot be run on empty or image in progress (throws
DOMException.INVALID_STATE_ERR).
@method getAsBinaryString
@param {String} [type="image/jpeg"] Mime type of resulting blob. Can either be image/jpeg or image/png
@param {Number} [quality=90] Applicable only together with mime type image/jpeg
@return {String} Image as binary string
*/
getAsBinaryString: function(type, quality) {
var dataUrl = this.getAsDataURL(type, quality);
return Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7));
},
/**
Embeds a visual representation of the image into the specified node. Depending on the runtime,
it might be a canvas, an img node or a thrid party shim object (Flash or SilverLight - very rare,
can be used in legacy browsers that do not have canvas or proper dataURI support).
@method embed
@param {DOMElement} el DOM element to insert the image object into
@param {Object} [options]
@param {Number} [options.width] The width of an embed (defaults to the image width)
@param {Number} [options.height] The height of an embed (defaults to the image height)
@param {String} [type="image/jpeg"] Mime type
@param {Number} [quality=90] Quality of an embed, if mime type is image/jpeg
@param {Boolean} [crop=false] Whether to crop an embed to the specified dimensions
*/
embed: function(el) {
var self = this
, imgCopy
, type, quality, crop
, options = arguments[1] || {}
, width = this.width
, height = this.height
, runtime // this has to be outside of all the closures to contain proper runtime
;
function onResize() {
// if possible, embed a canvas element directly
if (Env.can('create_canvas')) {
var canvas = imgCopy.getAsCanvas();
if (canvas) {
el.appendChild(canvas);
canvas = null;
imgCopy.destroy();
self.trigger('embedded');
return;
}
}
var dataUrl = imgCopy.getAsDataURL(type, quality);
if (!dataUrl) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
if (Env.can('use_data_uri_of', dataUrl.length)) {
el.innerHTML = '<img src="' + dataUrl + '" width="' + imgCopy.width + '" height="' + imgCopy.height + '" />';
imgCopy.destroy();
self.trigger('embedded');
} else {
var tr = new Transporter();
tr.bind("TransportingComplete", function() {
runtime = self.connectRuntime(this.result.ruid);
self.bind("Embedded", function() {
// position and size properly
Basic.extend(runtime.getShimContainer().style, {
//position: 'relative',
top: '0px',
left: '0px',
width: imgCopy.width + 'px',
height: imgCopy.height + 'px'
});
// some shims (Flash/SilverLight) reinitialize, if parent element is hidden, reordered or it's
// position type changes (in Gecko), but since we basically need this only in IEs 6/7 and
// sometimes 8 and they do not have this problem, we can comment this for now
/*tr.bind("RuntimeInit", function(e, runtime) {
tr.destroy();
runtime.destroy();
onResize.call(self); // re-feed our image data
});*/
runtime = null;
}, 999);
runtime.exec.call(self, "ImageView", "display", this.result.uid, width, height);
imgCopy.destroy();
});
tr.transport(Encode.atob(dataUrl.substring(dataUrl.indexOf('base64,') + 7)), type, Basic.extend({}, options, {
required_caps: {
display_media: true
},
runtime_order: 'flash,silverlight',
container: el
}));
}
}
try {
if (!(el = Dom.get(el))) {
throw new x.DOMException(x.DOMException.INVALID_NODE_TYPE_ERR);
}
if (!this.size) { // only preloaded image objects can be used as source
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
if (this.width > Image.MAX_RESIZE_WIDTH || this.height > Image.MAX_RESIZE_HEIGHT) {
throw new x.ImageError(x.ImageError.MAX_RESOLUTION_ERR);
}
type = options.type || this.type || 'image/jpeg';
quality = options.quality || 90;
crop = Basic.typeOf(options.crop) !== 'undefined' ? options.crop : false;
// figure out dimensions for the thumb
if (options.width) {
width = options.width;
height = options.height || width;
} else {
// if container element has measurable dimensions, use them
var dimensions = Dom.getSize(el);
if (dimensions.w && dimensions.h) { // both should be > 0
width = dimensions.w;
height = dimensions.h;
}
}
imgCopy = new Image();
imgCopy.bind("Resize", function() {
onResize.call(self);
});
imgCopy.bind("Load", function() {
imgCopy.downsize(width, height, crop, false);
});
imgCopy.clone(this, false);
return imgCopy;
} catch(ex) {
// for now simply trigger error event
this.trigger('error', ex.code);
}
},
/**
Properly destroys the image and frees resources in use. If any. Recommended way to dispose mOxie.Image object.
@method destroy
*/
destroy: function() {
if (this.ruid) {
this.getRuntime().exec.call(this, 'Image', 'destroy');
this.disconnectRuntime();
}
this.unbindAll();
}
});
function _updateInfo(info) {
if (!info) {
info = this.getRuntime().exec.call(this, 'Image', 'getInfo');
}
this.size = info.size;
this.width = info.width;
this.height = info.height;
this.type = info.type;
this.meta = info.meta;
// update file name, only if empty
if (this.name === '') {
this.name = info.name;
}
}
function _load(src) {
var srcType = Basic.typeOf(src);
try {
// if source is Image
if (src instanceof Image) {
if (!src.size) { // only preloaded image objects can be used as source
throw new x.DOMException(x.DOMException.INVALID_STATE_ERR);
}
_loadFromImage.apply(this, arguments);
}
// if source is o.Blob/o.File
else if (src instanceof Blob) {
if (!~Basic.inArray(src.type, ['image/jpeg', 'image/png'])) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
_loadFromBlob.apply(this, arguments);
}
// if native blob/file
else if (Basic.inArray(srcType, ['blob', 'file']) !== -1) {
_load.call(this, new File(null, src), arguments[1]);
}
// if String
else if (srcType === 'string') {
// if dataUrl String
if (/^data:[^;]*;base64,/.test(src)) {
_load.call(this, new Blob(null, { data: src }), arguments[1]);
}
// else assume Url, either relative or absolute
else {
_loadFromUrl.apply(this, arguments);
}
}
// if source seems to be an img node
else if (srcType === 'node' && src.nodeName.toLowerCase() === 'img') {
_load.call(this, src.src, arguments[1]);
}
else {
throw new x.DOMException(x.DOMException.TYPE_MISMATCH_ERR);
}
} catch(ex) {
// for now simply trigger error event
this.trigger('error', ex.code);
}
}
function _loadFromImage(img, exact) {
var runtime = this.connectRuntime(img.ruid);
this.ruid = runtime.uid;
runtime.exec.call(this, 'Image', 'loadFromImage', img, (Basic.typeOf(exact) === 'undefined' ? true : exact));
}
function _loadFromBlob(blob, options) {
var self = this;
self.name = blob.name || '';
function exec(runtime) {
self.ruid = runtime.uid;
runtime.exec.call(self, 'Image', 'loadFromBlob', blob);
}
if (blob.isDetached()) {
this.bind('RuntimeInit', function(e, runtime) {
exec(runtime);
});
// convert to object representation
if (options && typeof(options.required_caps) === 'string') {
options.required_caps = Runtime.parseCaps(options.required_caps);
}
this.connectRuntime(Basic.extend({
required_caps: {
access_image_binary: true,
resize_image: true
}
}, options));
} else {
exec(this.connectRuntime(blob.ruid));
}
}
function _loadFromUrl(url, options) {
var self = this, xhr;
xhr = new XMLHttpRequest();
xhr.open('get', url);
xhr.responseType = 'blob';
xhr.onprogress = function(e) {
self.trigger(e);
};
xhr.onload = function() {
_loadFromBlob.call(self, xhr.response, true);
};
xhr.onerror = function(e) {
self.trigger(e);
};
xhr.onloadend = function() {
xhr.destroy();
};
xhr.bind('RuntimeError', function(e, err) {
self.trigger('RuntimeError', err);
});
xhr.send(null, options);
}
}
// virtual world will crash on you if image has a resolution higher than this:
Image.MAX_RESIZE_WIDTH = 6500;
Image.MAX_RESIZE_HEIGHT = 6500;
Image.prototype = EventTarget.instance;
return Image;
});
// Included from: src/javascript/runtime/html4/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML4 runtime.
@class moxie/runtime/html4/Runtime
@private
*/
define("moxie/runtime/html4/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = 'html4', extensions = {};
function Html4Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
Runtime.call(this, options, type, {
access_binary: Test(window.FileReader || window.File && File.getAsDataURL),
access_image_binary: false,
display_media: Test(extensions.Image && (Env.can('create_canvas') || Env.can('use_data_uri_over32kb'))),
do_cors: false,
drag_and_drop: false,
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
resize_image: function() {
return extensions.Image && I.can('access_binary') && Env.can('create_canvas');
},
report_upload_progress: false,
return_response_headers: false,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) {
return true;
}
return !!~Basic.inArray(responseType, ['text', 'document', '']);
},
return_status_code: function(code) {
return !Basic.arrayDiff(code, [200, 404]);
},
select_file: function() {
return Env.can('use_fileinput');
},
select_multiple: false,
send_binary_string: false,
send_custom_headers: false,
send_multipart: true,
slice_blob: false,
stream_upload: function() {
return I.can('select_file');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True,
use_http_method: function(methods) {
return !Basic.arrayDiff(methods, ['GET', 'POST']);
}
});
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html4Runtime);
return extensions;
});
// Included from: src/javascript/core/utils/Events.js
/**
* Events.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
define('moxie/core/utils/Events', [
'moxie/core/utils/Basic'
], function(Basic) {
var eventhash = {}, uid = 'moxie_' + Basic.guid();
// IE W3C like event funcs
function preventDefault() {
this.returnValue = false;
}
function stopPropagation() {
this.cancelBubble = true;
}
/**
Adds an event handler to the specified object and store reference to the handler
in objects internal Plupload registry (@see removeEvent).
@method addEvent
@for Utils
@static
@param {Object} obj DOM element like object to add handler to.
@param {String} name Name to add event listener to.
@param {Function} callback Function to call when event occurs.
@param {String} [key] that might be used to add specifity to the event record.
*/
var addEvent = function(obj, name, callback, key) {
var func, events;
name = name.toLowerCase();
// Add event listener
if (obj.addEventListener) {
func = callback;
obj.addEventListener(name, func, false);
} else if (obj.attachEvent) {
func = function() {
var evt = window.event;
if (!evt.target) {
evt.target = evt.srcElement;
}
evt.preventDefault = preventDefault;
evt.stopPropagation = stopPropagation;
callback(evt);
};
obj.attachEvent('on' + name, func);
}
// Log event handler to objects internal mOxie registry
if (!obj[uid]) {
obj[uid] = Basic.guid();
}
if (!eventhash.hasOwnProperty(obj[uid])) {
eventhash[obj[uid]] = {};
}
events = eventhash[obj[uid]];
if (!events.hasOwnProperty(name)) {
events[name] = [];
}
events[name].push({
func: func,
orig: callback, // store original callback for IE
key: key
});
};
/**
Remove event handler from the specified object. If third argument (callback)
is not specified remove all events with the specified name.
@method removeEvent
@static
@param {Object} obj DOM element to remove event listener(s) from.
@param {String} name Name of event listener to remove.
@param {Function|String} [callback] might be a callback or unique key to match.
*/
var removeEvent = function(obj, name, callback) {
var type, undef;
name = name.toLowerCase();
if (obj[uid] && eventhash[obj[uid]] && eventhash[obj[uid]][name]) {
type = eventhash[obj[uid]][name];
} else {
return;
}
for (var i = type.length - 1; i >= 0; i--) {
// undefined or not, key should match
if (type[i].orig === callback || type[i].key === callback) {
if (obj.removeEventListener) {
obj.removeEventListener(name, type[i].func, false);
} else if (obj.detachEvent) {
obj.detachEvent('on'+name, type[i].func);
}
type[i].orig = null;
type[i].func = null;
type.splice(i, 1);
// If callback was passed we are done here, otherwise proceed
if (callback !== undef) {
break;
}
}
}
// If event array got empty, remove it
if (!type.length) {
delete eventhash[obj[uid]][name];
}
// If mOxie registry has become empty, remove it
if (Basic.isEmptyObj(eventhash[obj[uid]])) {
delete eventhash[obj[uid]];
// IE doesn't let you remove DOM object property with - delete
try {
delete obj[uid];
} catch(e) {
obj[uid] = undef;
}
}
};
/**
Remove all kind of events from the specified object
@method removeAllEvents
@static
@param {Object} obj DOM element to remove event listeners from.
@param {String} [key] unique key to match, when removing events.
*/
var removeAllEvents = function(obj, key) {
if (!obj || !obj[uid]) {
return;
}
Basic.each(eventhash[obj[uid]], function(events, name) {
removeEvent(obj, name, key);
});
};
return {
addEvent: addEvent,
removeEvent: removeEvent,
removeAllEvents: removeAllEvents
};
});
// Included from: src/javascript/runtime/html4/file/FileInput.js
/**
* FileInput.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileInput
@private
*/
define("moxie/runtime/html4/file/FileInput", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Events",
"moxie/core/utils/Mime",
"moxie/core/utils/Env"
], function(extensions, Basic, Dom, Events, Mime, Env) {
function FileInput() {
var _uid, _files = [], _mimes = [], _options;
function addInput() {
var comp = this, I = comp.getRuntime(), shimContainer, browseButton, currForm, form, input, uid;
uid = Basic.guid('uid_');
shimContainer = I.getShimContainer(); // we get new ref everytime to avoid memory leaks in IE
if (_uid) { // move previous form out of the view
currForm = Dom.get(_uid + '_form');
if (currForm) {
Basic.extend(currForm.style, { top: '100%' });
}
}
// build form in DOM, since innerHTML version not able to submit file for some reason
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', 'post');
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
Basic.extend(form.style, {
overflow: 'hidden',
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
input = document.createElement('input');
input.setAttribute('id', uid);
input.setAttribute('type', 'file');
input.setAttribute('name', _options.name || 'Filedata');
input.setAttribute('accept', _mimes.join(','));
Basic.extend(input.style, {
fontSize: '999px',
opacity: 0
});
form.appendChild(input);
shimContainer.appendChild(form);
// prepare file input to be placed underneath the browse_button element
Basic.extend(input.style, {
position: 'absolute',
top: 0,
left: 0,
width: '100%',
height: '100%'
});
if (Env.browser === 'IE' && Env.version < 10) {
Basic.extend(input.style, {
filter : "progid:DXImageTransform.Microsoft.Alpha(opacity=0)"
});
}
input.onchange = function() { // there should be only one handler for this
var file;
if (!this.value) {
return;
}
if (this.files) {
file = this.files[0];
} else {
file = {
name: this.value
};
}
_files = [file];
this.onchange = function() {}; // clear event handler
addInput.call(comp);
// after file is initialized as o.File, we need to update form and input ids
comp.bind('change', function onChange() {
var input = Dom.get(uid), form = Dom.get(uid + '_form'), file;
comp.unbind('change', onChange);
if (comp.files.length && input && form) {
file = comp.files[0];
input.setAttribute('id', file.uid);
form.setAttribute('id', file.uid + '_form');
// set upload target
form.setAttribute('target', file.uid + '_iframe');
}
input = form = null;
}, 998);
input = form = null;
comp.trigger('change');
};
// route click event to the input
if (I.can('summon_file_dialog')) {
browseButton = Dom.get(_options.browse_button);
Events.removeEvent(browseButton, 'click', comp.uid);
Events.addEvent(browseButton, 'click', function(e) {
if (input && !input.disabled) { // for some reason FF (up to 8.0.1 so far) lets to click disabled input[type=file]
input.click();
}
e.preventDefault();
}, comp.uid);
}
_uid = uid;
shimContainer = currForm = browseButton = null;
}
Basic.extend(this, {
init: function(options) {
var comp = this, I = comp.getRuntime(), shimContainer;
// figure out accept string
_options = options;
_mimes = options.accept.mimes || Mime.extList2mimes(options.accept, I.can('filter_by_extension'));
shimContainer = I.getShimContainer();
(function() {
var browseButton, zIndex, top;
browseButton = Dom.get(options.browse_button);
// Route click event to the input[type=file] element for browsers that support such behavior
if (I.can('summon_file_dialog')) {
if (Dom.getStyle(browseButton, 'position') === 'static') {
browseButton.style.position = 'relative';
}
zIndex = parseInt(Dom.getStyle(browseButton, 'z-index'), 10) || 1;
browseButton.style.zIndex = zIndex;
shimContainer.style.zIndex = zIndex - 1;
}
/* Since we have to place input[type=file] on top of the browse_button for some browsers,
browse_button loses interactivity, so we restore it here */
top = I.can('summon_file_dialog') ? browseButton : shimContainer;
Events.addEvent(top, 'mouseover', function() {
comp.trigger('mouseenter');
}, comp.uid);
Events.addEvent(top, 'mouseout', function() {
comp.trigger('mouseleave');
}, comp.uid);
Events.addEvent(top, 'mousedown', function() {
comp.trigger('mousedown');
}, comp.uid);
Events.addEvent(Dom.get(options.container), 'mouseup', function() {
comp.trigger('mouseup');
}, comp.uid);
browseButton = null;
}());
addInput.call(this);
shimContainer = null;
// trigger ready event asynchronously
comp.trigger({
type: 'ready',
async: true
});
},
getFiles: function() {
return _files;
},
disable: function(state) {
var input;
if ((input = Dom.get(_uid))) {
input.disabled = !!state;
}
},
destroy: function() {
var I = this.getRuntime()
, shim = I.getShim()
, shimContainer = I.getShimContainer()
;
Events.removeAllEvents(shimContainer, this.uid);
Events.removeAllEvents(_options && Dom.get(_options.container), this.uid);
Events.removeAllEvents(_options && Dom.get(_options.browse_button), this.uid);
if (shimContainer) {
shimContainer.innerHTML = '';
}
shim.removeInstance(this.uid);
_uid = _files = _mimes = _options = shimContainer = shim = null;
}
});
}
return (extensions.FileInput = FileInput);
});
// Included from: src/javascript/runtime/html5/Runtime.js
/**
* Runtime.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global File:true */
/**
Defines constructor for HTML5 runtime.
@class moxie/runtime/html5/Runtime
@private
*/
define("moxie/runtime/html5/Runtime", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/Runtime",
"moxie/core/utils/Env"
], function(Basic, x, Runtime, Env) {
var type = "html5", extensions = {};
function Html5Runtime(options) {
var I = this
, Test = Runtime.capTest
, True = Runtime.capTrue
;
var caps = Basic.extend({
access_binary: Test(window.FileReader || window.File && window.File.getAsDataURL),
access_image_binary: function() {
return I.can('access_binary') && !!extensions.Image;
},
display_media: Test(Env.can('create_canvas') || Env.can('use_data_uri_over32kb')),
do_cors: Test(window.XMLHttpRequest && 'withCredentials' in new XMLHttpRequest()),
drag_and_drop: Test(function() {
// this comes directly from Modernizr: http://www.modernizr.com/
var div = document.createElement('div');
// IE has support for drag and drop since version 5, but doesn't support dropping files from desktop
return (('draggable' in div) || ('ondragstart' in div && 'ondrop' in div)) && (Env.browser !== 'IE' || Env.version > 9);
}()),
filter_by_extension: Test(function() { // if you know how to feature-detect this, please suggest
return (Env.browser === 'Chrome' && Env.version >= 28) || (Env.browser === 'IE' && Env.version >= 10);
}()),
return_response_headers: True,
return_response_type: function(responseType) {
if (responseType === 'json' && !!window.JSON) { // we can fake this one even if it's not supported
return true;
}
return Env.can('return_response_type', responseType);
},
return_status_code: True,
report_upload_progress: Test(window.XMLHttpRequest && new XMLHttpRequest().upload),
resize_image: function() {
return I.can('access_binary') && Env.can('create_canvas');
},
select_file: function() {
return Env.can('use_fileinput') && window.File;
},
select_folder: function() {
return I.can('select_file') && Env.browser === 'Chrome' && Env.version >= 21;
},
select_multiple: function() {
// it is buggy on Safari Windows and iOS
return I.can('select_file') &&
!(Env.browser === 'Safari' && Env.os === 'Windows') &&
!(Env.os === 'iOS' && Env.verComp(Env.osVersion, "7.0.4", '<'));
},
send_binary_string: Test(window.XMLHttpRequest && (new XMLHttpRequest().sendAsBinary || (window.Uint8Array && window.ArrayBuffer))),
send_custom_headers: Test(window.XMLHttpRequest),
send_multipart: function() {
return !!(window.XMLHttpRequest && new XMLHttpRequest().upload && window.FormData) || I.can('send_binary_string');
},
slice_blob: Test(window.File && (File.prototype.mozSlice || File.prototype.webkitSlice || File.prototype.slice)),
stream_upload: function(){
return I.can('slice_blob') && I.can('send_multipart');
},
summon_file_dialog: Test(function() { // yeah... some dirty sniffing here...
return (Env.browser === 'Firefox' && Env.version >= 4) ||
(Env.browser === 'Opera' && Env.version >= 12) ||
(Env.browser === 'IE' && Env.version >= 10) ||
!!~Basic.inArray(Env.browser, ['Chrome', 'Safari']);
}()),
upload_filesize: True
},
arguments[2]
);
Runtime.call(this, options, (arguments[1] || type), caps);
Basic.extend(this, {
init : function() {
this.trigger("Init");
},
destroy: (function(destroy) { // extend default destroy method
return function() {
destroy.call(I);
destroy = I = null;
};
}(this.destroy))
});
Basic.extend(this.getShim(), extensions);
}
Runtime.addConstructor(type, Html5Runtime);
return extensions;
});
// Included from: src/javascript/runtime/html5/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/file/FileReader
@private
*/
define("moxie/runtime/html5/file/FileReader", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Encode",
"moxie/core/utils/Basic"
], function(extensions, Encode, Basic) {
function FileReader() {
var _fr, _convertToBinary = false;
Basic.extend(this, {
read: function(op, blob) {
var target = this;
_fr = new window.FileReader();
_fr.addEventListener('progress', function(e) {
target.trigger(e);
});
_fr.addEventListener('load', function(e) {
target.trigger(e);
});
_fr.addEventListener('error', function(e) {
target.trigger(e, _fr.error);
});
_fr.addEventListener('loadend', function() {
_fr = null;
});
if (Basic.typeOf(_fr[op]) === 'function') {
_convertToBinary = false;
_fr[op](blob.getSource());
} else if (op === 'readAsBinaryString') { // readAsBinaryString is depricated in general and never existed in IE10+
_convertToBinary = true;
_fr.readAsDataURL(blob.getSource());
}
},
getResult: function() {
return _fr && _fr.result ? (_convertToBinary ? _toBinary(_fr.result) : _fr.result) : null;
},
abort: function() {
if (_fr) {
_fr.abort();
}
},
destroy: function() {
_fr = null;
}
});
function _toBinary(str) {
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
}
}
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html4/file/FileReader.js
/**
* FileReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/file/FileReader
@private
*/
define("moxie/runtime/html4/file/FileReader", [
"moxie/runtime/html4/Runtime",
"moxie/runtime/html5/file/FileReader"
], function(extensions, FileReader) {
return (extensions.FileReader = FileReader);
});
// Included from: src/javascript/runtime/html4/xhr/XMLHttpRequest.js
/**
* XMLHttpRequest.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/xhr/XMLHttpRequest
@private
*/
define("moxie/runtime/html4/xhr/XMLHttpRequest", [
"moxie/runtime/html4/Runtime",
"moxie/core/utils/Basic",
"moxie/core/utils/Dom",
"moxie/core/utils/Url",
"moxie/core/Exceptions",
"moxie/core/utils/Events",
"moxie/file/Blob",
"moxie/xhr/FormData"
], function(extensions, Basic, Dom, Url, x, Events, Blob, FormData) {
function XMLHttpRequest() {
var _status, _response, _iframe;
function cleanup(cb) {
var target = this, uid, form, inputs, i, hasFile = false;
if (!_iframe) {
return;
}
uid = _iframe.id.replace(/_iframe$/, '');
form = Dom.get(uid + '_form');
if (form) {
inputs = form.getElementsByTagName('input');
i = inputs.length;
while (i--) {
switch (inputs[i].getAttribute('type')) {
case 'hidden':
inputs[i].parentNode.removeChild(inputs[i]);
break;
case 'file':
hasFile = true; // flag the case for later
break;
}
}
inputs = [];
if (!hasFile) { // we need to keep the form for sake of possible retries
form.parentNode.removeChild(form);
}
form = null;
}
// without timeout, request is marked as canceled (in console)
setTimeout(function() {
Events.removeEvent(_iframe, 'load', target.uid);
if (_iframe.parentNode) { // #382
_iframe.parentNode.removeChild(_iframe);
}
// check if shim container has any other children, if - not, remove it as well
var shimContainer = target.getRuntime().getShimContainer();
if (!shimContainer.children.length) {
shimContainer.parentNode.removeChild(shimContainer);
}
shimContainer = _iframe = null;
cb();
}, 1);
}
Basic.extend(this, {
send: function(meta, data) {
var target = this, I = target.getRuntime(), uid, form, input, blob;
_status = _response = null;
function createIframe() {
var container = I.getShimContainer() || document.body
, temp = document.createElement('div')
;
// IE 6 won't be able to set the name using setAttribute or iframe.name
temp.innerHTML = '<iframe id="' + uid + '_iframe" name="' + uid + '_iframe" src="javascript:""" style="display:none"></iframe>';
_iframe = temp.firstChild;
container.appendChild(_iframe);
/* _iframe.onreadystatechange = function() {
console.info(_iframe.readyState);
};*/
Events.addEvent(_iframe, 'load', function() { // _iframe.onload doesn't work in IE lte 8
var el;
try {
el = _iframe.contentWindow.document || _iframe.contentDocument || window.frames[_iframe.id].document;
// try to detect some standard error pages
if (/^4(0[0-9]|1[0-7]|2[2346])\s/.test(el.title)) { // test if title starts with 4xx HTTP error
_status = el.title.replace(/^(\d+).*$/, '$1');
} else {
_status = 200;
// get result
_response = Basic.trim(el.body.innerHTML);
// we need to fire these at least once
target.trigger({
type: 'progress',
loaded: _response.length,
total: _response.length
});
if (blob) { // if we were uploading a file
target.trigger({
type: 'uploadprogress',
loaded: blob.size || 1025,
total: blob.size || 1025
});
}
}
} catch (ex) {
if (Url.hasSameOrigin(meta.url)) {
// if response is sent with error code, iframe in IE gets redirected to res://ieframe.dll/http_x.htm
// which obviously results to cross domain error (wtf?)
_status = 404;
} else {
cleanup.call(target, function() {
target.trigger('error');
});
return;
}
}
cleanup.call(target, function() {
target.trigger('load');
});
}, target.uid);
} // end createIframe
// prepare data to be sent and convert if required
if (data instanceof FormData && data.hasBlob()) {
blob = data.getBlob();
uid = blob.uid;
input = Dom.get(uid);
form = Dom.get(uid + '_form');
if (!form) {
throw new x.DOMException(x.DOMException.NOT_FOUND_ERR);
}
} else {
uid = Basic.guid('uid_');
form = document.createElement('form');
form.setAttribute('id', uid + '_form');
form.setAttribute('method', meta.method);
form.setAttribute('enctype', 'multipart/form-data');
form.setAttribute('encoding', 'multipart/form-data');
form.setAttribute('target', uid + '_iframe');
I.getShimContainer().appendChild(form);
}
if (data instanceof FormData) {
data.each(function(value, name) {
if (value instanceof Blob) {
if (input) {
input.setAttribute('name', name);
}
} else {
var hidden = document.createElement('input');
Basic.extend(hidden, {
type : 'hidden',
name : name,
value : value
});
// make sure that input[type="file"], if it's there, comes last
if (input) {
form.insertBefore(hidden, input);
} else {
form.appendChild(hidden);
}
}
});
}
// set destination url
form.setAttribute("action", meta.url);
createIframe();
form.submit();
target.trigger('loadstart');
},
getStatus: function() {
return _status;
},
getResponse: function(responseType) {
if ('json' === responseType) {
// strip off <pre>..</pre> tags that might be enclosing the response
if (Basic.typeOf(_response) === 'string' && !!window.JSON) {
try {
return JSON.parse(_response.replace(/^\s*<pre[^>]*>/, '').replace(/<\/pre>\s*$/, ''));
} catch (ex) {
return null;
}
}
} else if ('document' === responseType) {
}
return _response;
},
abort: function() {
var target = this;
if (_iframe && _iframe.contentWindow) {
if (_iframe.contentWindow.stop) { // FireFox/Safari/Chrome
_iframe.contentWindow.stop();
} else if (_iframe.contentWindow.document.execCommand) { // IE
_iframe.contentWindow.document.execCommand('Stop');
} else {
_iframe.src = "about:blank";
}
}
cleanup.call(this, function() {
// target.dispatchEvent('readystatechange');
target.dispatchEvent('abort');
});
}
});
}
return (extensions.XMLHttpRequest = XMLHttpRequest);
});
// Included from: src/javascript/runtime/html5/utils/BinaryReader.js
/**
* BinaryReader.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/utils/BinaryReader
@private
*/
define("moxie/runtime/html5/utils/BinaryReader", [], function() {
return function() {
var II = false, bin;
// Private functions
function read(idx, size) {
var mv = II ? 0 : -8 * (size - 1), sum = 0, i;
for (i = 0; i < size; i++) {
sum |= (bin.charCodeAt(idx + i) << Math.abs(mv + i*8));
}
return sum;
}
function putstr(segment, idx, length) {
length = arguments.length === 3 ? length : bin.length - idx - 1;
bin = bin.substr(0, idx) + segment + bin.substr(length + idx);
}
function write(idx, num, size) {
var str = '', mv = II ? 0 : -8 * (size - 1), i;
for (i = 0; i < size; i++) {
str += String.fromCharCode((num >> Math.abs(mv + i*8)) & 255);
}
putstr(str, idx, size);
}
// Public functions
return {
II: function(order) {
if (order === undefined) {
return II;
} else {
II = order;
}
},
init: function(binData) {
II = false;
bin = binData;
},
SEGMENT: function(idx, length, segment) {
switch (arguments.length) {
case 1:
return bin.substr(idx, bin.length - idx - 1);
case 2:
return bin.substr(idx, length);
case 3:
putstr(segment, idx, length);
break;
default: return bin;
}
},
BYTE: function(idx) {
return read(idx, 1);
},
SHORT: function(idx) {
return read(idx, 2);
},
LONG: function(idx, num) {
if (num === undefined) {
return read(idx, 4);
} else {
write(idx, num, 4);
}
},
SLONG: function(idx) { // 2's complement notation
var num = read(idx, 4);
return (num > 2147483647 ? num - 4294967296 : num);
},
STRING: function(idx, size) {
var str = '';
for (size += idx; idx < size; idx++) {
str += String.fromCharCode(read(idx, 1));
}
return str;
}
};
};
});
// Included from: src/javascript/runtime/html5/image/JPEGHeaders.js
/**
* JPEGHeaders.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/JPEGHeaders
@private
*/
define("moxie/runtime/html5/image/JPEGHeaders", [
"moxie/runtime/html5/utils/BinaryReader"
], function(BinaryReader) {
return function JPEGHeaders(data) {
var headers = [], read, idx, marker, length = 0;
read = new BinaryReader();
read.init(data);
// Check if data is jpeg
if (read.SHORT(0) !== 0xFFD8) {
return;
}
idx = 2;
while (idx <= data.length) {
marker = read.SHORT(idx);
// omit RST (restart) markers
if (marker >= 0xFFD0 && marker <= 0xFFD7) {
idx += 2;
continue;
}
// no headers allowed after SOS marker
if (marker === 0xFFDA || marker === 0xFFD9) {
break;
}
length = read.SHORT(idx + 2) + 2;
// APPn marker detected
if (marker >= 0xFFE1 && marker <= 0xFFEF) {
headers.push({
hex: marker,
name: 'APP' + (marker & 0x000F),
start: idx,
length: length,
segment: read.SEGMENT(idx, length)
});
}
idx += length;
}
read.init(null); // free memory
return {
headers: headers,
restore: function(data) {
var max, i;
read.init(data);
idx = read.SHORT(2) == 0xFFE0 ? 4 + read.SHORT(4) : 2;
for (i = 0, max = headers.length; i < max; i++) {
read.SEGMENT(idx, 0, headers[i].segment);
idx += headers[i].length;
}
data = read.SEGMENT();
read.init(null);
return data;
},
strip: function(data) {
var headers, jpegHeaders, i;
jpegHeaders = new JPEGHeaders(data);
headers = jpegHeaders.headers;
jpegHeaders.purge();
read.init(data);
i = headers.length;
while (i--) {
read.SEGMENT(headers[i].start, headers[i].length, '');
}
data = read.SEGMENT();
read.init(null);
return data;
},
get: function(name) {
var array = [];
for (var i = 0, max = headers.length; i < max; i++) {
if (headers[i].name === name.toUpperCase()) {
array.push(headers[i].segment);
}
}
return array;
},
set: function(name, segment) {
var array = [], i, ii, max;
if (typeof(segment) === 'string') {
array.push(segment);
} else {
array = segment;
}
for (i = ii = 0, max = headers.length; i < max; i++) {
if (headers[i].name === name.toUpperCase()) {
headers[i].segment = array[ii];
headers[i].length = array[ii].length;
ii++;
}
if (ii >= array.length) {
break;
}
}
},
purge: function() {
headers = [];
read.init(null);
read = null;
}
};
};
});
// Included from: src/javascript/runtime/html5/image/ExifParser.js
/**
* ExifParser.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/ExifParser
@private
*/
define("moxie/runtime/html5/image/ExifParser", [
"moxie/core/utils/Basic",
"moxie/runtime/html5/utils/BinaryReader"
], function(Basic, BinaryReader) {
return function ExifParser() {
// Private ExifParser fields
var data, tags, Tiff, offsets = {}, tagDescs;
data = new BinaryReader();
tags = {
tiff : {
/*
The image orientation viewed in terms of rows and columns.
1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
*/
0x0112: 'Orientation',
0x010E: 'ImageDescription',
0x010F: 'Make',
0x0110: 'Model',
0x0131: 'Software',
0x8769: 'ExifIFDPointer',
0x8825: 'GPSInfoIFDPointer'
},
exif : {
0x9000: 'ExifVersion',
0xA001: 'ColorSpace',
0xA002: 'PixelXDimension',
0xA003: 'PixelYDimension',
0x9003: 'DateTimeOriginal',
0x829A: 'ExposureTime',
0x829D: 'FNumber',
0x8827: 'ISOSpeedRatings',
0x9201: 'ShutterSpeedValue',
0x9202: 'ApertureValue' ,
0x9207: 'MeteringMode',
0x9208: 'LightSource',
0x9209: 'Flash',
0x920A: 'FocalLength',
0xA402: 'ExposureMode',
0xA403: 'WhiteBalance',
0xA406: 'SceneCaptureType',
0xA404: 'DigitalZoomRatio',
0xA408: 'Contrast',
0xA409: 'Saturation',
0xA40A: 'Sharpness'
},
gps : {
0x0000: 'GPSVersionID',
0x0001: 'GPSLatitudeRef',
0x0002: 'GPSLatitude',
0x0003: 'GPSLongitudeRef',
0x0004: 'GPSLongitude'
}
};
tagDescs = {
'ColorSpace': {
1: 'sRGB',
0: 'Uncalibrated'
},
'MeteringMode': {
0: 'Unknown',
1: 'Average',
2: 'CenterWeightedAverage',
3: 'Spot',
4: 'MultiSpot',
5: 'Pattern',
6: 'Partial',
255: 'Other'
},
'LightSource': {
1: 'Daylight',
2: 'Fliorescent',
3: 'Tungsten',
4: 'Flash',
9: 'Fine weather',
10: 'Cloudy weather',
11: 'Shade',
12: 'Daylight fluorescent (D 5700 - 7100K)',
13: 'Day white fluorescent (N 4600 -5400K)',
14: 'Cool white fluorescent (W 3900 - 4500K)',
15: 'White fluorescent (WW 3200 - 3700K)',
17: 'Standard light A',
18: 'Standard light B',
19: 'Standard light C',
20: 'D55',
21: 'D65',
22: 'D75',
23: 'D50',
24: 'ISO studio tungsten',
255: 'Other'
},
'Flash': {
0x0000: 'Flash did not fire.',
0x0001: 'Flash fired.',
0x0005: 'Strobe return light not detected.',
0x0007: 'Strobe return light detected.',
0x0009: 'Flash fired, compulsory flash mode',
0x000D: 'Flash fired, compulsory flash mode, return light not detected',
0x000F: 'Flash fired, compulsory flash mode, return light detected',
0x0010: 'Flash did not fire, compulsory flash mode',
0x0018: 'Flash did not fire, auto mode',
0x0019: 'Flash fired, auto mode',
0x001D: 'Flash fired, auto mode, return light not detected',
0x001F: 'Flash fired, auto mode, return light detected',
0x0020: 'No flash function',
0x0041: 'Flash fired, red-eye reduction mode',
0x0045: 'Flash fired, red-eye reduction mode, return light not detected',
0x0047: 'Flash fired, red-eye reduction mode, return light detected',
0x0049: 'Flash fired, compulsory flash mode, red-eye reduction mode',
0x004D: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected',
0x004F: 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected',
0x0059: 'Flash fired, auto mode, red-eye reduction mode',
0x005D: 'Flash fired, auto mode, return light not detected, red-eye reduction mode',
0x005F: 'Flash fired, auto mode, return light detected, red-eye reduction mode'
},
'ExposureMode': {
0: 'Auto exposure',
1: 'Manual exposure',
2: 'Auto bracket'
},
'WhiteBalance': {
0: 'Auto white balance',
1: 'Manual white balance'
},
'SceneCaptureType': {
0: 'Standard',
1: 'Landscape',
2: 'Portrait',
3: 'Night scene'
},
'Contrast': {
0: 'Normal',
1: 'Soft',
2: 'Hard'
},
'Saturation': {
0: 'Normal',
1: 'Low saturation',
2: 'High saturation'
},
'Sharpness': {
0: 'Normal',
1: 'Soft',
2: 'Hard'
},
// GPS related
'GPSLatitudeRef': {
N: 'North latitude',
S: 'South latitude'
},
'GPSLongitudeRef': {
E: 'East longitude',
W: 'West longitude'
}
};
function extractTags(IFD_offset, tags2extract) {
var length = data.SHORT(IFD_offset), i, ii,
tag, type, count, tagOffset, offset, value, values = [], hash = {};
for (i = 0; i < length; i++) {
// Set binary reader pointer to beginning of the next tag
offset = tagOffset = IFD_offset + 12 * i + 2;
tag = tags2extract[data.SHORT(offset)];
if (tag === undefined) {
continue; // Not the tag we requested
}
type = data.SHORT(offset+=2);
count = data.LONG(offset+=2);
offset += 4;
values = [];
switch (type) {
case 1: // BYTE
case 7: // UNDEFINED
if (count > 4) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
for (ii = 0; ii < count; ii++) {
values[ii] = data.BYTE(offset + ii);
}
break;
case 2: // STRING
if (count > 4) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
hash[tag] = data.STRING(offset, count - 1);
continue;
case 3: // SHORT
if (count > 2) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
for (ii = 0; ii < count; ii++) {
values[ii] = data.SHORT(offset + ii*2);
}
break;
case 4: // LONG
if (count > 1) {
offset = data.LONG(offset) + offsets.tiffHeader;
}
for (ii = 0; ii < count; ii++) {
values[ii] = data.LONG(offset + ii*4);
}
break;
case 5: // RATIONAL
offset = data.LONG(offset) + offsets.tiffHeader;
for (ii = 0; ii < count; ii++) {
values[ii] = data.LONG(offset + ii*4) / data.LONG(offset + ii*4 + 4);
}
break;
case 9: // SLONG
offset = data.LONG(offset) + offsets.tiffHeader;
for (ii = 0; ii < count; ii++) {
values[ii] = data.SLONG(offset + ii*4);
}
break;
case 10: // SRATIONAL
offset = data.LONG(offset) + offsets.tiffHeader;
for (ii = 0; ii < count; ii++) {
values[ii] = data.SLONG(offset + ii*4) / data.SLONG(offset + ii*4 + 4);
}
break;
default:
continue;
}
value = (count == 1 ? values[0] : values);
if (tagDescs.hasOwnProperty(tag) && typeof value != 'object') {
hash[tag] = tagDescs[tag][value];
} else {
hash[tag] = value;
}
}
return hash;
}
function getIFDOffsets() {
var idx = offsets.tiffHeader;
// Set read order of multi-byte data
data.II(data.SHORT(idx) == 0x4949);
// Check if always present bytes are indeed present
if (data.SHORT(idx+=2) !== 0x002A) {
return false;
}
offsets.IFD0 = offsets.tiffHeader + data.LONG(idx += 2);
Tiff = extractTags(offsets.IFD0, tags.tiff);
if ('ExifIFDPointer' in Tiff) {
offsets.exifIFD = offsets.tiffHeader + Tiff.ExifIFDPointer;
delete Tiff.ExifIFDPointer;
}
if ('GPSInfoIFDPointer' in Tiff) {
offsets.gpsIFD = offsets.tiffHeader + Tiff.GPSInfoIFDPointer;
delete Tiff.GPSInfoIFDPointer;
}
return true;
}
// At the moment only setting of simple (LONG) values, that do not require offset recalculation, is supported
function setTag(ifd, tag, value) {
var offset, length, tagOffset, valueOffset = 0;
// If tag name passed translate into hex key
if (typeof(tag) === 'string') {
var tmpTags = tags[ifd.toLowerCase()];
for (var hex in tmpTags) {
if (tmpTags[hex] === tag) {
tag = hex;
break;
}
}
}
offset = offsets[ifd.toLowerCase() + 'IFD'];
length = data.SHORT(offset);
for (var i = 0; i < length; i++) {
tagOffset = offset + 12 * i + 2;
if (data.SHORT(tagOffset) == tag) {
valueOffset = tagOffset + 8;
break;
}
}
if (!valueOffset) {
return false;
}
data.LONG(valueOffset, value);
return true;
}
// Public functions
return {
init: function(segment) {
// Reset internal data
offsets = {
tiffHeader: 10
};
if (segment === undefined || !segment.length) {
return false;
}
data.init(segment);
// Check if that's APP1 and that it has EXIF
if (data.SHORT(0) === 0xFFE1 && data.STRING(4, 5).toUpperCase() === "EXIF\0") {
return getIFDOffsets();
}
return false;
},
TIFF: function() {
return Tiff;
},
EXIF: function() {
var Exif;
// Populate EXIF hash
Exif = extractTags(offsets.exifIFD, tags.exif);
// Fix formatting of some tags
if (Exif.ExifVersion && Basic.typeOf(Exif.ExifVersion) === 'array') {
for (var i = 0, exifVersion = ''; i < Exif.ExifVersion.length; i++) {
exifVersion += String.fromCharCode(Exif.ExifVersion[i]);
}
Exif.ExifVersion = exifVersion;
}
return Exif;
},
GPS: function() {
var GPS;
GPS = extractTags(offsets.gpsIFD, tags.gps);
// iOS devices (and probably some others) do not put in GPSVersionID tag (why?..)
if (GPS.GPSVersionID && Basic.typeOf(GPS.GPSVersionID) === 'array') {
GPS.GPSVersionID = GPS.GPSVersionID.join('.');
}
return GPS;
},
setExif: function(tag, value) {
// Right now only setting of width/height is possible
if (tag !== 'PixelXDimension' && tag !== 'PixelYDimension') {return false;}
return setTag('exif', tag, value);
},
getBinary: function() {
return data.SEGMENT();
},
purge: function() {
data.init(null);
data = Tiff = null;
offsets = {};
}
};
};
});
// Included from: src/javascript/runtime/html5/image/JPEG.js
/**
* JPEG.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/JPEG
@private
*/
define("moxie/runtime/html5/image/JPEG", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/html5/image/JPEGHeaders",
"moxie/runtime/html5/utils/BinaryReader",
"moxie/runtime/html5/image/ExifParser"
], function(Basic, x, JPEGHeaders, BinaryReader, ExifParser) {
function JPEG(binstr) {
var _binstr, _br, _hm, _ep, _info, hasExif;
function _getDimensions() {
var idx = 0, marker, length;
// examine all through the end, since some images might have very large APP segments
while (idx <= _binstr.length) {
marker = _br.SHORT(idx += 2);
if (marker >= 0xFFC0 && marker <= 0xFFC3) { // SOFn
idx += 5; // marker (2 bytes) + length (2 bytes) + Sample precision (1 byte)
return {
height: _br.SHORT(idx),
width: _br.SHORT(idx += 2)
};
}
length = _br.SHORT(idx += 2);
idx += length - 2;
}
return null;
}
_binstr = binstr;
_br = new BinaryReader();
_br.init(_binstr);
// check if it is jpeg
if (_br.SHORT(0) !== 0xFFD8) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
// backup headers
_hm = new JPEGHeaders(binstr);
// extract exif info
_ep = new ExifParser();
hasExif = !!_ep.init(_hm.get('app1')[0]);
// get dimensions
_info = _getDimensions.call(this);
Basic.extend(this, {
type: 'image/jpeg',
size: _binstr.length,
width: _info && _info.width || 0,
height: _info && _info.height || 0,
setExif: function(tag, value) {
if (!hasExif) {
return false; // or throw an exception
}
if (Basic.typeOf(tag) === 'object') {
Basic.each(tag, function(value, tag) {
_ep.setExif(tag, value);
});
} else {
_ep.setExif(tag, value);
}
// update internal headers
_hm.set('app1', _ep.getBinary());
},
writeHeaders: function() {
if (!arguments.length) {
// if no arguments passed, update headers internally
return (_binstr = _hm.restore(_binstr));
}
return _hm.restore(arguments[0]);
},
stripHeaders: function(binstr) {
return _hm.strip(binstr);
},
purge: function() {
_purge.call(this);
}
});
if (hasExif) {
this.meta = {
tiff: _ep.TIFF(),
exif: _ep.EXIF(),
gps: _ep.GPS()
};
}
function _purge() {
if (!_ep || !_hm || !_br) {
return; // ignore any repeating purge requests
}
_ep.purge();
_hm.purge();
_br.init(null);
_binstr = _info = _hm = _ep = _br = null;
}
}
return JPEG;
});
// Included from: src/javascript/runtime/html5/image/PNG.js
/**
* PNG.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/PNG
@private
*/
define("moxie/runtime/html5/image/PNG", [
"moxie/core/Exceptions",
"moxie/core/utils/Basic",
"moxie/runtime/html5/utils/BinaryReader"
], function(x, Basic, BinaryReader) {
function PNG(binstr) {
var _binstr, _br, _hm, _ep, _info;
_binstr = binstr;
_br = new BinaryReader();
_br.init(_binstr);
// check if it's png
(function() {
var idx = 0, i = 0
, signature = [0x8950, 0x4E47, 0x0D0A, 0x1A0A]
;
for (i = 0; i < signature.length; i++, idx += 2) {
if (signature[i] != _br.SHORT(idx)) {
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}
}
}());
function _getDimensions() {
var chunk, idx;
chunk = _getChunkAt.call(this, 8);
if (chunk.type == 'IHDR') {
idx = chunk.start;
return {
width: _br.LONG(idx),
height: _br.LONG(idx += 4)
};
}
return null;
}
function _purge() {
if (!_br) {
return; // ignore any repeating purge requests
}
_br.init(null);
_binstr = _info = _hm = _ep = _br = null;
}
_info = _getDimensions.call(this);
Basic.extend(this, {
type: 'image/png',
size: _binstr.length,
width: _info.width,
height: _info.height,
purge: function() {
_purge.call(this);
}
});
// for PNG we can safely trigger purge automatically, as we do not keep any data for later
_purge.call(this);
function _getChunkAt(idx) {
var length, type, start, CRC;
length = _br.LONG(idx);
type = _br.STRING(idx += 4, 4);
start = idx += 4;
CRC = _br.LONG(idx + length);
return {
length: length,
type: type,
start: start,
CRC: CRC
};
}
}
return PNG;
});
// Included from: src/javascript/runtime/html5/image/ImageInfo.js
/**
* ImageInfo.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/ImageInfo
@private
*/
define("moxie/runtime/html5/image/ImageInfo", [
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/runtime/html5/image/JPEG",
"moxie/runtime/html5/image/PNG"
], function(Basic, x, JPEG, PNG) {
/**
Optional image investigation tool for HTML5 runtime. Provides the following features:
- ability to distinguish image type (JPEG or PNG) by signature
- ability to extract image width/height directly from it's internals, without preloading in memory (fast)
- ability to extract APP headers from JPEGs (Exif, GPS, etc)
- ability to replace width/height tags in extracted JPEG headers
- ability to restore APP headers, that were for example stripped during image manipulation
@class ImageInfo
@constructor
@param {String} binstr Image source as binary string
*/
return function(binstr) {
var _cs = [JPEG, PNG], _img;
// figure out the format, throw: ImageError.WRONG_FORMAT if not supported
_img = (function() {
for (var i = 0; i < _cs.length; i++) {
try {
return new _cs[i](binstr);
} catch (ex) {
// console.info(ex);
}
}
throw new x.ImageError(x.ImageError.WRONG_FORMAT);
}());
Basic.extend(this, {
/**
Image Mime Type extracted from it's depths
@property type
@type {String}
@default ''
*/
type: '',
/**
Image size in bytes
@property size
@type {Number}
@default 0
*/
size: 0,
/**
Image width extracted from image source
@property width
@type {Number}
@default 0
*/
width: 0,
/**
Image height extracted from image source
@property height
@type {Number}
@default 0
*/
height: 0,
/**
Sets Exif tag. Currently applicable only for width and height tags. Obviously works only with JPEGs.
@method setExif
@param {String} tag Tag to set
@param {Mixed} value Value to assign to the tag
*/
setExif: function() {},
/**
Restores headers to the source.
@method writeHeaders
@param {String} data Image source as binary string
@return {String} Updated binary string
*/
writeHeaders: function(data) {
return data;
},
/**
Strip all headers from the source.
@method stripHeaders
@param {String} data Image source as binary string
@return {String} Updated binary string
*/
stripHeaders: function(data) {
return data;
},
/**
Dispose resources.
@method purge
*/
purge: function() {}
});
Basic.extend(this, _img);
this.purge = function() {
_img.purge();
_img = null;
};
};
});
// Included from: src/javascript/runtime/html5/image/MegaPixel.js
/**
(The MIT License)
Copyright (c) 2012 Shinichi Tomita <shinichi.tomita@gmail.com>;
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.
*/
/**
* Mega pixel image rendering library for iOS6 Safari
*
* Fixes iOS6 Safari's image file rendering issue for large size image (over mega-pixel),
* which causes unexpected subsampling when drawing it in canvas.
* By using this library, you can safely render the image with proper stretching.
*
* Copyright (c) 2012 Shinichi Tomita <shinichi.tomita@gmail.com>
* Released under the MIT license
*/
/**
@class moxie/runtime/html5/image/MegaPixel
@private
*/
define("moxie/runtime/html5/image/MegaPixel", [], function() {
/**
* Rendering image element (with resizing) into the canvas element
*/
function renderImageToCanvas(img, canvas, options) {
var iw = img.naturalWidth, ih = img.naturalHeight;
var width = options.width, height = options.height;
var x = options.x || 0, y = options.y || 0;
var ctx = canvas.getContext('2d');
if (detectSubsampling(img)) {
iw /= 2;
ih /= 2;
}
var d = 1024; // size of tiling canvas
var tmpCanvas = document.createElement('canvas');
tmpCanvas.width = tmpCanvas.height = d;
var tmpCtx = tmpCanvas.getContext('2d');
var vertSquashRatio = detectVerticalSquash(img, iw, ih);
var sy = 0;
while (sy < ih) {
var sh = sy + d > ih ? ih - sy : d;
var sx = 0;
while (sx < iw) {
var sw = sx + d > iw ? iw - sx : d;
tmpCtx.clearRect(0, 0, d, d);
tmpCtx.drawImage(img, -sx, -sy);
var dx = (sx * width / iw + x) << 0;
var dw = Math.ceil(sw * width / iw);
var dy = (sy * height / ih / vertSquashRatio + y) << 0;
var dh = Math.ceil(sh * height / ih / vertSquashRatio);
ctx.drawImage(tmpCanvas, 0, 0, sw, sh, dx, dy, dw, dh);
sx += d;
}
sy += d;
}
tmpCanvas = tmpCtx = null;
}
/**
* Detect subsampling in loaded image.
* In iOS, larger images than 2M pixels may be subsampled in rendering.
*/
function detectSubsampling(img) {
var iw = img.naturalWidth, ih = img.naturalHeight;
if (iw * ih > 1024 * 1024) { // subsampling may happen over megapixel image
var canvas = document.createElement('canvas');
canvas.width = canvas.height = 1;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, -iw + 1, 0);
// subsampled image becomes half smaller in rendering size.
// check alpha channel value to confirm image is covering edge pixel or not.
// if alpha value is 0 image is not covering, hence subsampled.
return ctx.getImageData(0, 0, 1, 1).data[3] === 0;
} else {
return false;
}
}
/**
* Detecting vertical squash in loaded image.
* Fixes a bug which squash image vertically while drawing into canvas for some images.
*/
function detectVerticalSquash(img, iw, ih) {
var canvas = document.createElement('canvas');
canvas.width = 1;
canvas.height = ih;
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0);
var data = ctx.getImageData(0, 0, 1, ih).data;
// search image edge pixel position in case it is squashed vertically.
var sy = 0;
var ey = ih;
var py = ih;
while (py > sy) {
var alpha = data[(py - 1) * 4 + 3];
if (alpha === 0) {
ey = py;
} else {
sy = py;
}
py = (ey + sy) >> 1;
}
canvas = null;
var ratio = (py / ih);
return (ratio === 0) ? 1 : ratio;
}
return {
isSubsampled: detectSubsampling,
renderTo: renderImageToCanvas
};
});
// Included from: src/javascript/runtime/html5/image/Image.js
/**
* Image.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html5/image/Image
@private
*/
define("moxie/runtime/html5/image/Image", [
"moxie/runtime/html5/Runtime",
"moxie/core/utils/Basic",
"moxie/core/Exceptions",
"moxie/core/utils/Encode",
"moxie/file/File",
"moxie/runtime/html5/image/ImageInfo",
"moxie/runtime/html5/image/MegaPixel",
"moxie/core/utils/Mime",
"moxie/core/utils/Env"
], function(extensions, Basic, x, Encode, File, ImageInfo, MegaPixel, Mime, Env) {
function HTML5Image() {
var me = this
, _img, _imgInfo, _canvas, _binStr, _blob
, _modified = false // is set true whenever image is modified
, _preserveHeaders = true
;
Basic.extend(this, {
loadFromBlob: function(blob) {
var comp = this, I = comp.getRuntime()
, asBinary = arguments.length > 1 ? arguments[1] : true
;
if (!I.can('access_binary')) {
throw new x.RuntimeError(x.RuntimeError.NOT_SUPPORTED_ERR);
}
_blob = blob;
if (blob.isDetached()) {
_binStr = blob.getSource();
_preload.call(this, _binStr);
return;
} else {
_readAsDataUrl.call(this, blob.getSource(), function(dataUrl) {
if (asBinary) {
_binStr = _toBinary(dataUrl);
}
_preload.call(comp, dataUrl);
});
}
},
loadFromImage: function(img, exact) {
this.meta = img.meta;
_blob = new File(null, {
name: img.name,
size: img.size,
type: img.type
});
_preload.call(this, exact ? (_binStr = img.getAsBinaryString()) : img.getAsDataURL());
},
getInfo: function() {
var I = this.getRuntime(), info;
if (!_imgInfo && _binStr && I.can('access_image_binary')) {
_imgInfo = new ImageInfo(_binStr);
}
info = {
width: _getImg().width || 0,
height: _getImg().height || 0,
type: _blob.type || Mime.getFileMime(_blob.name),
size: _binStr && _binStr.length || _blob.size || 0,
name: _blob.name || '',
meta: _imgInfo && _imgInfo.meta || this.meta || {}
};
return info;
},
downsize: function() {
_downsize.apply(this, arguments);
},
getAsCanvas: function() {
if (_canvas) {
_canvas.id = this.uid + '_canvas';
}
return _canvas;
},
getAsBlob: function(type, quality) {
if (type !== this.type) {
// if different mime type requested prepare image for conversion
_downsize.call(this, this.width, this.height, false);
}
return new File(null, {
name: _blob.name || '',
type: type,
data: me.getAsBinaryString.call(this, type, quality)
});
},
getAsDataURL: function(type) {
var quality = arguments[1] || 90;
// if image has not been modified, return the source right away
if (!_modified) {
return _img.src;
}
if ('image/jpeg' !== type) {
return _canvas.toDataURL('image/png');
} else {
try {
// older Geckos used to result in an exception on quality argument
return _canvas.toDataURL('image/jpeg', quality/100);
} catch (ex) {
return _canvas.toDataURL('image/jpeg');
}
}
},
getAsBinaryString: function(type, quality) {
// if image has not been modified, return the source right away
if (!_modified) {
// if image was not loaded from binary string
if (!_binStr) {
_binStr = _toBinary(me.getAsDataURL(type, quality));
}
return _binStr;
}
if ('image/jpeg' !== type) {
_binStr = _toBinary(me.getAsDataURL(type, quality));
} else {
var dataUrl;
// if jpeg
if (!quality) {
quality = 90;
}
try {
// older Geckos used to result in an exception on quality argument
dataUrl = _canvas.toDataURL('image/jpeg', quality/100);
} catch (ex) {
dataUrl = _canvas.toDataURL('image/jpeg');
}
_binStr = _toBinary(dataUrl);
if (_imgInfo) {
_binStr = _imgInfo.stripHeaders(_binStr);
if (_preserveHeaders) {
// update dimensions info in exif
if (_imgInfo.meta && _imgInfo.meta.exif) {
_imgInfo.setExif({
PixelXDimension: this.width,
PixelYDimension: this.height
});
}
// re-inject the headers
_binStr = _imgInfo.writeHeaders(_binStr);
}
// will be re-created from fresh on next getInfo call
_imgInfo.purge();
_imgInfo = null;
}
}
_modified = false;
return _binStr;
},
destroy: function() {
me = null;
_purge.call(this);
this.getRuntime().getShim().removeInstance(this.uid);
}
});
function _getImg() {
if (!_canvas && !_img) {
throw new x.ImageError(x.DOMException.INVALID_STATE_ERR);
}
return _canvas || _img;
}
function _toBinary(str) {
return Encode.atob(str.substring(str.indexOf('base64,') + 7));
}
function _toDataUrl(str, type) {
return 'data:' + (type || '') + ';base64,' + Encode.btoa(str);
}
function _preload(str) {
var comp = this;
_img = new Image();
_img.onerror = function() {
_purge.call(this);
comp.trigger('error', x.ImageError.WRONG_FORMAT);
};
_img.onload = function() {
comp.trigger('load');
};
_img.src = /^data:[^;]*;base64,/.test(str) ? str : _toDataUrl(str, _blob.type);
}
function _readAsDataUrl(file, callback) {
var comp = this, fr;
// use FileReader if it's available
if (window.FileReader) {
fr = new FileReader();
fr.onload = function() {
callback(this.result);
};
fr.onerror = function() {
comp.trigger('error', x.ImageError.WRONG_FORMAT);
};
fr.readAsDataURL(file);
} else {
return callback(file.getAsDataURL());
}
}
function _downsize(width, height, crop, preserveHeaders) {
var self = this
, scale
, mathFn
, x = 0
, y = 0
, img
, destWidth
, destHeight
, orientation
;
_preserveHeaders = preserveHeaders; // we will need to check this on export (see getAsBinaryString())
// take into account orientation tag
orientation = (this.meta && this.meta.tiff && this.meta.tiff.Orientation) || 1;
if (Basic.inArray(orientation, [5,6,7,8]) !== -1) { // values that require 90 degree rotation
// swap dimensions
var tmp = width;
width = height;
height = tmp;
}
img = _getImg();
// unify dimensions
if (!crop) {
scale = Math.min(width/img.width, height/img.height);
} else {
// one of the dimensions may exceed the actual image dimensions - we need to take the smallest value
width = Math.min(width, img.width);
height = Math.min(height, img.height);
scale = Math.max(width/img.width, height/img.height);
}
// we only downsize here
if (scale > 1 && !crop && preserveHeaders) {
this.trigger('Resize');
return;
}
// prepare canvas if necessary
if (!_canvas) {
_canvas = document.createElement("canvas");
}
// calculate dimensions of proportionally resized image
destWidth = Math.round(img.width * scale);
destHeight = Math.round(img.height * scale);
// scale image and canvas
if (crop) {
_canvas.width = width;
_canvas.height = height;
// if dimensions of the resulting image still larger than canvas, center it
if (destWidth > width) {
x = Math.round((destWidth - width) / 2);
}
if (destHeight > height) {
y = Math.round((destHeight - height) / 2);
}
} else {
_canvas.width = destWidth;
_canvas.height = destHeight;
}
// rotate if required, according to orientation tag
if (!_preserveHeaders) {
_rotateToOrientaion(_canvas.width, _canvas.height, orientation);
}
_drawToCanvas.call(this, img, _canvas, -x, -y, destWidth, destHeight);
this.width = _canvas.width;
this.height = _canvas.height;
_modified = true;
self.trigger('Resize');
}
function _drawToCanvas(img, canvas, x, y, w, h) {
if (Env.OS === 'iOS') {
// avoid squish bug in iOS6
MegaPixel.renderTo(img, canvas, { width: w, height: h, x: x, y: y });
} else {
var ctx = canvas.getContext('2d');
ctx.drawImage(img, x, y, w, h);
}
}
/**
* Transform canvas coordination according to specified frame size and orientation
* Orientation value is from EXIF tag
* @author Shinichi Tomita <shinichi.tomita@gmail.com>
*/
function _rotateToOrientaion(width, height, orientation) {
switch (orientation) {
case 5:
case 6:
case 7:
case 8:
_canvas.width = height;
_canvas.height = width;
break;
default:
_canvas.width = width;
_canvas.height = height;
}
/**
1 = The 0th row is at the visual top of the image, and the 0th column is the visual left-hand side.
2 = The 0th row is at the visual top of the image, and the 0th column is the visual right-hand side.
3 = The 0th row is at the visual bottom of the image, and the 0th column is the visual right-hand side.
4 = The 0th row is at the visual bottom of the image, and the 0th column is the visual left-hand side.
5 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual top.
6 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual top.
7 = The 0th row is the visual right-hand side of the image, and the 0th column is the visual bottom.
8 = The 0th row is the visual left-hand side of the image, and the 0th column is the visual bottom.
*/
var ctx = _canvas.getContext('2d');
switch (orientation) {
case 2:
// horizontal flip
ctx.translate(width, 0);
ctx.scale(-1, 1);
break;
case 3:
// 180 rotate left
ctx.translate(width, height);
ctx.rotate(Math.PI);
break;
case 4:
// vertical flip
ctx.translate(0, height);
ctx.scale(1, -1);
break;
case 5:
// vertical flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.scale(1, -1);
break;
case 6:
// 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(0, -height);
break;
case 7:
// horizontal flip + 90 rotate right
ctx.rotate(0.5 * Math.PI);
ctx.translate(width, -height);
ctx.scale(-1, 1);
break;
case 8:
// 90 rotate left
ctx.rotate(-0.5 * Math.PI);
ctx.translate(-width, 0);
break;
}
}
function _purge() {
if (_imgInfo) {
_imgInfo.purge();
_imgInfo = null;
}
_binStr = _img = _canvas = _blob = null;
_modified = false;
}
}
return (extensions.Image = HTML5Image);
});
// Included from: src/javascript/runtime/html4/image/Image.js
/**
* Image.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/**
@class moxie/runtime/html4/image/Image
@private
*/
define("moxie/runtime/html4/image/Image", [
"moxie/runtime/html4/Runtime",
"moxie/runtime/html5/image/Image"
], function(extensions, Image) {
return (extensions.Image = Image);
});
expose(["moxie/core/utils/Basic","moxie/core/I18n","moxie/core/utils/Mime","moxie/core/utils/Env","moxie/core/utils/Dom","moxie/core/Exceptions","moxie/core/EventTarget","moxie/core/utils/Encode","moxie/runtime/Runtime","moxie/runtime/RuntimeClient","moxie/file/Blob","moxie/file/File","moxie/file/FileInput","moxie/runtime/RuntimeTarget","moxie/file/FileReader","moxie/core/utils/Url","moxie/file/FileReaderSync","moxie/xhr/FormData","moxie/xhr/XMLHttpRequest","moxie/runtime/Transporter","moxie/image/Image","moxie/core/utils/Events"]);
})(this);/**
* o.js
*
* Copyright 2013, Moxiecode Systems AB
* Released under GPL License.
*
* License: http://www.plupload.com/license
* Contributing: http://www.plupload.com/contributing
*/
/*global moxie:true */
/**
Globally exposed namespace with the most frequently used public classes and handy methods.
@class o
@static
@private
*/
(function(exports) {
"use strict";
var o = {}, inArray = exports.moxie.core.utils.Basic.inArray;
// directly add some public classes
// (we do it dynamically here, since for custom builds we cannot know beforehand what modules were included)
(function addAlias(ns) {
var name, itemType;
for (name in ns) {
itemType = typeof(ns[name]);
if (itemType === 'object' && !~inArray(name, ['Exceptions', 'Env', 'Mime'])) {
addAlias(ns[name]);
} else if (itemType === 'function') {
o[name] = ns[name];
}
}
})(exports.moxie);
// add some manually
o.Env = exports.moxie.core.utils.Env;
o.Mime = exports.moxie.core.utils.Mime;
o.Exceptions = exports.moxie.core.Exceptions;
// expose globally
exports.mOxie = o;
if (!exports.o) {
exports.o = o;
}
return o;
})(this);
|
user_guide/searchindex.js
|
shushankareyan/info
|
Search.setIndex({envversion:42,terms:{represent:[25,118,13,80],mybackup:76,yellow:[6,132],poorli:93,four:[152,89,54,138,55,128,124,133,127],prefix:[89,97,2,29],oldest:133,hate:134,optimize_databas:76,forget:[51,106],whose:29,choos:[44,88,12,152,29,54,80,47,82,112,106,51,149],accur:[0,29,117,154,42,96],aug:93,emailaddress:51,my_control:[104,113],site_url:[82,99,21,7,29],illustr:[136,99,152],swap:[42,89,97,113,29],up8:93,under:[145,27,97,33,152,10,0,100,32,29,34,80,112,142,106,134,67,108,109],up6:93,lord:93,up4:93,up5:93,up2:93,spec:99,myselect:94,up1:93,merchant:78,digit:[128,88,56,29],kudo:29,everi:[63,53,139,19,149,54,45,80,95,8,142,143,125,152,113,106,144,43,109],risk:[106,131,29],"void":[140,89,46,7,92,133,96,99,54,100,56,106,108,109,146,147,115,29,118,82,124,42],internet:[33,99,29],http_host:[30,33],mime_typ:100,del_dir:117,stripslash:[138,29],upstream:29,start_cach:[152,29],applicationconfig:128,set_templ:[146,127],rename_t:[77,29],total_seg:[153,29],ci_db_query_build:152,fopen_write_cr:116,email_attachment_unred:29,preg_match:29,csrf_hash:102,encrypt_nam:[131,29],cmd:50,upload:[94,52,104,55,29],previou:[10,56,33,52,29],sri:93,vector:[80,29],red:[145,148,153,133,6,132,9,51,127],wednesdai:127,enjoy:141,mysqli_driv:37,zlib:29,up35:93,abil:[27,29,128,80,125,109],direct:[88,152,29,55,81,82,9,142],str_repeat:[6,138,33,29],enjoi:[64,55],dowload:16,second:[140,0,2,5,101,46,7,89,94,92,49,93,9,51,11,99,137,138,13,56,139,104,6,106,143,79,146,19,147,110,67,21,111,148,151,112,152,115,149,150,23,76,77,29,117,100,33,82,153,83,155,118,109],aggreg:89,mysqli_client_ssl_dont_verify_server_cert:29,kaliningrad:93,eldoc:81,even:[89,128,7,9,94,51,135,12,54,100,57,142,96,144,66,113,149,27,29,80,49,153,154],hide:29,date_rss:93,item2:[106,33],neg:[128,5,106,29],get_extens:29,item1:106,exit_unknown_fil:[116,46],calcul:[54,42,89,29],poison:29,yoursit:99,blur:44,num_tag_open:63,"new":[0,88,3,5,128,7,95,142,131,144,49,93,9,51,134,96,52,98,99,137,54,55,151,102,103,104,105,57,58,106,15,16,17,109,63,19,123,73,67,75,112,113,152,115,72,27,74,23,76,77,29,30,118,33,34,82,153,37,38,39,122,40,68,157,126,156,150,158],net:[29,67,112,142,59,108],ever:[30,94,133,33,142],groupid:128,metadata:91,blog_model:79,med:94,elimin:[118,154,29],kilobyt:131,behavior:[0,29],get_month_nam:19,form_button:[94,29],never:[0,137,29,30,118,33,128,112,113,106,142],last_row:56,here:[0,1,80,5,128,101,94,131,132,49,50,51,11,99,137,54,13,56,139,151,104,6,106,108,79,63,146,19,144,147,150,21,22,111,69,148,75,142,72,27,23,152,29,117,100,33,81,82,154,124,44,42,109,156,127],met:[25,106,67,80],directory_map:[11,29],smtp_timeout:[23,29],ci_calendar:19,path:[11,76,147,29,117,45,79,46,34,90,89,148,92,132,50,97,149,108,135],up45:93,sess_table_nam:[106,33],interpret:29,get_smiley_link:13,forum:[134,144,141,8],get_var:[111,29],row_start:127,anymor:29,characterss:124,loos:[27,53,146,66,128,6],precis:[42,155,34,29],datetim:[99,56,93,29],"_output":[0,29],niue:93,permit:[0,2,3,45,46,94,131,132,9,51,10,97,70,100,101,6,58,106,108,109,133,66,110,152,151,112,99,115,23,76,77,78,29,80,34,153,83,41,42,127],"_fetch_from_arrai":29,blog_config:7,heading_title_cel:19,"_cooki":[109,33,142,29],portabl:[94,2,82],http_x_client_ip:[109,29],message_kei:140,myanmar:93,get_cooki:[109,92,33,29],another_mark_start:42,releas:[43,108,29],unix:[19,29,128,67,93,106,109],cell_start:127,strai:29,mysqli:[29,97,149,89,33,37,71,79],newspac:29,cont:23,txt:[76,147,29,110,143,115,108],unit:[52,119,144,93,29],highli:[53,34,108],set_profiler_sect:[84,100],describ:[5,80,128,46,7,131,9,51,134,154,54,13,14,142,144,21,75,114,26,23,152,79,29,34,84,55,127],would:[140,0,88,44,128,7,89,9,131,94,125,49,93,75,50,51,96,154,97,12,54,138,55,101,14,6,58,106,135,107,63,146,19,150,111,28,113,25,115,27,139,23,152,79,100,29,82,153,39,118,42,142,127],information_about_someth:128,afterward:[131,80,29],get_filenam:[117,29],dnt:29,call:[144,34,29],asset:[5,142],typo:[3,29],recommend:[150,23,12,111,29,128,65,95,80,8,154,131,151,142,144,156,108,71],old_nam:77,protect_braced_quot:20,care:[116,0,151,89,67,80,22,25,9,106,149,109],type:[86,5,1,89,128,45,46,34,48,94,92,125,49,93,9,129,11,12,137,138,13,56,103,105,101,142,16,6,122,145,147,110,97,148,152,25,70,155,72,150,28,76,77,29,117,79,81,47,82,83,121,108,41],until:[63,100,29,33,34,92,106,51,42,144],uniqid:29,set_tempdata:[106,29],error_php:72,unescap:29,product_id_rul:133,inflect:29,notif:29,error_messag:140,notic:[44,13,128,46,131,132,9,51,99,137,54,100,106,146,19,21,22,152,78,29,118,80,154,124,42,127],unbuffered_row:[56,29],warn:[54,106,128,58,29],glass:133,start_dai:19,exce:51,stdclass:56,wm_opac:54,up7:93,last_tag_clos:63,hold:[80,144,112,29],wma:29,must:[140,0,87,2,3,44,128,101,46,80,94,131,132,93,9,51,134,97,99,79,137,54,13,56,84,151,104,18,106,59,58,146,133,19,67,111,156,148,88,112,113,25,152,115,149,116,23,76,77,29,117,100,33,81,82,39,55,124,42,144,142],composer_autoload:[45,29],sha256:80,join:[128,106,152,29],sometim:[48,51,76,99],some_t:[48,56,49],setup:[25,128,59,144],work:[10,144,29],up3:93,krasnoyarsk:93,form_open:[29,22,133,105,94,51,143],sharp:44,undeliv:23,show_other_dai:19,slash:[139,29,128,138,33,101,95,7,153,151,132,142],abridg:93,root:[72,0,97,76,144,117,55,101,21,131,106,135,109],newfoundland:93,overrid:[116,0,11,29,113,101,102,84,132,27,149],csv_from_result:[76,29],segment_on:89,create_databas:[77,29],num_row:[114,56,29],give:[29,27,80,152,77,64,128,13,46,82,142,92,6,106,146,51,114,144],send_request:99,greater_than_equal_to:51,smtp:[69,23,29],pg_escape_str:29,indic:[145,44,10,54,101,29,46,7,128,131,93,133,51,107,149],captcha:29,somefil:117,encypt:80,caution:[80,29],unavail:29,want:[140,0,2,44,45,46,7,34,132,94,51,95,96,97,12,137,54,138,139,56,151,101,106,135,107,108,79,63,146,144,147,66,111,28,112,152,115,80,23,76,77,29,117,118,33,47,82,40,124,125,42,109,85],array_column:[25,29],fieldset:94,mysql_:2,unsign:[106,148,88,77,124],bag:128,read_fil:[117,29],save_queri:[83,84,29],manipul:[91,52,128,29],quot:[145,1,76,89,128,138,20,29,49,94],up575:93,march:29,how:[144,29],enforc:29,hor:54,disappear:44,show_error:[116,81,88,46,29],answer:[138,34],verifi:[97,151,29,148,106,51,16],"_escape_identifi":29,config:[0,13,5,45,46,94,92,132,49,93,9,135,52,11,150,12,55,101,14,6,108,144,65,97,113,25,152,149,116,27,76,29,117,79,34,82,154,84,125],updat:[89,29,34,49,83,144],lao:93,recogn:[25,29],tablenam:[152,49],some_field_nam:131,after:[29,0,152,77,65,101,55,56,34,154,84,132,138,94,125],altogeth:33,diagram:132,befor:[0,152,29,113,101,49,48,132,18,27,149,144],wrong:[106,131,142,82,29],mark_as_temp:[106,29],offlin:[120,102,103,104,105,57,58,59,60,17,62,123,15,72,73,74,75,122,30,31,32,33,95,35,36,37,38,39,121,61,40,68,157,126,156,16,158],random_str:[138,29],mailpath:23,post_imag:6,dbprefix:[72,97,152,79,89,29,49,149],averag:152,allowed_fil:29,util:[91,152,97,12,29],attempt:[0,29,67,82,113,142,109,143,108,96],third:[5,7,94,51,11,137,138,6,106,79,145,19,147,21,22,111,152,150,23,76,29,117,118,33,81,82,83,124],fewer:[97,152,29],username_cal:51,bootstrap:29,greet:99,imposs:[80,112,29],alias:[89,101,29],maintain:[10,87,150,29,54,118,33,66,130,112,9,106,134,115,144],environ:[97,34,29],localdomain:29,reloc:29,enter:[145,146,29],exclus:[117,29],expected_result:146,order:[89,77,29],dblclick:44,wine:132,oper:[116,27,152,29,34,48,108,144],form_submit:[94,133],composit:29,feedback:[106,29],shorten:[128,124],offici:[130,106,33,29],fall:[25,30,67,33,29],becaus:[0,33,89,7,8,133,82,94,51,12,101,18,106,143,108,109,21,112,25,71,116,152,80,49,124],jpeg:[131,100],field_exist:[48,89],privileg:76,affect:[44,12,29,128,33,101,14,89,83,18,152],highlight_phras:[150,29],japan:93,flexibl:[5,53,75,137,29,33,69],vari:[128,29],myfil:[151,111,137],suffix:29,code_to_run:44,cli:29,img:[6,148,23,29],inflector:[90,29],fwrite:29,add_data:115,not_group_start:152,reduce_multipl:[138,29],inadvert:29,better:[27,29,128,80,125,113,9,134,144],or_group_start:152,persist:[145,97,23,89,29,112,106],comprehens:[51,8],hidden:[44,11,0,128,29,22,133,84,94,143],img_url:148,increment_str:[138,29],them:[140,0,158,55,89,128,45,122,80,95,109,131,125,93,75,9,51,96,60,97,98,12,59,54,139,13,56,84,151,102,103,104,105,57,58,156,101,106,15,16,17,62,63,116,133,123,152,73,66,143,124,21,111,126,28,113,25,99,118,72,27,74,23,144,77,29,30,31,32,33,34,35,36,37,38,39,121,61,40,41,157,88,142,120,68],row_end:127,thei:[44,1,80,0,128,101,7,34,89,9,94,50,51,150,12,79,137,54,138,55,56,14,102,103,105,18,106,58,19,144,20,21,69,88,25,99,27,139,23,152,77,29,118,33,81,47,82,42,109],fragment:[88,137],safe:[150,80,70,29,33,47,82,133,106,94,12,143],compress_output:[57,29],"break":[152,29],sqlite3:[33,71,29],db_name:77,get_mim:[116,108,29],"_remove_invisible_charact":29,request_uri:[109,65,29],drop_tabl:[77,29],choic:[80,138,33,7,6,106,51],grammat:29,mytabl:[152,114,76,34,127],f4v:29,my_mark_start:42,odbc:[97,33,71,29],bonu:9,timeout:[67,23,99,149,89],each:[140,0,139,3,44,128,45,7,89,133,146,132,93,53,94,51,96,11,12,138,55,56,154,141,106,135,145,64,19,124,21,22,111,97,88,25,99,114,115,149,27,23,152,29,118,80,34,84,41,125,42,127],debug:[46,84,12,49,29],went:21,european:93,oblig:7,side:[63,44,139,99,29,128,33,131,152],mean:[44,80,12,93,89,128,132,33,139,22,69,105,57,7,112,133,106,114,144],monolith:85,list:[97,89,29],wm_vrt_offset:54,saturdai:[19,127],flock:29,ommit:25,extract:[25,23,111,109],tgz:29,depress:6,network:29,goe:[130,33,80,112,29],open:[0,152,10,29,45,79,50,113,27,9,144,135],newli:[51,112,29],dsn:[97,23,149,29],rewrit:[39,154,29],sprintf:[51,33],got:29,force_download:[76,147,29],forth:150,"_reindex_seg":29,database2_nam:149,is_:29,linear:112,navig:[50,63,143],written:[63,27,97,33,0,54,29,46,21,22,154,82,146,18,124,130,106,117],smtp_host:23,somesit:129,situat:[97,80,152,34,29],given:[140,133,19,29,54,33,106,111,117,51,124,93,41,25,12,134,153,115,85],quoted_printable_encod:[25,108,29],standard:29,add_drop:76,element:[86,27,139,76,137,111,29,118,33,21,22,44,94,131,145,25,51,127],"_truncat":29,error_url_miss:140,blog_descript:[88,77],memory_usag:[42,100,84],md5:[80,70,29,138,33,142],anchor_class:29,angl:54,isp:106,openssl:[33,80],"001_add_blog":88,filter:[101,29],link_tag:[6,29],att:82,mvc:[64,137,79,66,139,134],pagin:[52,11,34,29],isn:[140,145,76,77,29,101,80,46,152,51,109],iphon:96,regress:29,codeignit:29,confus:[118,29],bite:44,rand:[152,29],rang:[150,29,54,80,93,134,115],render:[63,0,139,33,29,100,13,81,14,22,21,83,84,136,132,18,118,44,142,143],fetch_directori:29,accent:[150,29],clariti:[128,57,21,93,29],hellip:150,exit_unknown_method:116,restrict:[78,117,131,108,142,85,58],hook:[113,81,29],instruct:[128,45,52,29],autoinit:29,messag:[76,89,29,49,154,50,12,108,144],wasn:[21,29],daylight_sav:93,agre:10,primari:[97,99,77,152,29,89,21,7,48,148,124,106],hood:[27,80],form_label:[94,29],nomin:103,top:[63,44,11,139,29,54,118,55,46,14,51],reverse_nam:56,result_arrai:[152,29,118,56,21,114],downsid:106,cumul:[152,77],master:[54,93,7,144],too:[97,23,29,128,33,142],similarli:[94,106,92,33,140],my_view:29,gilbert:93,john:[99,54,118,94,50,144,127],ci_rout:33,rempath:151,prep_url:[51,82,29],library_src:44,is_doubl:146,namespac:29,tool:29,notice_area:44,albert:145,took:144,user_ag:[37,39,104,29],alpha_numeric_spac:[51,29],sha1:[138,142,70,29],western:93,somewhat:80,local_tim:19,error_:140,crawl:29,technic:[53,139,81,106,142,51],fileperm:117,target:[44,152,89,54,29,82,124,94,115,144],keyword:[128,6,152,29],consequ:104,provid:[140,44,80,89,128,129,46,7,48,131,132,93,133,51,134,96,10,97,70,56,14,103,6,106,143,109,19,20,22,28,112,142,25,27,23,152,77,78,29,118,33,81,82,153,40,124,85,127],previous_url:19,set_error:[124,29],older:[106,33,150,112,29],tree:115,told:[0,51],returned_valu:117,project:[10,97,130,50,134,85,144],matter:[106,42,65],solomon:93,rfc2616:29,entri:[29,99,79,67,33,101,82,6,124],date_rfc1123:93,minut:[106,67,100,18,93],beginn:80,explicitli:[117,149,82,29],file_exceeds_limit:29,week_dai:19,ran:[145,22,127],ram:80,mind:[63,145,80,49,112,142,106],auto_clear:23,clear_var:[111,29],seed:[80,152,21,29],rar:29,manner:[29,88,80,128,100,33,2,106,144],increment:[19,29,138,67,80,131,112],super_class:128,seen:[136,134,33,124],seem:[128,145,3,18,29],incompat:29,encode_php_tag:[51,70],translate_uri_dash:[101,29],result_object:56,cal_cell_end_oth:19,is_php:[116,108,29],captal:29,is_nul:146,myusernam:[149,79],latter:[128,22],encode_from_legaci:[104,112,29],common_funct:25,thorough:[124,85,29],week_day_cel:19,point2:42,contact:[142,82],transmit:29,data1:118,moscow:93,simplifi:[83,114,89,34,29],set_rul:[51,95,22,29],endfor:154,trans_complet:[12,89],though:[44,80,29,54,33,7,128,106],option_nam:133,scripto:44,my_arrai:94,legibl:128,unknowingli:142,next_link:[63,29],mario:145,regular:[89,77,29],letter:[29,0,139,112,79,128,138,33,140,93],herebi:78,svg10:6,mdate:93,"_set_uri_str":29,cap:[148,29],ctype_alpha:29,prematur:57,yourdomain:92,tradit:[91,27,79],cal_cell_end:19,simplic:[53,152,79],don:[87,80,89,128,7,93,51,100,101,139,106,143,144,145,19,66,67,69,112,142,149,27,23,29,33,34,49,124],mailtyp:[23,111],doc:29,tempdata:29,clean_file_nam:29,trans_start:[89,12,29],blog_author:77,max_width:131,doe:[144,29],dblib:29,dummi:33,declar:[0,77,29,117,146,56,95,7,25,128,6,132,113,9,106],wildcard:[89,152,49,29],no_file_select:29,detriment:34,left:[63,0,150,76,152,44,54,118,139,21,153,128,156,99,143],sum:[152,29],dot:29,class_nam:[28,56,107],reactor:[130,29],visitor:[29,33,57,142,109,96],whitelist:[143,29],random:[145,80,152,29,138,33,148,131,112,50,143],"__ci_var":106,endwhil:154,radiu:145,use_page_numb:[63,29],advisori:[106,33],radio:[94,51,29],earth:29,form_error:[94,51],autoload:[45,27,79,149,29],fennec:29,maxlength:[94,133,29],oci:29,absolut:[97,151,29,54,110,80,131,94,106],arcfour:80,layout:[87,76,127],firstnam:[118,99],libari:29,field2:[152,109],menu:[94,51,137,93,29],explain:[64,19,33,106,111,142,131,99,9,51,144],configur:29,apach:[5,131,14,109],errantli:29,secretsmittypass:99,wm_pad:54,theme:44,explic:29,rich:[134,85],iconv_en:116,display_respons:99,folder:[0,13,45,50,11,98,55,57,18,15,16,17,58,73,97,148,72,27,74,75,29,117,81,34,37,38,39,40,126,156,157,158],changedir:151,set_head:[127,100,23,82,29],csrf_verifi:29,nasti:22,enable_profil:[84,100],stop:[29,23,152,89,100,42],compli:23,consecut:20,font_path:148,report:29,my_app_index:111,directory_nam:137,tge:29,bat:[128,81],bar:[63,151,128,101,67,100,81,111,125,18,106,9,51,135],first_url:[63,29],emb:[142,23],ietf:29,baz:128,form_hidden:[94,133,29],patch:[109,101,144,29],twice:[152,29],bad:[29,150,80,99,79,33,95],local_to_gmt:93,septemb:29,steal:106,"_ci_view_fil":29,mssql_get_last_messag:29,guiana:93,odbc_field_:29,urldecod:51,rollback:[12,29],datatyp:[146,99,77],num:[138,6,101,155],mandatori:80,result:[89,2,34,149,29],auto_incr:[88,77,29,21,148,124],fail:[12,29,54,67,80,49,89,104,99,124,51,143,144],themselv:[69,128,28],"_call_hook":29,best:[10,49],subject:[146,23,78,29,129,144],brazil:93,awar:[81,29],set_userdata:106,said:[106,33,80],new_path:115,databas:29,wikipedia:50,source_dir:[117,11,29],mug:133,"_error_numb":29,mua:29,invalu:128,drawn:29,awai:54,irc:8,approach:144,attribut:[86,77,29,117,33,56,82,133,6,93,94,108],inabl:128,accord:[51,99],socket_typ:67,extend:[50,0,89,29],newnam:[23,29],column_to_drop:77,boss:152,"_execut":29,extens:[27,97,147,137,29,117,45,89,81,148,25,39,9,108],week_row_end:19,html4:6,html5:[6,33,150,29],recent:142,http_raw_post_data:29,natur:[51,152,29],advertis:29,subfold:29,unaffect:29,form_validation_lang:[140,51,29],unfound:29,cop:[99,137],protect:29,accident:29,expos:[106,29],trale:29,howev:[0,33,128,101,7,133,131,132,9,51,134,135,99,54,138,100,56,57,106,108,144,63,146,67,112,113,115,152,118,80,49,125,142],against:[88,152,29,111,124,70],compile_bind:[89,29],logic:[89,29,152,14,18],mydirectori:11,boldlist:6,login:[101,82],browser:[0,100,92,132,50,96,136,137,54,55,14,57,18,106,143,109,147,111,22,21,142,150,139,29,118,33,82,42],com:[0,139,5,128,6,94,92,50,51,134,99,137,138,13,101,105,129,106,109,63,19,148,151,72,23,29,33,34,82,153,83,39,124,44,144,131],col:[94,13],rehash:25,tough:144,debugg:29,log_path:29,set_checkbox:[94,51,29],standardize_newlin:29,loader:[44,11,76,77,29,45,67,119,37,38,52,113],ascii_to_ent:[150,29],wider:54,guid:[28,29,24,9,142,149,107,144],assum:[80,89,7,94,51,135,97,12,13,139,57,58,63,19,75,112,72,73,74,23,152,29,33,34,49,37,39],"_parse_query_str":29,user_data:[33,156,29],duplic:[100,138,124,29],reciev:129,welcome_messag:[113,111,29],"_request":142,chrome:29,unwant:128,"_rule":22,three:[63,23,99,152,29,54,101,20,46,34,22,94,88,49,106,9,51,138,127,142,117],been:[140,44,89,46,132,93,51,70,137,100,56,102,103,104,105,106,108,109,21,111,112,72,88,152,77,29,31,33,34,121,122,144,127],legend:[54,94],formsuccess:51,plaintext:23,ar_cach:29,trigger:[29,44,53,5,81,33,46,142,131,132,110,51,143],interest:85,basic:29,clear_attach:23,mytext:147,openssl_random_pseudo_byt:[25,143],hesit:128,quickli:81,up65:93,life:143,rfc5321:29,html_entity_decod:[143,29],unset_userdata:[106,33,29],eastern:93,suppress:[63,128,7,29],magic_quotes_runtim:29,search:[63,5,152,65,138,33,29,82,153,69,49,25,134,109,72,96],anywher:[27,42,84,100,18],lift:149,child:[69,28],"catch":[128,101,29],suar:6,blog_control:79,ugli:[128,148],ident:[0,2,128,7,34,9,92,93,94,51,54,56,104,6,109,133,20,113,116,27,28,152,77,29,118,47,82,153,42],quantiti:[94,133,29],cache_set_path:89,mitig:[142,29],properti:[44,87,88,29,54,100,20,33,56,111,102,128,125,9,106,133,109],air:127,aim:[33,80],form_upload:94,weren:29,form_validation_:[33,29],get_compiled_upd:[152,29],publicli:[29,13,80,33,7,106,144],allow_get_arrai:109,aid:29,vagu:144,anchor:[29,44,27,33,82,131,51],redisexcept:29,opt:[106,134,33],template1:118,form_clos:94,printabl:29,set_delimit:118,somelibrari:128,tabl:[97,89,114,29],toolkit:[134,85],filename2:140,memcach:29,need:[140,0,2,3,44,128,45,7,8,89,50,92,94,5,49,93,9,51,125,131,134,96,136,53,150,12,137,54,13,101,139,102,103,104,105,18,106,135,16,79,63,146,133,144,147,65,66,67,97,21,22,111,148,88,152,112,113,99,115,80,27,23,76,149,29,30,100,33,81,34,82,153,84,121,124,118,132,42,109,142,85,127],marco:29,cond:152,conf:[3,29],wm_shadow_dist:54,tediou:51,master_dim:[54,29],sever:[64,75,99,77,29,89,56,152,69,146,93,113,133,51,156,135],log_date_format:29,disabl:[97,12,29,89,46,34,14,83,154,132,152,108],invalid_dimens:29,harmoni:29,incorrectli:29,perform:29,suggest:[27,33,111,29],make:[10,144,77,149,29],db_result:29,camellia:80,"ros\u00e9n":29,complex:[152,66,139,6,124,51,85],strip_quot:[138,29],split:[64,150,101,89],chatroom:8,"__set":[106,56,29],complet:[146,23,12,152,29,54,33,46,111,8,89,150,6,153,124,106,114,127,96],elli:130,prev_link:[63,29],evid:101,http_x_forwarded_for:[109,29],blue:[51,6,132,151,127],rail:130,cache_overrid:132,evil:29,hand:[94,0,88,51],fairli:[66,106,131,142],rais:[49,29],upload_lang:29,bia:106,squar:[51,6,29],dhaka:29,charlim:150,kept:[44,13,29,118,33,112,129,133,106,144,143,109],undesir:142,scenario:51,java:108,post_dat:93,linkifi:82,flush_cach:[152,29],min:[152,29],fatal:[128,67,101,29],taint:142,inherit:[0,87,19,29],stop_cach:[152,29],client:[29,44,97,23,89,30,33,131],shortli:51,thi:[10,144,29],endif:[133,154],gzip:[76,57,29],programm:[128,134,8],everyth:[145,5,80,99,29,33,22,151,133,106],url_suffix:[63,72,82,29],identifi:[89,144,29],just:[145,1,80,89,45,9,94,50,51,12,54,138,105,106,143,109,63,21,22,111,69,88,142,152,27,23,76,77,29,33,81,95,82],safe_mod:29,wm_font_siz:54,photo:[54,115,147],ordin:82,array_replac:[25,29],up55:93,via:[152,77,29,49,76,144],stringenc:128,human:[72,5,29,81,82,93,41,51],yet:[12,21,22,124,51,108],languag:[11,29,128,45,90,93,113,50,85],previous:[59,29],shoud:7,group_bi:[152,29],xmlhttprequest:29,greenwich:93,easi:[63,5,29,80,111,140,104,106,109],explictli:63,declin:144,had:[104,33,29],"_end":42,ci_vers:[116,29],is_float:146,x_axi:54,ak_my_design:150,"0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz":148,date_iso8601:[93,29],swap_pr:[97,29],els:[0,128,129,46,131,51,96,12,142,108,109,22,99,152,29,30,33,81,49,153,117,154,124],ffffff:54,save:[0,23,152,93,137,29,128,101,67,80,46,34,7,133,131,18,112,50],hat:130,transit:[104,6,29],gave:[124,29,8],sanit:[70,29,21,22,142,51,143,108],applic:[0,87,152,27,45,29,46,14,34,89,50,97,24,18,113,9,132,108,149],csprng:25,get_compiled_select:[152,29],measur:[54,55,58],preserv:[54,106,124,143,29],disposit:[23,29],regard:[53,19,152,54,46,111,128,142,51,156],credit:144,lightbox:6,distanc:54,or_where_in:[152,29],rewrite_short_tag:[39,29],background:[106,148,33,150,29],field_nam:[89,29,56,34,48,131,51],cape:93,database_nam:[97,76],apart:125,hmac_kei:80,"_parse_request_uri":29,handpick:130,"_csrf_set_hash":29,specif:[97,89,149,29],"_displai":[100,132,29],insert_id:[83,29],arbitrari:[42,99,97,49,29],manual:[97,34,29],certificat:97,get_client_info:2,varieti:[81,85,29],multiselect:94,night:6,funcion:29,unnecessari:[142,115],underli:[106,97,81,89],www:[23,99,29,13,82,6,55,124,106,108],right:[63,44,139,99,10,78,0,54,118,29,21,153,133,132,50,152,42,150,85,144],old:[63,148,80,29,100,33,95,82,142,151,112,106,51,156,71],deal:[140,27,70,78,29,80,89,51],negat:[67,29],interv:93,excerpt:124,user_model:79,dead:29,fetchabl:49,born:115,intern:[140,80,29,128,33,56,82,103,39,142,133,106],printer:6,elaps:[42,84,93,89],interf:29,successfulli:[151,29,129,33,46,22,131,124,133,51],password_needs_rehash:25,transmiss:80,less_than_equal_to:51,thu:[51,142,101,99,29],total:[84,89,56,114,29],ico:6,bottom:[72,44,139,29,54,100,84,93],file_get_cont:[117,100,33,29],subclass:[87,29],not_lik:[152,29],raw_nam:131,pmachin:29,equal:[44,152,146,29,51,108,127],word_length:[148,29],rdfa:6,overcom:101,condit:[29,152,78,89,128,33,22,49,106],foo:[146,1,151,29,128,101,67,100,81,111,94,104,125,18,9,106,135],my_tabl:[83,114,56,152,127],localhost:[44,97,99,79,29,106,149],core:[152,29],plu:[94,146,6,82,7],who:[10,79,128,101,113,142],cal_cell_start_todai:19,passwordconfirm:51,name_of_last_city_us:128,someclass:[9,137],insecur:[33,7,29],pose:14,cellpad:[133,146,19,127],add_dir:115,set_alt_messag:23,scrollabl:29,repositori:[140,81,144],post:[145,0,79,29,101,82,84,94,142],"super":[99,29,128,139,111,125,112,9],shuck:150,unsaf:[106,33,29],um4:93,um7:93,first_tag_clos:63,um1:93,um3:93,um2:93,get_flash_kei:106,invoice_id:152,is_ajax_request:[109,29],um9:93,um8:93,surround:63,reduce_double_slash:[138,29],distinct:[44,152,29],dinner:138,form_validation_rul:33,enable_query_str:[63,5,72,29],algo:25,span:[94,150,124,29],commit:[53,144,12,134,29],ci_db_util:[76,111],my_mark_end:42,produc:[63,146,80,12,77,29,33,56,34,82,111,83,104,6,49,93,94,152,114,153,150],match:[0,133,80,152,29,128,139,33,101,111,94,89,25,146,106,9,51,134,79],set_insert_batch:152,email_filed_smtp_login:29,"float":[150,155],encod:[52,29,128,80,95,82,142,104,119,112,124,25,51,108,109],active_group:[97,33,126],down:[88,54,56,22,128,28,93,94,142],creativ:[134,85],count_al:[83,89,152,29],captcha_id:148,formerli:[152,70,29],wrap:[89,150,13,49,29],make_column:[13,127],set_test_item:[146,29],storag:[89,29],east:93,cipher:[97,112],git:[43,144],invalid_filetyp:29,wai:[140,0,80,7,48,131,125,93,50,51,70,137,56,154,18,106,143,108,109,146,66,21,111,69,112,142,99,149,27,88,152,29,117,33,47,84,42,144],"_prep_quoted_print":29,array1:25,post_get:[109,33,29],transform:[49,82,29],happi:[6,144],avail:[34,29],width:[44,133,148,29,54,82,128,131,6,94],reli:[53,76,77,29,30,33,128,106],request_method:[109,29],editor:[0,99,137,128,55,7,131,50,51],db_active_rec:[37,29],add_column:[77,29],wav:29,srednekolymsk:93,get_random_byt:[143,29],fork:144,sess_destroi:[106,29],head:29,medium:[94,127],is_cli:[50,109,33,108,29],form:[5,137,29,81,56,129,148,93,27,142,107,144],offer:[80,33,95,91,25,51],forc:[97,147,65,117,29,82,131,142,134,85],ucfirst:[128,87,33,139,29],hackeron:144,forg:29,fore:47,aren:[51,31,29],sess_driv:[106,33,111,29],upload_path:131,renam:[97,29],nonexistent_librari:111,stand:142,"true":[27,97,56,12,77,29,45,79,46,152,49,48,84,132,81,25,76,108,89,149],something_els:81,table_open:[19,127],reset:29,absent:[42,21],input:[29,79,89,49,113,25,108],function_us:[116,108,29],validation_lang:29,new_nam:77,exact_length:[51,29],heading_row_end:[19,127],filename_bad_char:29,maximum:[150,53,23,152,29,54,118,80,48,131,18,112,25,51,134],tell:[140,27,97,88,76,77,152,79,54,111,153,69,146,106],independ:[2,152,89,111,133,12],toggl:[19,29],my_articl:5,field3:152,emit:29,trim:[51,138,33,29],up11:93,e_warn:29,featur:[140,0,80,5,128,45,91,132,9,51,52,54,100,56,58,106,149,144,19,67,75,142,152,71,23,76,29,33,34,153,154,156],p7r:29,delete_cach:[18,29],stronger:80,"abstract":[12,29,128,21,91,71],mirror:151,myotherclass:132,futur:[106,33,80,29],some_data:109,uri:[89,34,18,29],input_stream:[109,33,29],cal_row_start:19,exist:[89,77,144,34,29],p7c:29,"_ci_load":29,p7a:29,request:[0,23,152,29,30,100,33,56,111,84,5,18,101,142,144,108,109],umark_temp:106,stanleyxu:29,p7m:29,check:[76,29,128,110,46,94,129,50,104,132,41,25,142,83,108,144],assembl:152,site_nam:7,mp4:29,is_load:[116,111,7,29],"7zip":29,higher:[54,101,80,46,25,106],download_help:[37,29],when:[0,97,12,77,29,45,81,56,34,49,89,83,18,25,152,149,108,144],refactor:29,active_record:[126,33,29],"_set_head":29,test:[97,89,144,29],presum:[6,80],uri_protocol:[3,29],roll:[88,12,89],realiti:145,is_http:[116,108,29],relat:[70,77,29,128,138,33,95,22,131,6,106,3],intend:[63,0,23,152,93,29,54,138,64,33,106,89,146,124,55,112,27,133,51,135],phoenix:93,benefici:34,get_output:[100,132],image_properti:6,min_height:[131,29],query_toggle_count:[84,29],insensit:[143,100,101,29],intent:[128,106,33],consid:[0,80,19,149,29,45,33,81,47,49,153,89,152,146,106,94,51,42,127,134,118],sql:[97,76,89,29,152,49,83,12,114,71],iso8601:[99,29],idenitif:100,shortnam:29,outdat:142,bitbucket:29,receiv:[0,23,29,111,106,51],known_str:25,longer:[44,80,29,128,33,56,111,104,18,112,106,51,144],furthermor:[128,33,80],function_nam:108,htdoc:[117,142],pseudo:[146,80,19,29,118,100,42,134],withhold:29,dohash:[104,70,29],vietnam:93,ignor:[63,1,80,76,152,29,66,118,20,33,47,88,106,115],cal_novemb:29,time:[89,45,9,82,93,94,79,138,6,18,142,107,108,144,145,148,113,76,29,33,34,49,84],reply_to:[23,29],backward:[29,44,33,0,129,13,56,104,88,112,133,106,109],stick:[80,144],"_data_seek":29,recipi:[129,23,29],concept:[9,106,21,26,146],session_destroi:106,flac:29,chain:[89,77,29],whoever:144,skip:[76,77,152,29,117,46,56,95,104,94,106],global:[140,27,53,3,149,29,45,33,46,34,7,111,142,97,132,106,9,51,109,108,79],focus:53,invent:142,cyril:29,function_trigg:[72,5],"12c":29,unit_test:146,superglob:[106,33,29],seriou:[142,104],set_valu:[94,51,29],archive_filepath:115,blog_titl:[118,88,77],"_insert_batch":29,insert_entri:79,menubar:29,hierarch:0,form_textarea:[94,29],middl:[54,150,29],depend:[97,89,34,49,29],zone:[93,29],pem:[97,29],decim:[51,42,89,29],readabl:[147,29,117,81,128,93,106,144],worth:[106,80],deject:6,certainli:[33,80],decis:[23,112,29],text:[0,152,77,29,81,46,34,50,27,25,142,108],get_the_file_properties_from_the_fil:128,oversight:29,query_str:[3,29],update_str:[83,89,29],sourc:[10,11,151,29,54,80,6,25,134,149,144],string:[97,89,149,29],unnam:29,wm_font_color:[54,29],unfamiliar:22,revalid:100,lru:67,url_encod:108,octob:29,word:[72,5,97,150,29,128,101,33,56,82,148,41,133,42,149],brows:[133,27,106,96],cool:44,set_messag:[51,29],save_handl:106,level:[11,29,54,33,46,128,6,106,115],did:[0,152,137,29,54,139,46,22,8,128,124,50,144],die:[128,100],hawaii:93,iter:[128,118,67,138,25,127],item:[72,5,152,137,29,45,89,145,154,94,113,52,58,27,9,132,125,138,108],unsupport:29,public_html:151,team:[130,88,29],cooki:[27,142,29],div:[63,44,19,29,81,21,94,51],exit_databas:116,"15t16":93,round:[145,44,6,99],dir:11,prevent:[29,44,80,99,0,128,101,55,46,152,22,148,88,145,82,142,140,143,108,109],slower:106,secrion:80,user_str:25,"_file_mime_typ":29,sign:[10,29],shuffl:27,first_link:[63,29],product_name_saf:[133,29],last_activity_idx:103,myarchiv:115,afghanistan:93,appear:[72,5,80,19,29,54,20,101,47,148,18,93,99,44,51,150],repli:23,scaffold:[72,73,98,3,29,104,39,58],favour:29,current:[140,44,2,89,129,7,48,93,133,51,11,13,56,105,18,108,109,19,111,156,151,152,71,88,76,77,29,100,81,34,82,84,144,43],sinc:[0,89,9,94,51,134,96,12,54,100,57,18,106,109,133,66,111,69,112,25,152,115,116,27,76,77,29,118,33,34,82,153],ampersand:1,screenx:82,domain2:[30,33],domain1:[30,33],boost:34,file_path:131,or_not_group_start:152,if_exist:77,burn:145,image_mirror_gd:29,deriv:[25,80,22],dropdown:94,compos:[45,29],gener:[152,77,89,29,34,91,144],unauthor:[100,108],french:[140,93],check_exist:110,satisfi:[25,106],add_field:[88,77,29],slow:44,modif:[10,31,33,102,103,39,105,106],address:[29,129,14,82,6,94,144],myradio:94,along:[99,29,54,100,81,7,131,51],window_nam:82,userguid:29,latest_stuff:115,wait:99,box:[94,106,80,142],insan:58,error_suffix:[51,29],my_email:[9,33],ini_set:128,shift:[34,29],bot:[82,96],"_version":29,odbc_insert_id:29,a_filter_uri:29,membership:93,"_trans_depth":29,filename_help:104,valid_url:[51,29],commonli:[140,142,51,134,143,85,96],ourselv:33,some_act:131,semant:[128,47,29],regardless:[0,88,29,54,80,49,150,23,109],iana:23,extra:[63,44,80,0,29,21,22,106,94,51],activ:[5,152,29,33,146,83,104,93,133,106,42,134],modul:54,prefer:[77,152,34,149,29],ellislab:[130,33,29],instad:29,paramat:[23,29],ftp_unable_to_remam:29,createfromformat:56,visibl:[44,146,29],marker:[54,106,42,29],instal:[97,81,108,29],mobil:[96,29],eccentr:29,regex:[51,101,29],newslett:94,serpent:80,memori:[0,76,29,56,84,18],sake:[21,79],pref:[76,19],visit:[0,33,99,137,13,139,8,152,131,112,50,51,96],test_mod:89,perm:[117,151],subvers:29,permitted_uri_char:[33,58,29],live:[106,67,14,49],handler:[106,33,101,147,29],form_reset:[94,29],value2:23,value1:23,criteria:[51,101],msg:[112,124],scope:[46,29],australian:93,checkout:133,prep:[94,142,29],heading_previous_cel:19,um5:93,capit:[0,139,79,128,33,41,9],mcrypt_mode_ecb:[112,29],minim:[53,152,66,154,141,142,94,51,134,85],python:81,peopl:[23,101,124,133,142,134,156,85,149],claus:[128,83,152,77,29],array_item:106,enhanc:29,uniquid:29,visual:[54,29],um6:93,list_fil:151,prototyp:[140,97,99,149,79,101,7,153,148,131,132,93,124,9,51,127,126],omsk:93,postgresql:[97,29,33,49,83,106,71],effort:[33,43,141,124],easiest:128,is_imag:[143,131,70,29],fly:[23,29,39,154,104,115],orwher:[104,152,29],graphic:[136,6],auto_link:[82,29],prepar:[145,131,22],pretend:29,cur_pag:29,uniqu:[138,152,77,29],image_arrai:13,cat:42,json_pretty_print:100,reappear:44,invalid_select:128,is_count:41,whatev:[145,88,89,128,29,111,49,151,82],purpos:[140,53,80,78,29,54,100,33,46,111,82,117,128,93,118,106,109],misc_kei:140,materi:[80,89],object_nam:111,problemat:[33,29],heart:0,validli:129,explor:[64,29,141,33,8],stream:[80,29],"_applic":[67,121,122],slightli:[128,150,152],backslash:101,agent:[29,52,23,119,33,103,131,122,142,109],choke:144,critic:[142,144],abort:[100,46,29],indefinit:10,uruguai:93,unfortun:[142,80,34,108],occur:[29,128,138,81,111,49,14,7],contribut:[10,29],pink:6,alwai:[0,33,44,128,7,94,50,96,11,9,101,102,106,109,67,142,25,77,29,117,80,81,49,153,30,42,144],differenti:[142,14,29],multipl:[97,144,29],keep_flashdata:[106,29],filename1:140,charset:[89,29,47,94,6,25],ping:149,write:[76,89,29,34,49,83,152,144],set_item:[44,7],purg:101,foreach:[27,23,76,137,128,118,154,56,21,153,48,131,93,133,152,114,134],pure:[30,118,33,56,154,9,42],familiar:[63,146,12,137,80,81,154,124,106],tild:142,xhtml:[6,23,29],tbodi:127,clean_str:29,map:[11,139,99,13,101,111],example_field:49,pg_escape_liter:29,http_refer:29,http_x_requested_with:109,max:[48,124,152,29],sql_mode:29,spot:41,usabl:[33,143,108,80],mac:[50,128,96,29],socket:[67,124,29],mymethod:132,query_string_seg:63,"_ci_class":29,mai:[86,0,80,44,128,46,7,34,133,132,53,94,51,96,10,11,99,137,54,89,101,14,140,104,106,135,143,108,21,111,112,142,152,150,139,88,76,77,29,118,33,47,124,125],end:[33,128,7,132,93,51,97,138,100,56,57,106,143,146,112,115,150,151,152,29,80,34,154,124,42],underscor:[0,29,128,101,82,41,142,144],validation_error:[94,51,22],data:[89,29,34,49,48,83,114,149],grow:134,man:29,statu:[44,100,76,29,158,33,46,152,82,89,83,49,106,108],practic:[27,14,49,79],conscious:130,foo_bar:111,stdin:[109,108,29],"_get_ip":29,inform:[10,97,29,34,149,144],"switch":[29,97,80,89,128,33,51,149],preced:[29,128,20,101,93,115],combin:[0,152,29,128,33,56,6,93,94,142,143,109],block:[29,128,118,81,154,84,106,134,144,127],"_clean_input_data":29,callabl:29,tbody_open:127,purifi:33,allowed_domain:[30,33],remove_invisible_charact:[116,108],pipe:[51,131,29],search_path:29,old_encrypted_str:112,approv:[140,143],show_prev_next:29,upload_form:131,increas:[128,106,138,55,29],nbsp:[127,6,33,19,29],or_where_not_in:[152,29],ttl:[106,67,29],get_magic_quotes_gpc:29,file_permiss:[54,29],still:[97,80,29,30,33,101,21,8,128,106,25,51,95,65],mark_as_flash:106,ttf:[54,148],dynam:[5,29,81,34,18,9],entiti:[150,1,70,29,138,20,33,47,6,124,51,143],smitti:99,conjunct:20,newprefix_tablenam:49,group:[97,89,149,29],thank:[106,29],polici:108,form_multiselect:[94,29],"_backup":29,users_model:51,mybutton:94,platform:[97,2,76,29,89,152,69,83,106,12,108,96],window:[144,29,128,67,95,82,50,109,143,108,96],new_table_nam:77,unset_tempdata:[106,29],intl:29,javascript_loc:44,mail:[23,29,129,33,82,69,94,106,144],main:[72,0,11,29,117,55,46,87,116,97,125,94,144,135],countabl:41,getfileproperti:128,explanatori:131,non:[150,100,77,29,128,101,20,33,56,142,104,6,110,25,106,127,108,109],halt:[106,29],jame:152,displai:[97,29,46,13,81,89,83,84,132,18,93,94,142],thumb_mark:54,initi:[97,89,34,29],alt_path:140,or_not_lik:[152,29],date_rfc822:[33,93],safari:[96,29],disappoint:51,ci_cart:133,now:[50,0,29],discuss:[142,139,28,152,107],nor:[138,33,152,49,80],havingor:29,pastebin:144,term:[63,27,2,80,111,140,9,106],argentina:93,name:[97,2,152,77,29,89,56,34,49,48,83,114,149],mysql_get_client_info:2,opera:29,cellspac:[133,146,19,127],drop:29,separ:[97,152,29,128,138,46,82,41,9,149],is_really_writ:[116,108,29],allman:[128,144],januari:[19,29],hijack:[142,143],pizza:6,compil:[99,89,54,29,49,84,152],failov:[97,29],domain:[29,30,33,81,92,106,109],"_get_mod_tim":29,img_path:148,cal_cell_no_content_todai:19,cookie_httponli:[106,29],replac:[76,29,49,48,154,25,152],stopped_by_extens:29,um95:93,continu:[99,137,29,128,101,22,112,124,51,42],ensur:[145,97,29,128,67,80,111,112,142],redistribut:10,backport:25,significantli:[134,113],viewpath:[116,29],year:[130,19,93,29],min_width:[131,29],happen:[23,137,29,80,34,33,132,106,42,115,144],set_realpath:[110,29],heading_row_start:[19,127],html_escap:[94,116,33,108,29],slide:44,shown:[63,27,139,80,19,152,29,54,118,33,131,82,154,148,84,133,51,42,140,150,158],accomplish:[99,77],referenc:[118,93,29],"3rd":29,space:[142,29],old_fil:151,mysql_escape_str:29,data_to_cach:67,"_remap":[50,0],trans_commit:[12,29],profil:[24,29],mess:113,get_file_properti:128,danijelb:29,tb_data:124,is_int:146,correct:[29,146,151,152,89,128,80,47,83,131,142,51],image_lib:[37,54,11,29],group_two:149,get_head:[100,29],ci_typographi:[47,20],migrat:[52,119,156,29],ibas:[71,29],xhtml1:6,tmpf:106,cart:[52,29],"_error_messag":29,cut:[56,29],ajax:[44,109,143,106,29],mime:[147,29,117,58,40,108],ci_log:29,org:[6,23,29],"byte":[29,128,80,84,155,143],card:[133,80,112],error_str:[51,88],insert_str:[83,148,89,124],reusabl:53,time_refer:[93,29],suffici:106,global_xss_filt:29,nice_d:[93,29],yup:112,modest:29,british:[130,78],unavoid:104,turn:[63,33,12,137,29,13,34,82,153,83,131,151,152,94,142,108,109],place:[0,55,89,128,7,95,142,131,132,9,51,97,99,54,13,101,14,18,106,144,63,146,19,67,21,111,88,113,115,150,23,152,77,29,100,33,34,84,42,156],cal_days_in_month:[93,29],legacy_mod:112,log_messag:[116,46,12,29],okai:128,row_id:133,principl:[9,64],nicknam:99,think:[80,112,144],lambda:132,ci_benchmark:42,loki97:80,directli:[0,89,125,9,10,79,137,138,55,18,142,109,146,136,21,106,152,28,76,77,29,33],ci_lang:[86,140],onc:[140,44,46,133,131,125,9,96,99,54,29,101,18,141,106,107,109,146,19,20,21,111,148,112,142,152,114,115,27,151,76,77,79,118,80,34,124,127],arrai:[97,89,149,29],zab:128,housekeep:34,yourself:[140,0,89,128,49,133,44,106,144],tag_open:150,fast:[145,44,67,91,18,106],oppos:[33,80,29],additionali:106,fiji:93,ruri_to_assoc:[153,29],"__construct":[0,79,128,29,21,104,125,113,9,106,131],size:[145,148,133,99,29,54,80,153,117,131,6,155,142,94,51,127],truncate_t:29,file_exceeds_form_limit:29,twofish:80,silent:[33,29],convent:29,gif:[54,44,131],w43l:29,associ:[0,133,80,19,77,152,29,33,56,34,82,48,83,92,6,132,108,148,94,76,89],fmt:93,malform:29,assort:29,max_length:[48,51,150],utliz:152,circl:6,where_in:[152,29],white:[148,29],conveni:[44,88,30,45,33,117,143,109],my_foo:67,get_package_path:111,especi:106,programat:49,copi:[80,122,7,144,9,98,120,54,138,139,102,103,104,105,57,58,59,60,61,62,123,15,72,73,74,75,78,29,30,31,32,33,95,35,36,37,38,39,121,17,40,68,157,126,156,16,158],"_ci_":29,specifi:[140,0,100,5,101,7,133,131,132,49,93,94,51,96,97,99,137,54,138,89,56,6,145,58,106,108,79,63,19,150,67,111,148,151,112,25,152,115,149,27,23,76,77,29,117,80,82,83,109,127],oci_execut:29,cfb8:80,xhtml11:6,"short":[144,29],enclos:[152,29],mostli:[76,95],full_tag_open:63,necessarili:106,alnum:138,"_compile_queri":29,png:[54,117,131,82,29],imagecr:29,serv:[0,80,99,65,66,100,29,46,34,128,136,109,79],wide:[84,80,109],ciphertext:80,client_nam:131,instanc:[140,89,128,101,34,131,132,9,51,99,138,100,56,104,63,19,111,112,149,150,23,152,77,29,80,47,125,127],form_item_id:86,sha512:80,didn:[145,106,33,29],posix:29,param2:2,param1:2,were:[29,44,80,99,0,6,142,33,143,102,103,88,57,106,94,105,134,59,85],posit:[150,99,77,29,54,67,89,56,25],get_csrf_hash:[102,143],zsh:29,typographi:[90,29],seri:[116,44,29],pre:[99,29,20,100,47,133,51,109],lowest:[23,46],sai:[140,0,2,29,54,79,101,34,80,128,82,112,106,133,51,142,135],explode_nam:29,upload_success:131,xml_from_result:[76,29],"_prep_q_encod":29,delim:76,ani:[86,0,2,5,128,158,46,48,94,132,49,93,9,98,12,108,138,13,101,84,57,18,142,15,16,17,58,145,116,144,73,148,75,113,149,72,27,74,28,152,29,117,81,34,82,37,38,39,55,40,125,126,156,157,89],month_typ:19,dash:[1,29,101,82,41,142],db2:149,doctyp:[6,29],suhosin:[108,29],post_model:145,ssl_ca:97,num_field:[56,34],seppo:29,page1:152,"_env":29,caus:[44,23,12,29,128,101,33,46,14,89,94,131,132,110,9,106,115,150],"_create_databas":[104,29],engin:[72,5,77,65,118,33,29,82,154,49,106],techniqu:[142,80,143],advic:142,greek:29,destroi:[133,109,112,29],"_pi":29,note:[152,77,29,56,49,114,149,144],date_rfc2822:93,ideal:51,jefferson:145,take:[117,0,1,55,49,89,128,101,122,120,95,132,82,93,9,51,153,60,68,99,59,13,56,102,103,104,105,57,58,141,106,15,16,17,62,145,123,124,111,22,126,148,112,149,72,73,74,75,77,29,30,31,32,33,34,35,36,37,38,39,121,61,40,41,109,156,157,158,127],advis:[106,80,49,82,71],interior:128,green:[51,6,151,127],bcrypt:142,noth:[63,140,23,150,21,95,69,57,106,51],getwher:[104,152,29],error_messages_lang:140,realpath:29,begin:[64,55,152,29,128,138,13,18,51,43],sure:[0,12,5,128,79,56,152,102,57,113,9,142,144],incorpor:[66,140],trace:29,normal:[0,55,44,101,7,9,125,93,50,51,136,54,138,100,56,139,18,109,63,146,66,113,150,23,152,29,153,154],"_update_batch":29,mydata2:115,price:[133,134],group_on:149,use_global_url_suffix:[63,29],clearer:144,default_domain:[30,33],"_assign_to_config":29,abus:29,sublicens:78,pair:[63,19,29,33,56,89,152,42],seeksegmenttim:29,henc:33,hotfix:144,get_total_dai:[19,29],fetch_class:29,icon:[6,82],exact:[51,33,150],image_res:54,view_fil:29,synonym:[5,134],textarea:[94,13,22,29],view_fold:[55,95,29],later:[139,88,152,33,21,22,95,103,106],option_valu:133,escape_like_str:[89,49,29],rotation_angl:54,runtim:128,pattern:[152,29,66,139,101,8,91,142,114],addit:[86,5,33,44,128,101,46,133,94,51,134,96,99,54,13,56,14,140,103,106,145,19,23,77,29,100,80,55,42],mb_strpo:25,axi:54,salt:[25,80],sess_expir:[106,33],gracefulli:149,shop:52,shot:[133,109],signoff:144,uncondit:29,show:[0,152,29,110,13,46,49,93,94,42,114],german:140,pconnect:[97,79,149,29],hmac:29,crime_is_up:153,concurr:33,shoe:[72,0,153,5],permiss:[151,78,54,131,117,39,18,50,106],hack:[83,132,109,70,29],threshold:[39,46,29],pull:[6,144,137,93,29],line:[97,76,29,152,154,12,149,144],fifth:133,help:[44,55,128,46,34,48,49,93,51,96,150,99,13,139,104,6,142,143,144,63,20,66,88,116,27,23,76,77,29,81,47,82,153,84,155],exit_user_input:116,userdata:[106,33,29],onli:[140,0,13,44,128,101,46,7,89,94,92,132,49,93,53,9,51,134,131,96,11,99,54,138,55,56,145,6,57,18,129,106,135,143,108,58,63,146,133,144,20,67,97,21,22,69,148,151,80,112,142,25,152,71,150,23,76,77,149,29,117,100,33,81,34,82,124,118,125,42,109,65,127],snack:132,ratio:54,favor:[145,70,85,29],romanian:29,transact:[91,89,29],ini_get:[128,29],xma:133,next_tag_clos:63,black:148,datestr:93,mydata1:115,filectim:29,first:[0,2,5,6,7,9,12,13,15,16,17,126,19,23,25,27,88,29,30,31,32,33,95,35,36,37,38,39,40,42,46,34,51,56,57,18,59,60,61,62,65,72,73,74,75,76,77,79,82,83,84,140,89,92,93,94,98,101,102,103,104,105,108,109,111,120,121,122,123,68,128,125,133,138,58,142,144,147,148,149,150,151,152,156,157,158],overwritten:[131,33,29],query2:56,over:[44,19,64,54,29,101,21,82,89,128,6,93,94,99,108],mypic:[54,131],nearli:[54,82,133,113,9,85],variou:[27,19,29,131,40,51,115,96],get:[0,33,89,101,46,80,91,92,132,133,51,52,55,56,104,57,58,142,67,114,23,152,79,29,34,49,84],sst:29,imagecreatetruecolor:29,sss:81,secondari:49,ssl:[23,151,108,29],cannot:[29,27,97,77,89,110,80,49,116,106,43,144],mypic_thumb:54,neither:[54,80],requir:[97,12,77,29,56,83,152,114,149,144],truli:134,reveal:[69,44],item_nam:7,output_compress:29,outperform:106,borrow:130,email:[11,29,56,83,9,114,107],todo_list:[99,137],twelv:127,euro:93,default_control:[0,101,29],ini:[150,29,128,110,154,131,106],ci_cach:67,ent_compat:143,where:[0,89,128,132,93,9,97,137,56,14,18,107,108,144,150,148,25,149,72,27,28,152,29,79,34,49,83],summari:[9,44],wiki:[141,8],msdownload:29,a_long_link_that_should_not_be_wrap:23,smiley_j:[13,29],marquesa:93,password_get_info:25,send_email:[129,33,29],smiley_t:13,"_display_cach":[132,29],my_input:113,calendar:[52,104,29],another_method:28,element_path:44,concern:[133,106,33,143],infinit:29,detect:[80,3,29,30,100,33,82,89,54,131,88,25,143,96],"_base_class":29,controller_trigg:[72,5],review:33,auto_head:29,ubiquit:106,label:[86,51,77,94,29],db_pconnect:[89,29],behind:[54,26],between:[2,128,9,51,134,97,12,54,138,101,14,18,142,108,66,115,23,152,29,118,41,42],my_app:111,"import":[80,8,154,57,112,142,9,106,134],paramet:[2,144,34,29],across:[33,14,80],dir_read_mod:116,assumpt:53,"_clean_input_kei":29,aleutian:93,august:29,parent:[0,28,79,29,113,9],sku_567zyx:133,cycl:[138,23,18],"_is_ascii":29,reorgan:29,set_content_typ:[100,29],blog_nam:[77,124],come:[140,44,139,29,45,67,33,101,14,7,91,142,131,118,106,134,143,109],sess_upd:29,repertoir:44,fit:78,rsa:29,file_read_mod:116,controller_info:84,pertain:34,strict_trans_t:29,groupbi:[104,152,29],contract:78,inconsist:29,open_basedir:117,improv:29,log_threshold:29,create_link:[63,29],cal_cell_end_todai:19,undocu:33,item3:106,frameset:6,color:[145,148,133,150,29,54,33,153,94,6,9,51,127],colspan:[133,19,127],set_data:[51,29],period:[99,29,20,131,93,133,142,109],pop:82,photo2:23,photo3:23,exploit:[143,29],up13:93,colon:[97,29,154,142,133,106],example_t:49,exclud:[115,5,23,100,117],cancel:[152,99],up14:93,consider:[54,29],exclam:[49,89],returned_email:23,damag:[80,78],needlessli:29,"_remove_url_suffix":29,semicolon:[154,143,29],coupl:[53,99,65,29,113,9,51],dynamic_output:54,west:93,rebuild:29,fopen_read:116,mari:127,mark:[29,150,89,33,49,103,84,108,94,106,42,65],locpath:151,individu:[76,77,29,67,34,114],certifi:[10,144],trig:29,thead:127,ci_sha:29,short_open_tag:128,repons:[108,124],decrypt:[142,112],thousand:29,georgia:93,rubi:130,get_id:124,proven:[142,33,80],"_drop_databas":[104,29],thing:[100,128,8,50,51,139,14,142,143,144,19,67,111,22,21,106,152,77,29,33,81,82],repres:[63,5,29,54,33,56,21,66,124,25],former:29,those:[140,5,33,128,7,142,133,51,96,99,54,138,100,101,139,102,106,79,63,20,113,77,29,80,34,144,127],sound:144,blowfish:80,mysecretkei:111,amend:29,rtype:81,singleton:111,wm_shadow_color:[54,29],cast:[128,80,29],netpbm:[54,69,29],is_robot:[96,29],base64:[51,80,99,142],outcom:152,send_success:124,bufferedtext:128,margin:[94,134],show_next_prev:19,use_sect:[111,7],assoc_to_uri:153,glanc:52,advantag:[77,128,8,94,112,141,9,106,108,109],protect_identifi:[89,49,29],cache_item_id:67,up9:93,destin:[54,131,151,101],prev_tag_open:63,or_hav:[152,29],list_databas:[76,29],my_dog_spot:41,eras:106,img_width:148,hash:29,blog_id:[88,77],ascii:[150,151,29,148,124,108],ship:133,subtot:133,par:29,ci_image_lib:[54,29],xml_encod:128,author:[97,78,29,128,49,133],obfusc:82,alphabet:51,intermediari:66,same:[0,2,152,10,149,29,56,50,27,9,144,77],jsmith:99,binari:[151,29,115,80,25,143],html:[5,11,137,29,81,46,93,94,142,108],pad:[54,80,29],file_4:138,raw_output:25,pai:29,document:29,form_fieldset:[94,29],status:29,php_sapi_nam:29,screenshot:144,utf8:[97,126,77,149,113],nest:[152,79,12,111,29],assist:[86,27,1,150,148,29,117,46,81,11,82,138,92,6,145,129,94,142],driver:[97,2,34,149,29],someon:[23,80,148,58,112,133,51],modify_column:[77,29],companion:150,driven:144,capabl:[5,53,29],my_sess:111,mani:[97,12,77,138,34,49,130,6,50,142,144],extern:[128,106,143,29],encrypt:[52,97,70,29,138,55,142],rewriterul:5,return_object:89,sanitize_filenam:[143,70,29],"_ci":29,appropri:[63,10,139,99,29,128,80,46,152,89,83,155,106],new_entri:99,mcrypt_blowfish:112,markup:[44,131,6],page:[152,29,34,114,149,144],custom_row_object:56,without:[140,0,2,44,128,46,7,9,131,94,132,49,93,50,51,12,54,100,56,106,59,109,110,67,21,111,148,112,142,27,28,152,77,78,29,80,82,84,124,125,42,144],compression_level:115,titl:[13,131,82,51,99,137,138,139,56,6,143,145,21,22,114,152,29,118,79,81,49,124,127],index_kei:25,model:[29,45,50,24,9,125,144,135],get_content_typ:[100,29],dimension:[97,137,29,118,6,132,133,127],insert_batch:[152,29],keyup:44,execut:[89,77,29],among:[133,106,96,29],rule3:51,rule2:51,rule1:51,allowed_typ:[131,29],directory_separ:[95,29],gd_load:29,"_post":[29,145,79,128,33,148,84,94,142],"_get_config":29,kill:29,cambodia:93,aspect:[54,19,29],touch:106,monei:145,less_than:[51,29],speed:[44,18,106,29],filter_var:[129,33,29],product_lookup_by_id:101,versu:128,is_cal:[51,29],fh4kdkkkaoe30njgoe92rkdkkobec333:133,except:[5,128,56,7,9,92,93,94,51,54,138,101,104,106,20,67,113,152,77,29,118,33,47,82,153,37,154,42,85,127],param:[29,0,80,76,44,128,33,81,106,111,132,99,9,51,63,127],desktop:[115,99,76,147],non_existent_fil:110,my_shap:145,blob:[106,33],versa:54,constant:[108,29],mb_convert_encod:29,process_:0,word_censor:[150,29],earli:132,gd2:54,hover:44,around:[29,89,128,67,13,49,94,51],code:[144,149,29],read:[139,89,128,8,51,134,79,137,55,104,141,106,107,108,109,64,147,111,22,151,4,142,114,115,27,28,152,29,117,33,34,49,84,42,156],escape_str:[89,49,29],messsag:23,"_convert_text":128,is_allowed_filetyp:29,grid:[148,29],darn:150,mom:[99,137],world:29,js_insert_smilei:[33,29],"_write_cach":0,blackberri:29,whitespac:29,some_funct:[94,2],changelog:[144,29],preg_replace_ev:29,integ:[146,11,152,77,29,54,56,83,128,106,51],server:[97,76,29,89,46,34,14,154,18,149,108,135],set_status_head:[116,100,108,29],benefit:[28,12,128,152,49,93,94,51],photo1:23,either:[44,80,128,131,2,93,51,94,105,99,54,101,104,6,106,143,79,63,146,20,112,152,149,23,76,29,33,34,82,144],cascad:29,output:[76,77,29,49,50,18,25,83],tower:144,nice:[51,22,150],json_unescaped_slash:100,yyyi:93,what:[97,144,34,49,29],affected_row:[83,114,152,29],method_exist:0,juli:29,blog_label:77,http_header:84,authent:29,word_wrap:[150,29],error_db:[72,89],set_new:22,first_row:56,bigger:148,form_help:37,slice:6,caribbean:93,mood:6,easili:[5,100,152,80,21,104,125,112,134],deliveri:[127,29],kml:29,definit:[77,29,33,81,94,125,9],token:[128,100,143,29],protocol:[23,3,65,138,29,82,69,151,106,109],ac3:29,exit:[88,29,128,100,46,9],inject:[131,29],xtea:80,"_parse_cli_arg":29,apostroph:20,complic:106,overli:[128,34,29],exp_pre_email_address:128,refer:29,get_last_ten_entri:79,mailto:82,total_item:[133,29],shadow:54,power:[44,139,22],pdo_sqlit:29,garbag:106,inspect:133,ci_load:[111,29],max_height:131,broken:[142,23,28,29],apantbyigi1bpvxztjgcsag8gzl8pdwwa84:112,fopen_read_write_cr:116,found:[140,0,88,45,46,7,92,132,93,138,100,101,139,106,108,109,67,111,28,142,25,80,23,76,29,33,153,155,124,144,158],mime_content_typ:29,thailand:93,referr:96,appli:[29,144,89,54,33,101,128,92,106,51,127,142,109],"throw":29,earlier:[139,152,137,124,21,22,106,51],callback_:51,comparison:[128,146,152,29],central:93,greatli:12,discern:[131,29],island:93,previous_row:56,request_filenam:5,exit__auto_max:[116,46],greater:[1,75,128,93,51,108],mcrypt_dev_urandom:[25,80],is_numer:[142,146,29],degre:[54,118,53],intens:[117,47,34],phpdomain:81,reset_queri:[152,29],table_nam:[76,77,89,33,56,49,48,83,114],slash_rseg:153,luck:145,backup:29,processor:47,routin:[27,53,76,29,34,131,142,51],effici:[96,29],max_siz:131,status_cod:46,coupon:133,lastli:[81,153,3,34,99],image_width:131,date_rang:[93,29],quietli:128,super_class_vers:128,strip:[150,23,70,29,138,22,142,124,51],your:[144,29],clipperton:93,call_user_func_arrai:0,unit_test_lang:37,wm_font_path:54,"_detect_uri":29,area:[54,13,101],met_win_open:82,odbc_num_row:29,"_explode_seg":29,overwrit:[131,7,29],xw82g9q3r495893iajdh473990rikw23:133,ci_unit_test:146,strict:[97,89,29],pre_system:132,interfac:[152,29,54,46,50,106,134,85,109],low:[128,150,33,80,29],mbstring:[25,29],ipv6:[51,109,121,29],submiss:[128,148,93,142,51,143],strictli:117,filter_uri:29,lang:[86,116,140,29,128,33,111,7,51,96],up10:93,programmat:[27,33,88,29],str_replac:128,bsc:118,enough:[145,51,80,142],conclud:106,bundl:[106,81],designfellow:29,"_session":[106,33,29],mb_strlen:[25,29],procedur:[51,27,132,46,29],cubrid_affected_row:29,cryptograph:[33,143,112,80],openxml:29,conclus:52,sess_expire_on_clos:[106,33,29],orlik:[104,152,29],notat:[54,117,29],mathml:6,possibl:[80,128,125,133,135,53,54,100,101,139,104,58,141,142,144,63,111,21,112,113,152,28,76,29,118,33,34,55,156],"default":[97,12,77,29,56,152,83,76,149,144],error_prefix:[51,29],delete_fil:[117,151,29],lowercas:[29,79,128,33,82,22,112,109],eschew:85,grasp:81,my_calendar:111,embed:[137,29],deadlock:[106,29],remove_spac:131,up12:93,connect:[97,2,29],cbc:[80,29],creat:[10,144,34,149,29],multibyt:29,certain:[72,0,97,33,152,44,45,29,81,34,5,25,142,144],tahiti:93,site_id:77,valid_usernam:51,mode:[97,89,29],strongli:[95,33,58,71],undergon:29,print_debugg:[23,29],file:[10,144,29],next_url:19,fill:[51,29],incorrect:[94,128,80,111,29],again:[44,80,139,111,51,106,144],image_typ:131,googl:[146,29],hex:[54,80,70,29],collector:106,bhutan:93,conn_id:[2,34,29],prepend:[152,29,80,111,49,153,92,51,109],field:[97,89,29],valid:[0,97,12,29,101,25,107],collis:[140,29,67,33,111,7,109],rdbm:29,is_unix:93,no_file_typ:29,writabl:[29,117,46,34,148,39,18,131,115,108],you:[0,2,3,4,5,6,7,8,9,11,12,13,14,15,16,17,18,19,20,21,22,28,25,27,88,29,30,31,32,33,95,35,36,37,38,39,40,41,42,44,45,46,34,48,50,51,53,54,55,56,23,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,79,80,81,82,83,84,85,140,89,92,93,94,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,49,120,121,122,123,124,125,126,127,128,47,131,132,133,134,135,137,138,139,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158],mcrypt_create_iv:[25,143],architectur:[52,87],poor:69,create_kei:[80,29],sequenc:[97,88,29,80,83,6],symbol:[117,110,29],pear:[85,29],multidimension:[94,51,6],track:[46,88,12,106,29],dropbox:144,rsegment:[33,153,29],localhost1:97,typecast:29,regex_match:51,deliber:112,ci_zip:115,segment_two:89,ci_model:[104,79,21,29],redud:33,cookie_domain:[106,3],wm_use_drop_shadow:29,descript:[97,144],session_id:[106,33,29],smtp_user:23,mimic:20,mass:104,potenti:[142,1,28,71,29],up115:93,escap:[83,114,89,29],w3c:[6,93,29],dst:93,unset:[106,33,142,29],is_uniqu:[51,29],disp:23,file_upload:11,all:[10,144,29],db_backup_filenam:76,new_field:33,filename_pi:104,lack:[106,33],dollar:[101,29],month:[128,93,29],new_list:127,atlant:93,correl:[132,18],mp3:29,microtim:148,wm_type:54,follow:[0,1,3,5,7,9,11,12,13,58,20,21,22,23,25,26,27,28,29,33,34,40,41,42,44,45,46,47,48,50,51,53,54,56,57,18,63,64,67,70,72,73,74,75,76,77,78,79,80,81,82,84,86,88,92,93,94,96,97,98,99,100,101,103,104,6,106,107,109,110,111,113,114,116,117,49,124,125,126,128,129,131,132,136,137,138,139,140,142,143,145,146,147,148,149,150,152,155],alt:[6,23,29],disk:[54,67,80],children:29,abid:55,library_path:54,content:29,iconv:[25,29],number:[89,128,56,90,92,93,97,101,84,6,18,142,108,145,148,25,28,152,77,29,83,154],get_file_info:[117,29],script_nam:29,sess_regenerate_destroi:106,wmv:29,spirit:29,mistakenli:29,init:[72,73,74,75,3,29,98,58],program:[80,71],spearhead:130,queri:[2,34,29],read_dir:[115,29],max_filename_incr:[131,29],cgi:29,db_backup:29,adapt:[67,152,89],"case":[140,0,87,80,5,128,101,9,131,125,94,51,97,12,54,55,56,129,106,143,107,108,109,133,152,150,67,111,22,112,113,99,118,27,151,76,77,29,30,100,33,82,117,41,142,158],liter:[94,142,146,101,29],straightforward:106,ingredi:80,fals:[27,97,108,12,77,29,56,79,46,152,49,48,84,81,101,25,76,89,149],passconf:51,keydown:44,get_new:21,verb:29,mechan:[146,80,77,29,33,132,112,106],verd:93,failur:[140,89,128,7,131,93,133,51,12,54,56,151,106,143,145,152,67,111,88,25,99,115,23,76,77,29,117,80,81,49,153,124,127],veri:[145,128,91,92,132,49,9,51,134,96,53,12,54,139,151,57,106,63,19,111,69,88,152,72,23,76,118,34,82,42],get_clickable_smilei:13,condition:[54,23,99],subsubsubsubsect:81,mysql_set_charset:29,norfolk:93,"_filter_uri":29,my_array_help:27,tag_clos:150,last_nam:99,e_strict:29,emul:[0,106,29],small:[64,53,23,29,128,80,83,94,134,85,127],require_onc:72,e_notic:29,dimens:54,trans_strict:[12,89],getimages:29,samoa:93,ten:127,"__get":[106,56,29],my_blog:99,product_lookup:101,sync:29,past:[33,93,80],zero:[138,80,46,34,153,39,131,106,133,51,85,109],postgr:[83,97,71,29],db_conn:111,pass:[89,144,149,29],overlin:81,further:[0,53,100,64,29,34,6,124,25,106,149],nba:51,log_file_permiss:29,directory_depth:11,list_field:[48,89,56,29],trick:[106,142,29],server_path:117,sub:[81,34,29],trans_rollback:[12,29],sun:[19,93],section:29,abl:[44,29,128,101,80,56,8,129,84,124,9,51,108],brief:[131,80],ci_encrypt:[80,112],delet:[77,89,29,34,49,83],abbrevi:[54,140,19],last_login:56,primary_kei:48,intersect:29,is_bool:146,some_method:[0,28,76,77,81,9],ci_migr:[88,29],"public":[0,80,128,9,131,125,50,51,10,97,99,137,13,56,139,6,106,79,21,22,113,88,152,29,33,55,144,43],contrast:[134,12],millisecond:44,full:[140,0,55,44,128,8,91,131,9,134,96,97,70,54,100,104,6,142,135,108,63,146,152,69,99,114,76,29,117,118,34,82,153,42,127],iran:93,agent_str:96,pacif:93,variat:[56,29],where_not_in:[152,29],misspel:29,decid:[109,80,99,29],behaviour:[23,33,29],coco:93,shouldn:[106,33,7],username_check:51,imap_8bit:29,is_allowed_typ:29,is_object:[146,29],ci_pagin:63,method:[89,144,77,149,29],strong:[150,80,29,33,133,142,127],modifi:[10,89,29],preserve_filepath:115,valu:[144,29],leav:[146,23,70,29,54,80,22,82,128,105,132,58,142,51],min_length:51,valid_ip:[51,109,29],ahead:56,server_info:29,popen:29,observ:29,prior:[88,29,131,75,132,112],amount:[12,54,100,152,84,18,133,51,42,134,85],pick:128,action:[44,133,152,78,0,54,101,29,81,48,94,131,105,132,50,51,143],another_t:34,narrow:142,detectifi:29,diamet:145,hash_algo:70,display_error:[89,29],gost:80,intermedi:8,screeni:82,africa:93,example_librari:9,hash_hmac:80,remap:29,filenam:[140,27,23,70,147,29,54,143,33,128,131,7,117,39,88,132,113,9,76,115],href:[19,29,118,21,82,6],famili:80,um45:93,demonstr:[150,23,13,22,131,6,115],decrement:[67,19,29],"_start":42,establish:[149,89],trans_off:[12,89],select:[89,29,34,49,48,83,114],metaweblog:99,test_nam:146,ci_env:[14,29],hexadecim:[25,80],internation:29,faint:54,two:[0,80,101,46,7,34,48,9,94,51,135,12,138,56,142,144,133,148,112,113,149,72,27,23,152,29,33,47,84,42],page_titl:137,fopen_read_writ:116,autonom:[53,89],res_datatyp:146,taken:[88,43,29],select_max:[152,29],suppor:29,"_object_to_arrai":29,minor:29,more:[86,0,80,5,128,101,46,122,8,94,132,93,50,51,134,53,12,79,137,54,138,55,56,14,103,104,105,156,129,106,6,34,145,64,133,19,150,66,67,97,22,111,69,99,25,70,149,27,139,23,152,29,30,100,33,47,82,39,121,108,124,42,142],emoticon:13,flaw:[142,29],desir:[86,140,88,152,149,29,128,20,13,56,14,131,151,142,135,85,127],create_thumb:54,hundr:[96,29],mozilla:96,relative_path:143,photoblog:99,flag:[146,152,77,89,29,142,144],driver_name_subclass_2:87,driver_name_subclass_3:87,broke:[144,29],driver_name_subclass_1:87,known:[152,29,33,142,113,25,106,96],mathml1:6,mathml2:6,trans_statu:[89,12,29],cach:29,fopen_write_create_strict:116,"_stringify_attribut":116,town:77,none:[23,19,29,54,89,142,131,88,106,25,76],endpoint:143,suitabl:[128,138,33,70],hour:[106,93,148],hous:[99,137],list_tabl:[48,89,29],der:29,outlin:112,dev:[25,128,33,143,80],detect_mim:131,orderbi:[104,152,29],remain:[148,34,18,22,29],paragraph:[51,1,29],nine:127,caveat:106,learn:[12,55,101,111,7,141,106,134,85],group_end:152,male:153,explod:128,typograph:47,subclass_prefix:[9,27,39,113],scan:29,up875:93,challeng:134,server_protocol:109,share:[97,19,29,34,106,3,135],"404_overrid":[101,29],templat:[72,52,89,29,46,154,85],sphere:6,minimum:[63,51,131,152],unreli:[108,29],set_row:56,phrase:150,blog_head:118,ci_upload:[131,29],uncheck:29,cours:[80,33,101,112,106,94,51,134],newlin:[23,76,29,128,138,20,47,6,51,109],first_nam:[51,99],secur:29,rather:[140,5,89,9,94,51,134,53,12,137,101,103,144,146,97,111,149,77,29,118,33,95,49,109],anoth:[0,23,12,77,152,29,33,106,7,111,154,142,131,125,76,99,51,96,115,80],smtp_port:23,perhap:[9,27,113,106,51],fame:106,narrowli:53,some_cooki:109,url_titl:[82,29],unabl:[117,124],"_unseri":29,reject:53,iso:[23,93],csv:29,simpl:[0,33,5,46,91,94,50,51,134,97,99,137,6,106,63,146,19,150,88,112,27,23,152,29,118,80,81,82,124,44,85],needl:[25,27],css:[44,100,150,33,82,6,93,142],"_thumb":54,convert_accented_charact:[150,29],regener:[106,143,29],plant:99,sandwich:93,resourc:[97,12,89,29,56,34,49,125,152],indian:93,whats_wrong_with_css:82,smiley_view:13,show_404:[116,0,29,46,139,101,21,158],variant:140,invok:[72,5,53,28,132,113,51,42,107,109],reflect:[42,29],catalog:101,buffer:[128,23,57,29],mutat:29,subdriv:29,unlink:29,lanka:93,circumst:[100,29],github:144,product_typ:101,system_path:55,footer:[66,139,21,22,137],onto:100,overnight:127,in_particular:128,callback:29,image_height:131,yyyymmddhhiiss:88,hash_equ:[25,29],media:6,stricton:[97,29],set_hash:29,cal_cell_start_oth:19,judg:69,checkbox:[94,51,144,29],rotat:[54,69,29],no_result:153,migration_vers:88,azerbaijan:93,file_s:131,cook:93,through:[0,28,19,29,138,64,33,56,21,111,92,106,94,99,134,127,143,108,109],reconnect:29,hierarchi:[81,137],fff:54,helo:29,password_hash:25,orig_path_info:29,style:29,config_item:[116,33,108,29],ip_address:[29,33,148,121,124,106,109],border:[146,19,29,148,133,127],end_char:[150,124],dbname:[97,149,29],resort:106,bypass:136,number_lang:155,delici:3,might:[140,0,80,5,101,46,8,92,132,51,97,99,137,54,13,56,139,18,106,108,79,146,144,65,21,22,111,148,150,23,76,29,117,33,154,109,156,127],alter:[88,77,29,156,33,103,151,121,113,106,143],wouldn:29,ci_db_result:[152,56,89],"return":[0,87,89,101,46,48,9,125,50,56,108,25,152,114,149,27,76,77,29,79,81,49,83],prev_tag_clos:63,than:[86,0,1,80,5,128,101,46,95,9,132,49,94,135,97,12,137,56,103,142,108,144,133,150,112,149,27,152,77,29,33,34,82,85],accept_charset:[96,29],file_5:138,sentenc:20,pollut:29,file_1:138,sess_use_databas:33,ff0:[150,33],ssss:81,framework:[9,130,113,29],cer:29,compound:[152,29],timezone_menu:[93,29],custom_result_object:56,parenthesi:[128,152,29],"_helper":111,redesign:29,table_data:127,set_mod:112,cubrid:[33,71,29],troubleshoot:52,my_cach:67,userid:99,gmt_to_loc:93,refresh:[18,82,29],micro:148,achiev:[0,33,56,18,106],alreadi:[140,44,80,48,51,100,56,106,144,146,111,88,152,115,118,23,76,77,29,31,33,124],innodb:[12,77],sha384:80,is_fals:146,fulli:[11,29,128,55,132,58,18],intervent:[100,112],backtrac:29,errata:29,truncat:[150,152,29],week:[19,93],do_upload:[131,29],weight:106,needless:29,korea:93,hard:[29,54,80,95,94,106],addressbook:134,ci_session_dummy_driv:106,crontab:29,realli:[80,12,29,33,34,82,69,49,142,106,134,108,144],playstat:29,finish:[133,151,111],next_tag_open:63,expect:[64,76,29,128,118,139,46,106,146,8,142,131,105,124,9,99,153,143,144],fist:29,todd:152,attachment_cid:[23,29],http:[0,84,46,108,29],db_forg:29,beyond:[53,152],todo:[154,137],orient:27,some_valu:106,ftp:[128,52,29],vladivostok:93,safeti:106,or_lik:[152,29],miss:[97,29,128,82,148,71],nepal:93,form_fieldset_clos:[94,29],publish:[99,78],thirdparamet:93,send_error:124,health:46,add_kei:[88,77,29],print:[150,23,152,29,110,82,154,6,41,50],dir_write_mod:[116,29],bui:133,subsubsect:81,occurr:138,w3school:82,file_nam:[51,131,111,137,29],textil:81,asp:82,proxi:[99,29],mylibrari:33,advanc:[128,64,33,29],create_captcha:148,random_byt:29,samara:93,differ:[140,2,128,7,93,133,51,134,96,10,99,54,101,14,106,135,79,63,146,19,21,22,111,151,115,80,23,152,149,29,31,33,82,42,156,127],asc:152,quick:144,reason:[63,0,97,80,99,152,29,128,138,33,34,49,111,133,57,124,50,106,142,144],base:[5,2,89,50,132,93,94,10,12,138,55,14,6,144,130,147,33,113,152,114,72,76,77,29,30,79,34,82,117,155,43],believ:106,sku_123abc:133,ask:[144,29],teach:64,phd:118,basi:[18,29],thrown:[67,29],"_blank":82,omit:[76,152,29,128,33,106,124,133,19],success:[23,12,77,29,117,81,67,89,56,152,7,49,133,76],caption:[127,29],golli:150,get_config:[116,29],csr:29,threat:143,"_error_handl":[116,29],cache_query_str:29,undergo:29,file_writ:29,assign:[140,27,139,23,76,77,137,29,79,56,21,7,111,152,131,125,49,9,106,42,80],feed:[6,49,29],major:[54,152,81],notifi:23,obviou:[50,144],row_arrai:[114,56,21],feel:[118,104,141],articl:[5,19,89,21,82,50,106,134],lastnam:[118,99],ci_db:111,mod_mim:131,placehold:101,footprint:[53,85],cell_end:127,done:[140,0,139,55,99,29,30,100,33,81,21,80,84,136,132,141,27,118,106,144,79],least:[29,80,106,142,51,108],directory_trigg:29,form_open_multipart:[94,131,29],stabl:[43,144],init_unit_test:73,file_parti:29,guess:[128,29],error_arrai:[51,29],script:[44,89,128,46,9,132,50,51,70,54,100,56,57,106,143,108,109,146,66,142,88,152,29,117,33,82,30,124],column_kei:25,interact:[50,80],gpg:29,yekaterinburg:93,construct:[63,64,29,133,125,9],tradition:12,header2:23,stori:106,underlin:81,order_bi:[152,29],accept:[44,80,89,128,56,93,94,51,96,97,99,138,139,101,105,106,143,108,109,19,148,142,23,152,77,29,118,33,82,124,6,144,127],cfg:29,dbdriver:[97,149,79],is_arrai:[128,27,146],scheme:[88,139,29],store:29,schema:[97,124,21,88,29],free:[128,106,56,78],adher:[128,85],statement:[152,77,89,29,49,154,76],ctype_digit:[142,29],blindli:29,compens:29,php_sapi:108,johndo:[94,51,106],count_all_result:[152,29],php_error:[46,29],apppath:[116,117,29],pars:[128,100,13,82,29],logged_in:[106,82],myclass:[63,86,152,128,132,9],grace:29,fred:[138,151,127],king:77,kind:[150,78,138,33,46,106],cookie_secur:[106,29],aac:29,abr:19,remot:[151,99,29],orhav:[104,29],remov:[152,77,29,14,18,142,108],migration_en:88,dtd:6,jqueri:29,reus:[106,152,21],pragma:[100,29],str:[1,89,128,94,51,70,138,13,143,108,146,20,41,25,150,23,29,47,82,153,83,124],consumpt:56,stale:104,toward:[54,106],beij:93,"_sanitize_glob":29,fixat:106,randomli:[142,148],cleaner:[134,29],comput:[50,152,99],mpeg3:29,deleg:139,strengthen:29,sssss:81,beforehand:29,favicon:6,packag:[128,103,55,29],is_support:[67,29],sport:51,expir:[29,100,34,148,92,18,106,109],mod_rewrit:5,reset_valid:[51,29],"null":[152,77,89,29,56,25,108],format_numb:133,query_build:[11,33,97,111],option:[0,5,128,101,46,94,132,93,9,154,97,12,137,89,56,14,6,18,110,79,84,113,25,152,149,72,150,75,76,77,29,117,33,81,82,39,155,126,156,85],sell:78,mountain:93,reset_data:152,nozero:138,"_prep_filenam":29,relationship:101,lib:29,remote_addr:106,replyto:23,self:[116,131,29],violat:29,troublesom:29,port:[97,23,99,29,67,151,106],undeclar:150,also:[117,0,55,44,128,101,46,122,80,95,89,50,92,94,5,49,93,75,9,51,96,154,97,98,12,137,138,13,56,14,140,151,144,143,57,58,139,106,15,16,17,109,63,133,123,152,66,84,67,68,21,111,126,28,142,25,99,115,72,73,74,23,76,77,29,30,100,33,81,34,82,153,37,38,39,108,40,124,132,88,43,131,127],useless:[83,84,33,95,29],elapsed_tim:[42,100,89],brace:[128,118,154,20],signup:51,vnd:29,file_typ:131,distribut:[97,78,29,111,106,43],backtrack_limit:29,victim:142,english:[140,150,3,29,37,51,96],reach:21,chart:52,font_siz:[148,29],most:[80,3,46,142,131,93,9,51,134,96,150,12,54,56,18,106,149,107,146,19,20,66,67,151,112,113,99,115,71,27,23,29,118,33,49,124,127],plai:69,protect_al:1,whether:[140,44,1,100,89,128,46,7,34,48,133,92,93,94,51,96,10,11,12,54,138,13,14,6,57,106,143,108,109,145,146,19,147,110,67,97,22,111,152,151,112,142,25,70,115,149,139,23,76,78,29,117,118,80,81,47,82,124,144,131],plan:144,myisam:12,last_act:[103,33,106,29],selector:44,my_const:128,charg:78,xlarg:94,tonga:93,x11r6:54,clear:[23,29,54,80,34,111,91,33,106,115,85,127],cover:[10,99,8],ci_db_forg:[77,111],roughli:112,"2nd":29,ext:[72,29],part:[140,10,1,23,99,27,54,64,29,101,152,117,128,112,113,25,106,144,115,150,127],clean:[99,137,29,67,33,70,144,143,109],enctyp:131,latest:[88,144,139,29],awesom:139,s_c_ver:128,mcrypt_mode_cfb:112,pdo_mysql:29,carefulli:[80,156,34,112],alphanumer:29,phooei:150,top_level_onli:[117,104],row_object:56,appver:29,session:[52,97,29,55,84,125,9,16,126],particularli:[12,29,139,101,47,111,134,143],worri:[80,46,93,144],exit_error:[116,46],font:[54,148,29],fine:[50,82],find:[140,0,45,46,7,131,134,96,12,101,57,106,79,145,65,66,99,27,29,118,80,34,154,124,144,156],impact:[104,80],cell:29,pretti:[33,95,109],url_help:[27,21],myutil:76,unattend:106,ruin:29,mypassword:[51,149,79],solut:[80,118,33,129,25,106,85],is_referr:[96,29],validate_url:[124,29],couldn:29,cursor:29,factor:[53,33,152,34],"_server":[29,30,33,14,106,109],next_row:[56,29],i_respond:99,charcter:80,unus:[106,29],albeit:145,ssl_verifi:97,amount_paid:152,express:[152,29],ffield_nam:29,blank:[23,76,29,54,132,111,82,128,57,58,51,109],nativ:[97,2,12,89,29,56,49,125,113,25,108],mainten:29,quotes_to_ent:[138,29],xss_clean:[92,70,104,29],liabl:78,post_controller_constructor:[132,29],banner:29,restart:29,set_capt:127,callback_foo:51,builder:29,repair_t:76,uri_seg:[63,29],date_cooki:93,crt:29,set_dbprefix:[152,49,29],whenev:[128,33,46,34,29],full_tag_clos:63,rfc:[23,93,80,29],common:[12,29],newest_first:133,greater_than:[51,29],empty_t:[152,29],delete_dir:[151,29],uri_to_assoc:[153,29],crl:29,arr:128,set:[97,12,77,29,89,56,34,49,83,152,114,149,144],blog_templ:118,php_eol:[50,109],backtrack:29,cookie_prefix:[106,92,3,109],vinc:145,utf8_en:[116,29],seg:153,simpler:[132,29],see:[44,80,0,128,101,113,7,34,9,131,5,93,50,51,97,12,137,100,56,14,104,58,141,129,106,59,108,109,19,150,67,21,22,111,148,99,70,114,149,27,139,152,77,29,117,33,81,47,82,39,125,142],sec:81,arg:[138,127],transpar:[54,100,29],reserv:29,horizont:54,flavor:[3,111],php:29,chose:[106,80,112],legend_text:94,simultan:149,mt_rand:138,inconveni:[13,33],someth:[0,55,133,131,132,93,9,51,96,97,99,137,100,101,14,57,106,109,63,111,148,115,72,151,152,118,81,82,124,144],strtolow:[101,29],particip:134,debat:29,imagejpeg:29,inner:[152,132,29],won:[23,152,80,100,33,56,34,82,84,125,101,106],migration_t:88,source_imag:54,mismatch:29,ssl_cipher:97,experi:[69,106],nope:112,compliment:114,altern:29,stored_procedur:29,prefix_singl:89,latin:[142,29],imagemagick:[54,69,29],numer:[11,88,19,29,117,138,33,101,152,133,155,93,142,25,51,109],all_userdata:29,this_string_is_entirely_too_long_and_might_break_my_design:150,javascript:[52,29,13,81,104,82,92,94,142,108],output_paramet:99,isol:29,call_hook:29,some_par:28,incident:33,"_create_t":29,raw_input_stream:[109,29],distinguish:128,slash_item:[33,7],date_lang:93,classnam:[44,39],struct:99,verbos:[128,14],water:99,last:[29,19,89,100,56,111,49,83,154,109],delimit:[23,76,29,33,101,82,131],is_write_typ:[89,29],hyperlink:82,is_natural_no_zero:51,event:[29,34,82,131,7,94,51,109],pg_exec:49,imageid:148,pdo:[97,29,56,83,149,71],add_suffix:140,context:[106,80],forgotten:142,mb_enabl:[25,116,29],pdf:[23,81,29],author_id:83,prng:29,whole:[10,33,56,80,29],wm_y_transp:54,load:[76,77,29,56,81,34,125,114,149],xspf:29,markdown:81,simpli:[140,0,80,44,129,46,7,133,131,132,49,9,51,134,135,12,137,54,138,139,103,106,109,63,146,152,111,151,113,99,115,72,27,23,76,29,118,33,34,82,39,124,125,42,144,127],cast5:80,point:[144,152,34,108,29],instanti:[0,53,99,89,29,56,132,106,125,149],schedul:[33,95],any_in_arrai:27,arbitrarili:51,header:[0,147,137,29,128,82,84,108],fashion:[64,80],littl:[118,146,156,34,124],total_rseg:153,linux:[50,106,96],mistak:[33,29],db_connect:[89,29],csrf_exclude_uri:[143,29],file_exist:139,backend:[67,3,29],expressionengin:[54,130,33],identif:29,unsuccess:12,user_id:152,devic:[128,96,29],create_t:[88,77,29],empti:[0,76,77,29,128,6,56,82,105,93,94,152],implicit:29,whom:78,secret:[142,80,112],comment_textarea_alia:13,wm_hor_align:54,your_lang:[155,93],cell_alt_start:127,devis:29,nonexist:29,invis:44,save_path:106,load_class:[116,29],valid_email:[129,51,33,29],imag:[52,23,70,29,13,131,7,148,104,6,82,142,51,156,157,158,149],array_replace_recurs:[25,29],restrictor:152,sess_save_path:[106,33,29],gap:88,phpdocument:29,coordin:54,understand:[10,12,58,141,99,106],file_write_mod:[116,29],func:[51,29],demand:[33,12],other_db:[76,77],vulner:[33,144,29],weekdai:19,include_bas:111,foreign_char:[150,104],ignit:29,look:[48,144,49,29],raw:[146,23,76,77,29,54,100,67,80,81,106,124,25,51],localhost2:97,bill:138,histor:[138,33,80],cluster:[34,112],"_has_oper":29,"while":[80,128,101,46,133,51,11,99,54,56,14,141,106,109,97,88,149,150,23,152,29,117,33,81,154,43],unifi:29,smart:12,abov:[0,55,5,101,7,94,131,132,49,93,9,51,97,150,99,137,54,138,13,56,154,6,145,18,106,149,79,63,146,133,19,144,20,67,21,22,111,126,80,112,113,152,114,115,71,27,23,76,77,78,29,117,118,33,82,83,84,124,44,125,42,109,127],checksum:29,anonym:[51,29],ci_output:100,loop:[128,56,29],javascript_ajax_img:44,subsect:81,real:[23,99,137,29,81,130,42],pound:150,uri_str:[84,153,82,29],nl2br_except_pr:[47,20],readi:[29,54,13,111,141,114],member_ag:152,"3g2":29,pakistan:93,last_link:[63,29],jpg:[150,23,147,54,100,148,131,6,115],password_default:25,itself:[152,29,128,46,80,56,95,106,51,134,158,144],rid:104,saferplu:80,recompil:115,row_alt_start:127,form_checkbox:[94,29],shirt:[94,133,101],grant:78,limit_charact:124,msexcel:29,belong:33,myconst:128,up95:93,shorter:[51,33],redisplai:51,decod:[29,80,47,104,112,142,143],onclick:94,octal:[54,117,151],date_rfc1036:93,blogview:137,conflict:[88,7,29],bom:128,parse_templ:19,archiv:[33,115,21,29],imagin:139,optim:[34,29],"3gp":29,defeat:6,ssl_kei:97,piec:[99,67,80,21,112,124,106],moment:[42,12],strength:104,mousedown:44,user:[128,101,46,49,93,9,97,13,56,18,142,107,145,148,113,25,28,76,77,29,117,81,34,82,154],"_exception_handl":[116,29],extrem:[69,104,134],repopul:[51,29],robust:[129,23],wherev:18,new_data:112,transitori:112,cilex:81,recreat:[151,115],subpackag:128,travers:[143,11,70],task:[50,27,134,85,106],unicod:[128,29],discourag:[128,33],eleg:28,somet:83,exit__auto_min:[116,46],parenthes:[152,29],honor:29,person:[10,23,78,29,143,111,131,115],tb_id:124,gambier:93,elev:115,traffic:[99,137],table_exist:[48,89],result_id:[2,34],anybodi:106,full_path:131,predetermin:51,add_package_path:111,ci_secur:[143,70,47,29],ceo:130,repeat_password:94,rule:[0,29],obscur:[54,80],vietnames:29,shape:[145,6,99],unix_to_tim:93,mysql:[97,76,77,29,89,152,49,83,93,12,149,156,71],love:[134,6],question:[29,138,65,34,49,8,6,141,144],sidebar:137,failsaf:109,move:[55,56,135,29],sandal:0,errand:137,append:[63,97,23,137,29,138,100,82,131,7,94],point1:42,restructuredtext:81,theoret:80,m4u:29,mydatabas:[149,79],num_link:[63,29],label_text:94,tweak:[95,29],xml_rpc_respons:99,unlik:[27,99,128,67,33,46,82,133,109],subsequ:[29,136,44,89,111,18],app:[69,42],myothermethod:132,build:[0,97,55,99,5,54,81,33,46,34,82,66,141,101,152,100,135,143,134,85,117],bin:54,australia:93,varchar:[88,77,148,21,103,121,124,106],format:[27,87,76,29,56,81,97,83,154,25,142,144],improperli:29,is_writ:108,file_ext_tolow:[131,29],get_post:29,intuit:69,corner_styl:44,nginx:14,game:145,backtick:[49,29],insert:[89,34,29],is_resourc:[146,29],bit:[29,80,89,33,81,112,106,134,144],characterist:80,array_pop:27,intel:96,table2:[152,76],table3:152,table1:[152,76],do_hash:[104,70,29],heading_cell_start:127,post_system:132,userfil:131,alpha_numer:51,resolv:[110,144,29],enable_hook:[132,58],collect:[27,21,34],"boolean":[80,89,128,48,133,131,49,93,94,51,96,11,99,137,54,101,6,58,106,143,108,79,63,146,19,147,97,111,151,115,149,72,23,76,29,117,118,33,82,39,124,109],mycustomclass:94,highlight_str:150,password_verifi:25,popular:[106,67,80,12],smtp_crypto:23,word_limit:[150,29],xmlrpc_client:99,encount:[29,33,46,111,154,143,109],mylist:6,often:[97,2,20,128,80,14,8,33,139,106],mcrypt_rijndael_256:112,sess_match_ip:106,fcpath:116,creation:[54,29],some:[140,0,2,44,128,129,46,80,8,48,94,146,5,93,9,51,95,96,10,97,99,137,54,13,101,14,125,104,57,141,106,143,108,109,63,64,147,150,67,21,22,111,88,113,25,152,149,116,27,139,23,76,29,117,118,33,81,34,82,132,42,142,89],back:[63,80,12,29,30,67,33,101,21,22,34,89,88,76,99,25,51,134,143],if_not_exist:77,sampl:[87,77],get_zip:115,error_gener:[72,46],redi:29,phpredi:[106,67],scale:85,chocol:111,culprit:29,sku_965qr:133,exect:29,exec:[108,29],per:[101,76,18,29],foreign:[76,29],usernam:[140,97,23,99,79,56,152,154,151,106,94,51,149],substitut:118,larg:[0,23,76,29,128,33,56,153,69,94,9,99,85,127],error_views_path:29,unsanit:49,reproduc:144,newdata:106,machin:88,id_:101,object:[89,2,34,149,29],run:[91,97,2,152,77,29,89,56,34,49,48,83],field_id:13,irkutsk:93,raspberri:29,agreement:[52,134],cal_cell_content_todai:19,step:[27,65,55,34,142,144],form_dropdown:[94,29],news_item:21,db_driver:29,prep_for_form:29,concoct:112,victoria:93,mssql:[89,71,29],cautious:112,reduce_linebreak:47,sess_encrypt_cooki:[33,111,29],constraint:[142,88,77,29],row:[83,114,89,152,29],extract_url:124,prove:[128,129],highlight_cod:[150,29],manag:29,rowcount:29,idl:[89,149,29],microsecond:[89,29],add_row:127,product_opt:133,mcrypt:[33,29,80,104,112,59],update_entri:[99,79],uncach:152,cookie_path:[106,3],reduct:29,upload_data:131,primarili:64,init_pagin:29,within:[0,2,77,29,81,125,18],pdostat:29,upgrad:[52,142,29],product_edit:101,ci_except:29,jimmi:138,todai:19,alpha:[29,138,142,133,51,109],contributor:130,announc:130,total_queri:89,pcre:29,websit:[30,106,33,29],inclus:29,institut:[130,78],bangladesh:93,next_prev_url:[19,29],spam:[82,124],fledg:8,proprietari:29,sock:67,stylesheet:[150,6,82,7],submit:[140,94,92,93,51,133,105,10,9,54,138,56,6,58,142,144,19,136,22,148,152,115,149,76,29,34,49,83,131,127],custom:29,optimize_t:[76,29],flashdata:[33,112,29],forward:[88,33,56,95,7,153,94,143],update_post:99,cur_tag_open:63,files:117,zealand:93,properli:[0,80,152,29,118,33,81,21,49,142,106,158],repeatedli:80,great:[134,6,144,29],twenti:63,current_url:[82,29],add_insert:76,perman:[128,106,104,112],link:[27,3,29,128,110,13,81,82,6],translat:[117,101,76,77,29],newer:[25,128,71,144,29],atom:[67,93,29],azor:93,ci_form_valid:51,ci_:[9,27,104,113,29],angri:6,info:[70,29,117,46,101,47,82,108],bevel:44,utf:[23,29,128,6,100,111,105,40,124,94,96],consist:[72,10,150,29,146,140,104,106],cid:23,access:[0,2,5,128,101,7,125,9,97,13,56,102,142,108,79,67,33,112,152,114,28,76,77,29,117,80,34,82,84,55,43,85],myfield:94,seven:[99,19,127],mod_mime_fix:[131,29],cal_cell_cont:19,highlight:[150,19,29,128,33,81,127],similar:89,curv:141,ci_input:[70,29,33,92,113,109],enlarg:121,exit_success:116,rowid:133,bind:[89,29],flow:[128,52,132,144],parser:[52,119,128,29,85,144],hash_pbkdf:142,mouseup:44,doesn:[53,55,152,29,129,33,56,139,80,25,154,94,108,142,9,106,42,115,65],dog:[44,42,41],convert_text:128,incomplet:[124,29],oof:128,guarante:[106,143,43],apache_request_head:109,rewritecond:5,gecko:96,bracket:[132,29],another_mark_end:42,anyth:[97,80,29,33,101,82,133,112,94,142,42,144,135],crypt:25,sequenti:[88,29],session_dummy_driv:106,invalid:[19,99,29,54,128,93,106,51,143],id_123:101,smtp_pass:23,setenv:14,librari:[0,87,152,29,45,81,125,113,149,108,144],trans_begin:[12,29],ellipsi:[150,20],xss_filter:33,particular:[140,89,7,48,132,133,51,135,12,137,138,56,106,96,150,152,99,149,27,76,78,79,34,82,83,124,42],is_mobil:[96,29],ctr:80,draw:148,rijndael:80,introduc:[64,128,21,8,156,108],drop_column:[77,29],elsewher:[133,106],js_library_driv:44,wrongli:29,eval:[154,108,29],less:[150,1,29,128,46,53,82,51],curtail:124,cal_cell_no_cont:19,smilei:[90,29],um35:93,index_pag:[6,65,82,29],curl:50,algorithm:[70,29,104,112,25,142],vice:54,svg:6,callback_username_check:51,sftp:151,parse_smilei:13,depth:[127,11,80,29],xmlrpc_server:99,get_userdata:[140,106],image_librari:54,far:[51,99,106,89],fresh:[152,33,102,103,104,105],script_head:44,slash_seg:153,scroll:44,set_output:100,oop:[9,140,29],fopen_read_write_create_destruct:116,basic11:6,partial:[127,89,49,29],examin:[133,136,99,152],scratch:[134,85],mysql_to_unix:93,rewriteengin:5,ellips:[150,6,29],last_upd:100,urandom:[25,33,143,80],bad_filenam:29,router:[37,136,113,33,29],compact:128,ci_session_driv:106,privat:[97,29],current_us:34,get_mime_by_extens:[117,29],you_said:99,friendli:[72,5,65,80,81,29,82],send:[145,0,76,147,137,29,117,129,33,82,89,128,92,132,94,142,42,149,144],code_start:42,lower:[97,29,138,80,101,82,131,9,108,109],blaze:106,opposit:[44,93],aris:78,function_exist:[108,29],bcc_batch_siz:23,"_file":29,sent:[0,89,129,46,132,51,136,99,100,57,18,106,144,145,147,111,23,77,29,118,124,42],passiv:151,unzip:55,convert_ascii:124,whichev:152,"_plugin":29,disclos:144,vlc:29,plain_text:80,account:[0,109,93,85,29],blog_id_site_id:77,ofb8:80,spoof:29,syntax:[91,149,152,49,29],smtp_keepal:[23,29],relev:[97,47],tri:[29,65,30,33,7,58,143],db_debug:[97,79,149,29],byte_format:[155,29],magic:[106,29],succeed:89,http_client_ip:[109,29],notabl:[33,56,29],non_existent_directori:110,ci_config:[33,82,7,29],my_model:[126,29],lombardi:145,kmz:29,"try":[97,152,49,29],last_queri:[83,84,89,29],noninfring:78,mysubmit:94,pleas:[117,0,55,3,4,44,154,122,7,34,94,144,82,93,150,9,51,95,134,60,98,70,79,59,54,138,13,84,102,103,104,105,57,58,106,149,15,16,17,62,133,123,73,67,100,111,156,126,142,75,107,112,113,25,114,80,72,27,74,28,152,29,30,31,32,33,47,35,36,37,38,39,121,61,40,68,157,42,109,43,120,158],malici:[142,143],impli:78,constrain_by_prefix:[89,29],use_t:29,set_radio:[94,51,29],myuser:55,anoym:132,cfb:80,encourag:[80,141,29,33,101,95,7,69,82,58,112,124,9,142,156,103],crop:[54,69,29],date_atom:[33,93],cron:[50,152],video:29,ci_db_driv:[89,29],download:[76,29],odd:153,click:[27,44,128,13,82,94],show_debug_backtrac:116,compat:29,index:[116,0,29,56,113,46,34,14,132,81,101,50,142,114,135],phpdoc:144,sapi:109,compar:[152,29],bdb:12,page2:152,slight:33,"_set_overrid":29,cal_cel_oth:19,xor_encod:29,experiment:[44,33],helper3:27,helper2:27,helper1:27,text_watermark:29,this_string_is_:150,bird:42,can:[0,2,5,7,8,9,11,12,13,14,19,20,21,22,28,25,27,23,29,30,33,95,39,42,44,45,46,34,48,50,51,54,55,56,57,18,63,64,66,67,72,76,77,79,80,81,82,83,84,140,88,89,92,93,94,96,97,99,100,101,103,6,106,107,108,109,111,112,113,114,115,117,118,49,124,125,127,128,47,131,132,133,134,135,136,137,138,139,142,143,144,145,146,147,148,149,150,151,152,153,154],ci_sessions_timestamp:106,sybas:[33,29],imagepng:29,preg_quot:29,is_cli_request:29,elips:6,len:138,sqlsrv_cursor_stat:29,closur:[132,29],hkk:29,logout:106,blog_name_blog_label:77,session_write_clos:106,safer:[83,152,49],vertic:54,encryption_kei:112,acquir:[117,106,130],crypt_blowfish:25,design:[5,80,19,29,118,13,49,69,112,133,142,134,127,79],select_avg:[152,29],ineffect:33,metro:153,larger:[54,104,46,29],technolog:[130,78],alaska:93,mb_substr:25,migration_typ:[88,29],cert:29,ci_pars:118,another_field:[33,77],heading_cell_end:127,"_fetch_uri_str":29,typic:[63,0,11,99,93,137,27,54,101,79,56,34,49,111,66,112,142,133,106,96],set_ciph:112,wm_hor_offset:54,chanc:[145,106,33],subsubsubsect:81,field1:[152,109],firefox:29,danger:[108,29],foreign_key_check:[76,29],new_fil:151,approxim:112,base_url:[9,105,125,82,29],bad_dat:93,standpoint:53,api:[44,99,29,80,14,143],blog:[27,0,88,152,137,79,118,13,101,34,82,111,151,124],oval:6,apc:29,file_ext:131,day_typ:19,blog_set:7,heading_next_cel:19,sorri:106,tailor:[54,63,23,80],cache_expir:0,zip:[52,119,76,29],commun:[97,99,29,130,106,144],ci_control:[116,0,139,88,99,137,79,13,21,104,125,50,51,131],doubl:[1,76,152,29,128,138,20,101,47,94,99],seamless:112,my_arch:115,isset:[29,128,56,14,106,109],implic:[30,33,113],eleven:[150,127],usr:[54,23],clear_data:115,expiri:[106,144],start:[89,29],rick:[130,83,49],sort:[133,106,99,153],batch_siz:[152,29],form_valid:[107,29],wincach:29,error_lang:140,benchmark:[0,113,132,29],about:[89,144,29],balanc:152,wm_text:54,prefetch:[56,29],trail:[151,29,138,33,101,7,153,132],from:[2,89,29,34,114,149,144],listen:[106,99],actual:[63,44,139,80,147,29,101,33,46,118,140,129,148,110,25,106,108,71],getter:106,harvest:[19,82,29],focu:[44,134,81,85,64],firebird:[71,76,29],signific:51,retriev:[114,89,34,29],alia:[33,19,152,29,100,13,56,47,82,111,89,138,92,93,106,94,70,144,108,109],crazi:152,cumbersom:12,annoi:6,smart_escape_str:29,obvious:2,collat:[97,77,29],meet:[53,128,80,142,51,144],valid_base64:[51,29],has_userdata:[106,29],aliv:29,control:[144,152,34,29],distrubut:106,sqlite:[97,71,29],weaker:80,tap:[132,29],pre_control:132,chosen:[55,12,80,67,33,103,106],process:[12,29,56,83,18,149],lock:[117,106,33,29],tax:34,high:[150,53,29,80,142,112,124,106],tag:29,entry_id:124,tab:[76,29,128,81,82,143],epallerol:29,sought:152,onlin:12,serial:[34,29],image_size_str:131,everywher:106,surfac:29,is_str:146,filepath:[132,151,115,111],soon:[33,156],tamper:29,six:127,database_exist:[76,29],xml_convert:1,build_str:128,crlf:[23,29],copyright:[54,78],subdirectori:[28,111,29],instead:[0,1,128,56,48,50,132,93,94,70,9,138,13,101,6,142,144,147,113,152,149,27,76,77,29,117,34,154,41,125],reestablish:[89,29],zip_fil:115,convers:[29,14,111,20],stock:[103,39],docblock:[128,29],loui:145,likewis:54,prolif:128,overridden:[0,112,29],singular:[53,41,29],interchang:[80,111],fran:29,table_clos:[19,127],act:[139,99,137,29,33,111,92,143,108,109],sundai:[19,93],pasteur:145,my_cached_item:67,server_addr:29,attent:[69,29],discard:[111,29],redund:29,dbutil:[76,111],exit_config:116,trim_slash:[138,29],chown:106,some_var:46,ssl_cert:97,"20121031100537_add_blog":88,friendlier:[92,29],light:112,m4a:29,robot:[6,96,29],suppress_debug:151,issu:29,webroot:142,days_in_month:[19,93,29],wordwrap:[23,29],allow:[117,0,80,128,101,7,94,131,93,9,51,134,53,12,54,138,13,56,154,58,106,143,109,63,146,133,19,152,67,97,111,88,113,99,72,75,76,29,30,118,33,34,82,153,83,39,155,124,142,127],append_output:[100,29],fallback:[128,33,144,29],per_pag:63,furnish:78,json_encod:100,y_axi:54,include_path:[117,29],screensend:89,cryptographi:80,insight:8,optgroup:[94,29],product_id:153,passion:6,comma:[23,76,29,106,124,51,144],gender:153,is_dir:151,georg:145,bunch:33,get_csrf_token_nam:[102,143],enclosur:76,cubird:77,outer:152,treat:[5,12,89,29,6,115],reilli:138,pecl:106,wget:50,adjust_d:19,maxlifetim:106,fetch_:33,form_password:94,button:[94,51,29],apache2:110,therefor:[87,29,30,33,34,95,106,133,51],pixel:[54,131],img_height:148,double_encod:29,docx:29,fourth:[94,150,23,76,93],handl:29,auto:[149,12,29],remove_package_path:111,overal:29,compress:[115,76,97,57,29],camino:96,auth:[101,29],p10:29,mention:[106,80,29],p12:29,password_bcrypt:25,overkil:[9,27,113],tbody_clos:127,front:[117,136,29],profiler_no_memori:29,csrf_protect:[143,29],escape_identifi:[89,29],"enum":29,strive:53,models_info:117,another_nam:106,somewher:115,"_remove_evil_attribut":29,xml:29,edit:[101,82,29],unlimit:77,wm_x_transp:54,tran:6,json_unescaped_unicod:100,ping_url:124,scrollbar:82,myfold:[151,115],mystyl:6,batch:[23,152,29],disregard:75,mycheck:94,error_report:46,register_glob:29,pygment:81,few:[80,19,29,30,33,101,22,8,128,58,124,25,106,134,144,108,109],yakutsk:93,better_d:93,due:[44,80,76,29,33,152,146,104,106],intellig:[137,29,82,69,7,149],chunk:118,einstein:145,product:[72,0,97,55,29,33,101,14,7,153,88,5,142,133,106,80],consum:[42,84,29],sha224:80,src:[6,148,23,29],"static":[122,52,120,102,103,104,105,57,18,126,59,60,61,58,64,123,21,15,72,73,74,75,29,30,31,32,33,95,35,36,37,38,39,121,17,40,68,157,62,156,16,158],driver_nam:[87,29],connor:138,password:[97,149,29],our:[53,80,152,111,139,106,33,21,22,8,142,141,124,50,51,134,144],meth:[23,81],hiddenemail:94,"_after":77,special:[28,99,77,89,29,106,49,142,124,94,51,109],out:[116,145,23,99,78,29,54,55,34,22,8,89,128,154,88,142,94,106,144,108,80],variabl:[0,97,76,29,56,154,46,14,49,84,125,27,9,152,149,108,135],set_flashdata:106,reload:51,influenc:80,parse_str:[118,29],hmac_digest:80,some_librari:128,categori:[128,27],thoma:145,clockwis:54,rel:[11,23,79,54,110,29,111,117,131,6,132,142],inaccess:50,inspir:130,rec:6,plural:[41,29],char_set:[97,126,77,149,29],math:6,random_el:[145,27],default_templ:19,ecb:80,insid:[140,28,3,29,118,33,81,152,22,132,113,106,125,115,135],sendmail:[69,23,29],frank:152,msssql:29,sess_cookie_nam:106,umark_flash:106,readm:[106,81],userspac:29,get_wher:[152,21,29],transliter:150,invas:29,csrf_regener:[143,29],group_id:128,chatham:93,bleed:130,greedi:[128,29],prefix_tablenam:49,marginleft:44,get_day_nam:19,select_sum:[152,29],nowher:110,indent:144,should_do_someth:81,tripled:80,migration_add_blog:88,could:[44,2,128,46,80,50,51,134,135,99,139,57,106,108,144,21,88,77,29,100,33,82,85],lexer:81,put:[0,33,56,95,50,131,94,51,135,12,137,54,13,101,18,106,109,63,146,65,21,148,142,99,23,152,29,80,34,49,124,42,127],email_lang:140,timer:[0,42,100,49],keep:[34,29],profiler_no_memory_usag:29,length:[150,89,138,29,48,18,25,142],unidentifi:96,wrote:[21,144],outsid:[44,5,80,150,29],url:[0,29,101,50,24,27,9,125,83,108],retain:[106,112,29],do_xss_clean:[104,29],timezon:29,south:93,softwar:[146,78,66,80,46,141],cache_info:67,delete_cooki:[92,29],blown:[118,146],blogger:99,ci_ftp:151,qualiti:[54,69,144],echo:[76,77,56,49,48,83,152,114],whoop:139,date:[152,114,79,76,29],proxy_ip:[109,29],oci8:[71,29],pgp:29,quick_refer:29,owner:[106,142],child_on:28,shortcut:6,facil:144,b99ccdf16028f015540f341130b6d8ec:133,utc:93,prioriti:[23,29,80,46,111,106],forgeri:[142,29],"long":[27,23,19,77,29,128,80,148,142,25,106,135,109],fair:12,timestamp:[88,19,29,33,148,93,106],newus:106,unknown:[154,33],licens:[10,52,29],perfectli:0,mkdir:[106,151],system:[97,12,29,45,34,49,152,144],wrapper:[67,56,89],avoid:[140,23,29,128,67,33,7,153,131,106,94,51,109],attach:[69,146,23,29],attack:[29,80,22,131,142,106,143,109],physic:23,which:[0,2,3,44,128,101,80,8,94,146,5,49,93,75,9,51,95,134,135,53,12,137,109,54,138,55,56,14,103,18,156,106,149,143,108,58,63,64,133,19,144,147,150,67,97,111,148,23,112,99,25,70,115,118,27,139,28,152,29,30,100,33,34,82,153,83,84,40,124,88,142,127],termin:[50,124,108,82,29],erron:29,"final":[0,150,132,29],ssl_capath:97,ipv4:[51,109],find_migr:88,haystack:[25,27],lot:[56,47,22,113,106,143],big:29,methodolog:132,fetch_method:29,col_arrai:13,third_parti:29,shall:78,accompani:33,essenti:144,ogg:29,exactli:[152,77,29,54,101,56,118,112,106,9,51,109],haven:[51,80,111,22,106],kamchatka:93,rss:[66,6,93],prune:50,detail:[44,80,99,29,54,67,33,46,14,7,111,69,128,92,58,142,9,106,114,104,134],jsref:82,structur:[91,29],charact:[1,80,89,128,49,93,94,51,96,97,54,138,100,101,6,58,106,143,108,109,20,22,112,142,25,150,23,76,77,29,117,33,81,47,82,121,40,124],claim:78,your_str:63,htaccess:[5,29,117,55,14,142,134],session_data:[106,84],sens:[66,27,33,29],becom:[63,5,53,23,19,27,54,80,111,82,128,139,143,127],sensit:[106,87,76,142,29],foobarbaz:67,signifi:148,stricter:143,pgsql:97,accept_lang:[96,29],send_error_messag:99,"function":[144,29],counter:54,codeignitor:29,faster:[118,80,82,57,106,134,85],terribl:[51,93],falsi:94,explicit:[128,29],basepath:[72,116,88,19,29,111,9],respons:[88,137,29,100,46,34,82,124],deprec:[97,70,77,29,117,129,13,82,103,104,6,93,138,94,156,71],clearli:128,correspond:[140,3,128,45,7,131,51,99,137,54,138,13,101,106,107,19,21,22,4,118,34,153,84],sufix:63,corrupt:29,have:[0,3,5,6,7,8,9,10,12,13,14,15,16,17,18,19,21,22,88,25,28,29,30,31,32,33,95,35,36,37,38,39,40,44,46,34,48,51,53,54,56,23,57,58,59,60,61,62,63,68,72,73,74,75,76,77,79,80,81,82,84,89,92,93,94,97,98,99,100,101,102,103,104,105,106,109,111,112,113,118,49,120,121,122,123,124,125,126,128,47,131,132,133,135,137,139,141,142,144,145,146,148,149,151,152,153,156,157,158],close:[144,29],get_metadata:[67,29],member_nam:89,superobject:[132,29],pg_version:29,tb_date:124,migration_auto_latest:88,probabl:[106,80,34,22],in_arrai:[30,27,33],rout:[50,0,132,24,29],fileproperti:128,accuraci:29,tighten:29,mix:[140,145,89,101,46,7,92,93,94,51,99,138,100,56,6,106,143,108,109,63,146,147,67,21,111,88,25,115,150,23,152,81,131,82,153,155,127],discret:[27,28,29,92,51,127,109],cheatsheet:29,hkdf:80,codeigniter_profil:29,anchor_popup:[82,29],mit:29,singl:[97,89,144,34,29],uppercas:[0,29,128,138,112,109],address_info:94,unless:[33,128,92,133,10,137,54,100,56,58,106,145,146,20,111,112,25,115,152,77,29,80,47,131],ci_cor:29,oracl:[97,71,152,29],galleri:54,textmat:81,row_alt_end:127,header1:23,get_request_head:[109,33,29],eight:127,max_filenam:[131,29],deploi:[88,29],segment:[89,144,34,29],"class":[144,29],page_query_str:63,newprefix:49,placement:29,expert:80,child_two:28,gather:[48,96],upset:6,set_error_delimit:[51,29],character_limit:[150,29],face:20,inde:[128,29],my_log:33,determin:[83,89,34,29],built:[94,131,139,82,109],constrain:29,stark:134,plaintext_str:112,fact:[106,33,137,112,80],my_bio:115,ci_user_ag:96,cal_cell_start:19,extension_load:112,send_respons:99,ci_sess:[103,33,121,156,106],model_nam:[111,79],watch:[46,21],bring:[130,104],new_imag:54,format_charact:[29,20],trivial:[106,144],anywai:[80,95,29],texb:[54,148],redirect:[5,23,99,29,101,82,125,9],dbcollat:[97,126,77,149,29],textual:19,locat:[140,0,55,44,46,7,132,93,9,51,96,97,54,13,139,106,135,107,79,67,111,72,27,29,33,82,153,124],strip_image_tag:[51,70,29],blog_entri:118,holder:78,illus:145,calendar_lang:3,figur:89,should:[0,3,5,6,8,9,13,15,16,17,58,19,21,23,25,88,29,30,31,32,33,95,35,36,37,38,39,40,44,45,46,34,50,51,54,55,56,57,18,59,60,61,62,71,72,73,74,75,76,77,80,81,82,140,93,94,97,99,101,102,103,104,105,106,109,111,112,117,49,120,121,122,123,68,126,127,128,131,132,133,136,137,139,142,144,146,149,150,156,157,158],jan:19,lightest:53,smallest:53,sess_regener:106,intrigu:6,elseif:[128,154,96],local:[116,0,89,29,81,113,9],hope:8,mb_mime_encodehead:29,meant:[140,106],um10:93,strip_slash:138,invalid_files:29,gettyp:29,server_url:99,sess_match_userag:[33,29],convert:[150,1,70,29,138,47,82,93,94],error_404:[72,101,46,158,29],wordi:128,made:[44,53,139,152,137,29,31,33,21,22,95,102,103,105,57,43,144],csrf:29,orig_data:112,db1:149,target_vers:88,in_list:[51,29],edg:[54,130,29],cur_tag_clos:63,endless:[25,29],application_config:128,getuserinfo:99,dishearten:6,enabl:29,organ:[34,29],nl2br:[47,20],upper:[54,109],or_wher:[152,29],bounc:44,htmlspecialchar:[51,127,108,29],sha:80,csrf_token_nam:[102,143],image_url:13,integr:[50,150,80],contain:[86,0,1,5,128,101,46,34,48,92,132,49,93,94,11,70,138,13,56,103,105,142,6,144,145,150,110,97,148,25,152,114,155,149,72,27,28,76,77,29,117,79,81,47,82,121,122,41,89],menuitem:118,grab:139,view:[89,152,34,29],conform:142,legaci:[0,33,106,112,29],avg:[152,29],cal_cell_blank:19,parse_exec_var:[100,29],frame:6,knowledg:[10,106],exit_unknown_class:116,group_nam:149,qty:[133,29],popup:82,rc2:80,equip:41,form_input:[94,133,29],my_uri:29,sphinxcontrib:81,entitl:7,thead_open:127,unexist:29,log_file_extens:29,error:[97,89,144,29],segment_arrai:153,adodb:12,correctli:[150,139,29,129,20,80,46,83,115,144],record:[10,152,29,33,21,22,104,106,143],mimes_typ:29,pointer:[64,56,29],boundari:29,last_visit:29,var_dump:[128,67],state:[44,53,23,152,0,29,146,18,93,94,106],stacktrac:144,ci_trackback:124,progress:44,multiplelanguag:140,equiv:6,thumbnail:54,get_compiled_insert:[152,29],get_dir_file_info:[117,29],perfect:[54,22],core_class:39,sole:109,bed:145,kei:[97,89,29],vrt:54,weak:142,matic:99,simple_queri:[89,49,29],salli:154,fopen_write_create_destruct:116,job:[50,139],entir:[63,27,151,76,29,128,118,64,55,56,34,14,113,106,9,51,42,67],joe:[151,152,138,101,153,154,94],has_rul:51,poof:29,argument:[50,152,29],disallow:[150,143,58,29],thumb:54,proxy_port:99,date_rfc850:93,quote_identifi:29,plugin:[72,126,98,40,29],wrapchar:23,goal:[52,134,85],mpg:29,cell_alt_end:127,foobaz:128,etc:[44,2,89,128,48,9,125,50,51,96,11,99,137,100,106,143,144,19,150,110,41,97,69,142,149,27,23,152,77,29,80,81,34,83,124],cachedir:[39,149,97,29],grain:82,kdb:29,tld:[30,33],db_set_charset:[89,29],gmdate:100,fopen_read_write_create_strict:116,messagebodi:51,onchang:94,comment:[0,29,152,34,27],shirts_on_sal:94,unmark:106,sqlsrv_cursor_client_buff:29,ci_db_pdo_driv:29,img_id:[148,29],hyphen:29,heavi:[106,34,149],print_r:[128,76,151,19,99],chmod:[106,151,29],walk:56,image_reproport:29,rpc:[52,119,142,29],"0script":108,respect:[97,76,29,138,33,101,94,104,25,51],tuesdai:19,mcrypt_mode_cbc:[112,29],admin:[33,76],utf8_general_ci:[97,149,77,126],april:29,quit:[27,99,146,128,81,6,18,124,134],foofoo:128,tort:78,addition:[77,29,128,45,33,111,7,6,107,109],endforeach:[137,131,21,154,133,134],get_inst:29,form_prep:[94,29],watermark:29,compon:[53,19,29,133,106,144],json:100,write_fil:[117,76],ruleset:29,date_w3c:93,popul:[19,29],xlsx:29,curli:[29,20],both:[80,91,125,133,51,99,54,13,106,108,144,112,152,115,76,77,29,30,33,81,82,153,55,109],censor:150,overlay_watermark:29,interbas:[83,71,76,29],togeth:[63,152,137,139,49,148,51],raw_data:80,user_guid:39,fail_gracefulli:[111,7],mouseov:44,present:[97,29],opac:54,request_head:[109,29],replic:106,multi:[97,137,29,118,6,132,133,106,127],cypher:112,"14t16":93,plain:[13,70,29,100,33,80,112,118,25,142],align:[54,133],some_photo:115,harder:145,return_path:[23,29],harden:[108,29],defin:[56,77,108,29],filename_secur:29,suport:93,encrypted_str:112,hex2bin:[25,80,29],decept:6,wild:29,get_compiled_delet:[152,29],sess_time_to_upd:[106,126],"8bit":25,mydogspot:41,layer:[25,142,71,21,29],purchas:133,customiz:[63,97],helper:29,almost:[106,11,80,153],field_data:[48,89,56,34,29],site:29,langfil:140,some_class:[81,113],ruri_str:[153,29],svg11:6,bigint:[106,148],substanti:[113,78,29],lightweight:140,sting:96,incom:[99,124],unneed:29,symbolic_permiss:[117,29],test_datatyp:146,free_result:[56,34,29],uniti:29,human_to_unix:[93,29],let:[97,2,152,89,29,34,49,48,18],welcom:[101,137,113],ciper:80,parti:[81,21],cross:[70,29,31,6,142,108,109],ci_tabl:127,member:[152,89,34,130,51,109],code_end:42,data_seek:[56,29],pingomat:99,android:29,fubar:111,difficult:54,prais:8,immedi:[132,18,29],columbia:[130,78],hostnam:[29,97,151,79,30,33,89,149],equival:[128,150,13,139],keepal:29,db_select:[89,149,29],upon:[10,29,54,89,8,51,134,109],effect:[34,29],coffe:133,dai:[127,29,19,93,8],column_nam:77,retriv:109,raboof:128,having_or:29,sooner:[103,33,95],set_:94,alpha_dash:51,expand:[29,22,8],andretti:145,ofb:80,orig_nam:131,set_empti:127,off:[63,0,151,12,10,29,34,83,131,94,142,144],center:[54,139],reuse_query_str:[63,29],epub:81,unl:33,colour:29,well:[140,44,128,93,50,51,134,96,11,101,6,106,108,63,146,71,23,152,29,117,33,154,85],captcha_tim:148,set_cooki:[92,109,29],weblog:[99,124],exampl:[97,2,89,29,34,149,144],command:[152,149,76,29],filesystem:88,undefin:[146,29],audio:29,loss:106,sibl:28,usual:[5,80,99,44,54,33,111,82,150,92,151,106,51,134,115,131,109],next:[33,152,29,138,13,56,34,14,144],taller:54,display_overrid:132,newest:[133,88],camel:41,drop_databas:[77,29],half:106,obtain:[140,78],tcp:[106,67],jar:29,settabl:29,ci_xmlrpc:[99,29],some_cookie2:109,rest:[101,97,79,81,8],glue:139,new_post:99,sku:133,web:34,"50off":133,filter_validate_email:129,fopen:[117,29],idiom:140,disagre:144,multipart:[94,131,29],arandom:25,smith:[50,99],my_backup:115,myprefix_:109,add:[0,89,45,9,5,49,94,97,150,137,138,56,6,57,58,101,144,65,148,113,152,149,72,27,76,77,29,81,82,39,155,41],wm_vrt_align:54,error_email_miss:140,foobar:[128,145,79],display_pag:63,logger:29,suit:[54,146],warrant:104,old_table_nam:77,gmt:[100,93],exot:109,set_mim:147,xmlrpc:[128,99,29],agnost:89,vanuatu:93,http_x_cluster_client_ip:[109,29],foreign_charact:29,camelcas:128,five:[133,138,127],know:[0,80,76,77,33,101,139,22,48,142,144,112,113,50,106,109,69,71],fscommand:29,convert_xml:124,octal_permiss:[117,29],set_select:[94,51,29],height:[145,44,29,54,82,148,131,6],recurs:[11,151,29,104,25,115],get_item:[133,29],desc:152,xss:[108,29],resid:3,like:[0,1,2,3,5,128,101,7,48,50,131,94,132,49,93,9,51,134,96,154,97,150,12,137,109,54,13,56,14,151,89,104,145,58,106,135,143,108,79,63,146,133,19,118,20,66,111,22,156,148,75,112,113,25,99,115,80,72,27,139,23,152,149,29,100,33,81,34,82,153,83,39,55,124,44,125,42,88,142,85,127],lost:[106,29],safe_mailto:82,um11:93,up105:93,sessionhandlerinterfac:106,num_tag_clos:63,interfer:106,session_regenerate_id:106,unord:[6,29],necessari:[0,152,89,128,29,94,16],active_r:[72,126,29],messi:51,lose:[128,145,80],resiz:[54,44,69,82,29],get_temp_kei:106,xsl:29,path_info:3,cdr:29,exceed:[23,149,89],revers:29,"_html_entity_decode_callback":29,migration_path:[88,29],suppli:[2,89,129,46,48,131,94,51,97,54,13,143,108,109,146,19,111,148,25,114,115,151,152,29,117,33,82,144],stat:[0,29],update_batch:[152,29],daylight:93,"export":29,superclass:128,proper:[29,80,152,89,128,33,46,95,131,51,143],home:[139,96],use_strict:146,form_item:51,transport:99,auto_typographi:[29,47,20],week_row_start:19,trust:[97,29],lead:[128,138,153,101,29],broad:[85,26],"_get":[109,33,142,29],lean:[118,134],februari:29,leap:93,log_error:[140,39,46,29],default_method:0,speak:77,myfunct:132,um12:93,congratul:[106,22],liabil:78,acronym:29,journal:101,"10px":94,usag:[91,152,77,29,56,34,48],values_pars:29,facilit:29,maintain_ratio:[54,29],host:[97,89,67,29,6,106,85,149],hash_pbkdf2:[25,142,29],nutshel:[50,0],cal_cell_oth:19,although:[63,27,80,29,33,49,18,51,134,85],offset:[63,152,29,54,67,56,153,93,25],product_name_rul:133,parserequest:29,slug:[138,21,22],stage:132,rsegment_arrai:153,sbin:23,rare:[106,104,80,49],interven:100,last_citi:128,column:[89,29],prop:54,sqlsrv:[97,33,71,29],error_username_miss:140,entity_decod:[143,47,29],includ:[5,2,44,128,45,89,133,131,93,9,51,134,10,11,99,137,55,139,151,104,141,106,143,108,79,144,150,21,22,111,33,142,152,115,27,23,76,77,78,29,117,118,80,81,82,153,84,109,156,157,158],member_id:[94,99,34,89],constructor:[149,125,29],cal_row_end:19,repercuss:58,powerpoint:29,is_tru:146,creating_librari:39,own:[0,12,29,34,49,125,25,152,144],delete_al:29,payment:152,inlin:[23,6,13,29],"_ci_autoload":29,easy_instal:81,automat:[2,144,34,29],first_tag_open:63,warranti:78,guard:[80,112,124],item_valu:7,wm_overlay_path:54,awhil:29,col_limit:127,relicens:29,destructor:29,hang:8,mere:[145,144],merg:[152,78,29,111,7,144],is_brows:[96,29],beep:150,myform:[94,51],unix_start:93,val:[152,128,100,111,148,51,127],pictur:[6,23],myforg:77,transfer:[109,80,151,29],howland:93,support:29,db_query_build:[152,29],beer:132,language_kei:[86,140],macintosh:96,standard_d:[93,29],much:[88,29,33,95,111,93,25,106,134,85,109],pool:[148,29],filemtim:29,"var":[29,128,67,111,106,108],venezuelan:93,"_lang":140,application_fold:[55,95,135],reduc:[138,67,142,47,34],total_row:63,unexpect:106,unwrap:23,bcc_batch_mod:[23,29],brand:96,post_control:132,multical:29,"_util":0,is_natur:51,set_update_batch:[152,29],bodi:[23,152,137,29,118,13,56,139,131,129,51],gain:[103,67,80,34,112],select_min:[152,29],dbforg:[111,33,77,88,29],eas:29,highest:[23,115],eat:6,count:[89,29],group_start:152,cleanup:29,temp:118,rc4:80,wish:[140,44,128,46,7,133,132,94,11,99,137,54,55,101,18,106,109,146,19,150,111,112,152,27,151,76,77,80,82,153,42],unload:44,writeabl:117,flip:54,troubl:[33,144],asynchron:143,directori:[97,89,45,29,34,18],below:[5,80,44,46,7,94,131,132,93,9,51,12,137,54,13,56,106,133,19,150,21,111,148,113,99,114,149,27,23,152,77,29,79,81,34,84,142,158,127],meta:[48,6,56,29],limit:[114,2,29],tini:6,fetch:[145,152,137,29,67,33,56,48,25],view_cascad:111,otherwis:[140,0,80,129,94,92,133,54,101,14,106,108,109,111,142,25,116,23,76,78,29,33,42,144],problem:[150,29,33,46,141,106,51,144],weblogupd:99,reliabl:[150,29,30,33,82,106,96],evalu:[128,146,29],timespan:[93,29],"int":[89,46,92,93,133,11,99,138,100,56,151,6,106,143,108,109,19,67,21,148,88,112,25,150,23,152,77,117,80,81,153,155,124,42,127],dure:[140,27,79,29,142,84,132,106,25,51],novemb:29,implement:[140,80,12,152,29,33,106,89,25,124,9,51],some_nam:106,userag:23,path_cach:128,mistaken:128,ing:29,up1275:93,httponli:[106,92,109],inc:130,unlucki:142,spell:29,my_:[9,27,39,67,113],last_tag_open:63,percent:[142,93],front_control:72,virtual:106,plular:41,other:[5,80,3,89,128,46,48,9,92,94,132,93,50,10,12,137,138,55,14,6,142,108,126,133,19,112,149,72,27,152,29,33,81,95,82,144,131],bool:[140,44,1,100,89,129,46,7,133,92,93,94,51,96,11,70,54,138,13,56,6,106,143,108,109,145,146,147,110,67,41,111,152,151,25,99,115,23,76,77,117,118,81,47,82,124,131,127],bin2hex:80,rememb:[137,30,33,34,49,111,50,51],unix_to_human:93,php4:0,php5:110,myphoto:115,key_prefix:[67,29],repeat:[138,6,29],misc_model:33,my_db:77,oci_fetch:29,june:[19,29],ci_email:[9,23],"_parse_argv":29,news_model:[21,22],theother:138,is_ascii:29,unnecessarili:29,mondai:[19,127],has_opt:133,throughout:[29,27,79,45,80,46,140,136,143,149],trackback:[52,119,29],clean_email:29,malsup:44,basketbal:51,stai:[133,145],experienc:[54,106,128,80],thead_clos:127,sphinx:81,amp:1,strpo:128,came:142,baker:93,root_path:115,involv:[10,19,146,54,131,99,107],extran:29,bcc:[23,29],form_radio:[94,29],"_protect_identifi":29,portion:[25,152,46,78],emerg:144,ci_uri:[153,29]},objtypes:{"0":"php:method","1":"php:function","2":"php:class"},objnames:{"0":["php","method","PHP method"],"1":["php","function","PHP function"],"2":["php","class","PHP class"]},filenames:["general/controllers","helpers/xml_helper","database/call_function","installation/upgrade_b11","installation/upgrading","general/urls","helpers/html_helper","libraries/config","tutorial/conclusion","general/creating_libraries","DCO","helpers/directory_helper","database/transactions","helpers/smiley_helper","general/environments","installation/upgrade_163","installation/upgrade_162","installation/upgrade_161","general/caching","libraries/calendar","libraries/typography","tutorial/news_section","tutorial/create_news_items","libraries/email","general/index","general/compatibility_functions","overview/index","general/helpers","general/drivers","changelog","installation/upgrade_303","installation/upgrade_302","installation/upgrade_301","installation/upgrade_300","database/caching","installation/upgrade_305","installation/upgrade_304","installation/upgrade_152","installation/upgrade_153","installation/upgrade_150","installation/upgrade_154","helpers/inflector_helper","libraries/benchmark","installation/downloads","libraries/javascript","general/autoloader","general/errors","helpers/typography_helper","database/metadata","database/queries","general/cli","libraries/form_validation","index","overview/goals","libraries/image_lib","installation/index","database/results","installation/upgrade_141","installation/upgrade_140","installation/upgrade_220","installation/upgrade_221","installation/upgrade_222","installation/upgrade_223","libraries/pagination","tutorial/index","installation/troubleshooting","overview/mvc","libraries/caching","installation/upgrade_212","overview/features","helpers/security_helper","general/requirements","installation/upgrade_130","installation/upgrade_131","installation/upgrade_132","installation/upgrade_133","database/utilities","database/forge","license","general/models","libraries/encryption","documentation/index","helpers/url_helper","database/helpers","general/profiling","general/welcome","helpers/language_helper","general/creating_drivers","libraries/migration","database/db_driver_reference","helpers/index","database/index","helpers/cookie_helper","helpers/date_helper","helpers/form_helper","installation/upgrade_306","libraries/user_agent","database/configuration","installation/upgrade_120","libraries/xmlrpc","libraries/output","general/routing","installation/upgrade_202","installation/upgrade_203","installation/upgrade_200","installation/upgrade_201","libraries/sessions","general/libraries","general/common_functions","libraries/input","helpers/path_helper","libraries/loader","libraries/encrypt","general/core_classes","database/examples","libraries/zip","general/reserved_names","helpers/file_helper","libraries/parser","libraries/index","installation/upgrade_214","installation/upgrade_211","installation/upgrade_210","installation/upgrade_213","libraries/trackback","general/ancillary_classes","installation/upgrade_160","libraries/table","general/styleguide","helpers/email_helper","general/credits","libraries/file_uploading","general/hooks","libraries/cart","overview/at_a_glance","general/managing_apps","overview/appflow","general/views","helpers/string_helper","tutorial/static_pages","libraries/language","overview/getting_started","general/security","libraries/security","contributing/index","helpers/array_helper","libraries/unit_testing","helpers/download_helper","helpers/captcha_helper","database/connecting","helpers/text_helper","libraries/ftp","database/query_builder","libraries/uri","general/alternative_php","helpers/number_helper","installation/upgrade_170","installation/upgrade_171","installation/upgrade_172"],titles:["Controllers","XML Helper","Custom Function Calls","Upgrading From Beta 1.0 to Beta 1.1","Upgrading From a Previous Version","CodeIgniter URLs","HTML Helper","Config Class","Conclusion","Creating Libraries","Developer’s Certificate of Origin 1.1","Directory Helper","Transactions","Smiley Helper","Handling Multiple Environments","Upgrading from 1.6.2 to 1.6.3","Upgrading from 1.6.1 to 1.6.2","Upgrading from 1.6.0 to 1.6.1","Web Page Caching","Calendaring Class","Typography Class","News section","Create news items","Email Class","General Topics","Compatibility Functions","CodeIgniter Overview","Helper Functions","Using CodeIgniter Drivers","Change Log","Upgrading from 3.0.2 to 3.0.3","Upgrading from 3.0.1 to 3.0.2","Upgrading from 3.0.0 to 3.0.1","Upgrading from 2.2.x to 3.0.x","Database Caching Class","Upgrading from 3.0.4 to 3.0.5","Upgrading from 3.0.3 to 3.0.4","Upgrading from 1.5.0 to 1.5.2","Upgrading from 1.5.2 to 1.5.3","Upgrading from 1.4.1 to 1.5.0","Upgrading from 1.5.3 to 1.5.4","Inflector Helper","Benchmarking Class","Downloading CodeIgniter","Javascript Class","Auto-loading Resources","Error Handling","Typography Helper","Database Metadata","Queries","Running via the CLI","Form Validation","CodeIgniter User Guide","Design and Architectural Goals","Image Manipulation Class","Installation Instructions","Generating Query Results","Upgrading from 1.4.0 to 1.4.1","Upgrading from 1.3.3 to 1.4.0","Upgrading from 2.1.4 to 2.2.x","Upgrading from 2.2.0 to 2.2.1","Upgrading from 2.2.1 to 2.2.2","Upgrading from 2.2.2 to 2.2.3","Pagination Class","Tutorial","Troubleshooting","Model-View-Controller","Caching Driver","Upgrading from 2.1.1 to 2.1.2","CodeIgniter Features","Security Helper","Server Requirements","Upgrading from 1.2 to 1.3","Upgrading from 1.3 to 1.3.1","Upgrading from 1.3.1 to 1.3.2","Upgrading from 1.3.2 to 1.3.3","Database Utility Class","Database Forge Class","The MIT License (MIT)","Models","Encryption Library","Writing CodeIgniter Documentation","URL Helper","Query Helper Methods","Profiling Your Application","Welcome to CodeIgniter","Language Helper","Creating Drivers","Migrations Class","DB Driver Reference","Helpers","Database Reference","Cookie Helper","Date Helper","Form Helper","Upgrading from 3.0.5 to 3.0.6","User Agent Class","Database Configuration","Upgrading From Beta 1.0 to Final 1.2","XML-RPC and XML-RPC Server Classes","Output Class","URI Routing","Upgrading from 2.0.1 to 2.0.2","Upgrading from 2.0.2 to 2.0.3","Upgrading from 1.7.2 to 2.0.0","Upgrading from 2.0.0 to 2.0.1","Session Library","Using CodeIgniter Libraries","Common Functions","Input Class","Path Helper","Loader Class","Encrypt Class","Creating Core System Classes","Database Quick Start: Example Code","Zip Encoding Class","Reserved Names","File Helper","Template Parser Class","Libraries","Upgrading from 2.1.3 to 2.1.4","Upgrading from 2.1.0 to 2.1.1","Upgrading from 2.0.3 to 2.1.0","Upgrading from 2.1.2 to 2.1.3","Trackback Class","Creating Ancillary Classes","Upgrading from 1.5.4 to 1.6.0","HTML Table Class","PHP Style Guide","Email Helper","Credits","File Uploading Class","Hooks - Extending the Framework Core","Shopping Cart Class","CodeIgniter at a Glance","Managing your Applications","Application Flow Chart","Views","String Helper","Static pages","Language Class","Getting Started With CodeIgniter","Security","Security Class","Contributing to CodeIgniter","Array Helper","Unit Testing Class","Download Helper","CAPTCHA Helper","Connecting to your Database","Text Helper","FTP Class","Query Builder Class","URI Class","Alternate PHP Syntax for View Files","Number Helper","Upgrading from 1.6.3 to 1.7.0","Upgrading from 1.7.0 to 1.7.1","Upgrading from 1.7.1 to 1.7.2"],objects:{"":{"CI_DB_driver::platform":[89,0,1,""],"CI_DB_forge::add_field":[77,0,1,""],mysql_to_unix:[93,1,1,""],"CI_DB_query_builder::or_where_in":[152,0,1,""],"CI_Input::get_request_header":[109,0,1,""],"CI_Calendar::get_total_days":[19,0,1,""],"CI_URI::segment":[153,0,1,""],"CI_FTP::delete_dir":[151,0,1,""],auto_link:[82,1,1,""],form_textarea:[94,1,1,""],"CI_Session::keep_flashdata":[106,0,1,""],"CI_DB_utility::repair_table":[76,0,1,""],"CI_DB_driver::update_string":[89,0,1,""],get_file_info:[117,1,1,""],base_url:[82,1,1,""],site_url:[82,1,1,""],"CI_DB_forge::add_column":[77,0,1,""],"CI_Output::set_output":[100,0,1,""],CI_Security:[143,2,1,""],"CI_DB_result::last_row":[56,0,1,""],form_prep:[94,1,1,""],"CI_DB_query_builder::not_like":[152,0,1,""],"CI_DB_driver::cache_delete_all":[89,0,1,""],"CI_Encrypt::encode":[112,0,1,""],date_range:[93,1,1,""],underscore:[41,1,1,""],"CI_DB_query_builder::get_compiled_delete":[152,0,1,""],"CI_DB_driver::simple_query":[89,0,1,""],force_download:[147,1,1,""],"CI_Calendar::get_day_names":[19,0,1,""],"CI_Cache::is_supported":[67,0,1,""],byte_format:[155,1,1,""],"CI_Migration::latest":[88,0,1,""],"CI_DB_driver::trans_complete":[89,0,1,""],"CI_DB_driver::reconnect":[89,0,1,""],"CI_DB_utility::database_exists":[76,0,1,""],heading:[6,1,1,""],"CI_FTP::mirror":[151,0,1,""],CI_DB_query_builder:[152,2,1,""],CI_Loader:[111,2,1,""],nbs:[6,1,1,""],doctype:[6,1,1,""],word_limiter:[150,1,1,""],write_file:[117,1,1,""],"CI_DB_driver::db_select":[89,0,1,""],"CI_Unit_test::set_test_items":[146,0,1,""],sanitize_filename:[70,1,1,""],"CI_Image_lib::rotate":[54,0,1,""],standard_date:[93,1,1,""],mdate:[93,1,1,""],"CI_Calendar::get_month_name":[19,0,1,""],"CI_DB_query_builder::limit":[152,0,1,""],"CI_Input::server":[109,0,1,""],"CI_Output::_display":[100,0,1,""],"CI_DB_query_builder::where":[152,0,1,""],"CI_DB_query_builder::get_compiled_select":[152,0,1,""],"CI_Input::get_post":[109,0,1,""],"CI_DB_forge::drop_database":[77,0,1,""],"CI_Form_validation::error_string":[51,0,1,""],"CI_DB_driver::trans_strict":[89,0,1,""],"CI_Trackback::send":[124,0,1,""],camelize:[41,1,1,""],form_button:[94,1,1,""],"CI_User_agent::version":[96,0,1,""],"CI_URI::uri_string":[153,0,1,""],directory_map:[11,1,1,""],strip_image_tags:[70,1,1,""],"CI_Upload::do_upload":[131,0,1,""],gmt_to_local:[93,1,1,""],"CI_DB_query_builder::get":[152,0,1,""],"CI_DB_driver::list_tables":[89,0,1,""],current_url:[82,1,1,""],"CI_Lang::line":[140,0,1,""],mb_substr:[25,1,1,""],"CI_Input::input_stream":[109,0,1,""],"CI_Cart::contents":[133,0,1,""],"CI_Xmlrpc::send_error_message":[99,0,1,""],"CI_Trackback::send_error":[124,0,1,""],"CI_DB_result::first_row":[56,0,1,""],"CI_DB_query_builder::or_where":[152,0,1,""],"CI_DB_query_builder::having":[152,0,1,""],"CI_Config::slash_item":[7,0,1,""],"CI_Table::clear":[127,0,1,""],"CI_DB_driver::trans_start":[89,0,1,""],"CI_Cart::remove":[133,0,1,""],"CI_Upload::data":[131,0,1,""],CI_Benchmark:[42,2,1,""],"CI_Output::cache":[100,0,1,""],"CI_Zip::get_zip":[115,0,1,""],CI_DB_driver:[89,2,1,""],Some_class:[81,2,1,""],form_reset:[94,1,1,""],"CI_DB_query_builder::select_min":[152,0,1,""],"CI_FTP::rename":[151,0,1,""],"CI_Trackback::receive":[124,0,1,""],"CI_Loader::helper":[111,0,1,""],form_fieldset_close:[94,1,1,""],"CI_DB_result::free_result":[56,0,1,""],"CI_DB_utility::backup":[76,0,1,""],"CI_DB_result::unbuffered_row":[56,0,1,""],"CI_Trackback::convert_ascii":[124,0,1,""],"CI_Security::xss_clean":[143,0,1,""],set_select:[94,1,1,""],quotes_to_entities:[138,1,1,""],form_open:[94,1,1,""],"CI_URI::slash_segment":[153,0,1,""],"Some_class::should_do_something":[81,0,1,""],"CI_FTP::connect":[151,0,1,""],"CI_Loader::view":[111,0,1,""],"CI_Image_lib::display_errors":[54,0,1,""],"CI_DB_driver::trans_status":[89,0,1,""],"CI_Encryption::encrypt":[80,0,1,""],"CI_DB_query_builder::or_not_group_start":[152,0,1,""],"CI_Migration::version":[88,0,1,""],CI_DB_result:[56,2,1,""],"CI_DB_query_builder::replace":[152,0,1,""],"CI_DB_driver::cache_delete":[89,0,1,""],"CI_Trackback::extract_urls":[124,0,1,""],"CI_Form_validation::set_message":[51,0,1,""],array_column:[25,1,1,""],url_title:[82,1,1,""],get_instance:[125,1,1,""],"CI_Typography::format_characters":[20,0,1,""],trim_slashes:[138,1,1,""],xml_convert:[1,1,1,""],"CI_DB_query_builder::or_having":[152,0,1,""],"CI_DB_query_builder::from":[152,0,1,""],show_error:[46,1,1,""],"CI_DB_query_builder::offset":[152,0,1,""],singular:[41,1,1,""],"CI_DB_result::field_data":[56,0,1,""],show_404:[46,1,1,""],array_replace_recursive:[25,1,1,""],random_element:[145,1,1,""],"CI_Security::sanitize_filename":[143,0,1,""],form_checkbox:[94,1,1,""],"CI_Trackback::validate_url":[124,0,1,""],"CI_User_agent::is_robot":[96,0,1,""],"CI_Email::message":[23,0,1,""],"CI_FTP::close":[151,0,1,""],create_captcha:[148,1,1,""],"CI_Config::item":[7,0,1,""],"CI_DB_driver::db_pconnect":[89,0,1,""],"CI_Cart::destroy":[133,0,1,""],"CI_Input::user_agent":[109,0,1,""],element:[145,1,1,""],CI_Lang:[140,2,1,""],days_in_month:[93,1,1,""],"CI_Session::unset_userdata":[106,0,1,""],"CI_Encrypt::set_mode":[112,0,1,""],"CI_DB_utility::csv_from_result":[76,0,1,""],"CI_Cache::decrement":[67,0,1,""],"CI_DB_query_builder::get_compiled_update":[152,0,1,""],"CI_Form_validation::error":[51,0,1,""],form_submit:[94,1,1,""],"CI_DB_driver::count_all":[89,0,1,""],"CI_DB_query_builder::update_batch":[152,0,1,""],"CI_DB_result::num_rows":[56,0,1,""],"CI_DB_driver::field_exists":[89,0,1,""],"CI_Trackback::limit_characters":[124,0,1,""],CI_Output:[100,2,1,""],password_hash:[25,1,1,""],CI_Encrypt:[112,2,1,""],"CI_Table::set_caption":[127,0,1,""],CI_Image_lib:[54,2,1,""],config_item:[108,1,1,""],"CI_Migration::find_migrations":[88,0,1,""],get_clickable_smileys:[13,1,1,""],form_password:[94,1,1,""],"CI_DB_query_builder::truncate":[152,0,1,""],"CI_Email::from":[23,0,1,""],"CI_User_agent::charsets":[96,0,1,""],ellipsize:[150,1,1,""],CI_Config:[7,2,1,""],"CI_Typography::nl2br_except_pre":[20,0,1,""],"CI_Zip::clear_data":[115,0,1,""],timezone_menu:[93,1,1,""],now:[93,1,1,""],"CI_DB_query_builder::count_all_results":[152,0,1,""],set_value:[94,1,1,""],strip_slashes:[138,1,1,""],"CI_DB_query_builder::or_where_not_in":[152,0,1,""],"CI_User_agent::accept_lang":[96,0,1,""],"CI_DB_query_builder::where_not_in":[152,0,1,""],highlight_phrase:[150,1,1,""],CI_Encryption:[80,2,1,""],"CI_Input::ip_address":[109,0,1,""],smiley_js:[13,1,1,""],"CI_URI::slash_rsegment":[153,0,1,""],"CI_DB_driver::db_set_charset":[89,0,1,""],"CI_Encrypt::set_cipher":[112,0,1,""],"CI_DB_driver::version":[89,0,1,""],"CI_Xmlrpc::timeout":[99,0,1,""],is_really_writable:[108,1,1,""],"CI_DB_driver::elapsed_time":[89,0,1,""],set_realpath:[110,1,1,""],"CI_Benchmark::elapsed_time":[42,0,1,""],nice_date:[93,1,1,""],"CI_DB_query_builder::update":[152,0,1,""],"CI_URI::segment_array":[153,0,1,""],CI_Cache:[67,2,1,""],"CI_DB_query_builder::reset_query":[152,0,1,""],"CI_Session::umark_flash":[106,0,1,""],"CI_DB_query_builder::not_group_start":[152,0,1,""],plural:[41,1,1,""],remove_invisible_characters:[108,1,1,""],"CI_Calendar::adjust_date":[19,0,1,""],"CI_DB_driver::call_function":[89,0,1,""],hash_equals:[25,1,1,""],CI_Pagination:[63,2,1,""],is_countable:[41,1,1,""],"CI_DB_result::list_fields":[56,0,1,""],"CI_Input::post_get":[109,0,1,""],"CI_Security::get_csrf_hash":[143,0,1,""],"CI_Table::set_template":[127,0,1,""],"CI_Image_lib::resize":[54,0,1,""],"CI_Config::load":[7,0,1,""],"CI_DB_driver::table_exists":[89,0,1,""],link_tag:[6,1,1,""],"CI_User_agent::mobile":[96,0,1,""],"CI_DB_query_builder::start_cache":[152,0,1,""],"CI_Email::bcc":[23,0,1,""],"CI_DB_driver::list_fields":[89,0,1,""],"CI_Encrypt::encode_from_legacy":[112,0,1,""],"CI_DB_driver::db_connect":[89,0,1,""],"CI_DB_query_builder::insert":[152,0,1,""],increment_string:[138,1,1,""],form_open_multipart:[94,1,1,""],"CI_Email::reply_to":[23,0,1,""],"CI_Cache::cache_info":[67,0,1,""],"CI_DB_query_builder::select":[152,0,1,""],"CI_DB_query_builder::flush_cache":[152,0,1,""],"CI_Cart::product_options":[133,0,1,""],"CI_Loader::database":[111,0,1,""],"CI_Benchmark::memory_usage":[42,0,1,""],prep_url:[82,1,1,""],"CI_URI::uri_to_assoc":[153,0,1,""],encode_php_tags:[70,1,1,""],"CI_DB_query_builder::empty_table":[152,0,1,""],"CI_DB_query_builder::get_where":[152,0,1,""],"CI_Calendar::initialize":[19,0,1,""],"CI_DB_query_builder::group_end":[152,0,1,""],"CI_Parser::set_delimiters":[118,0,1,""],"CI_DB_query_builder::select_sum":[152,0,1,""],"CI_DB_forge::add_key":[77,0,1,""],"CI_Config::site_url":[7,0,1,""],"CI_Form_validation::has_rule":[51,0,1,""],"CI_URI::total_segments":[153,0,1,""],"CI_Email::attach":[23,0,1,""],"CI_Session::__set":[106,0,1,""],"CI_DB_forge::drop_column":[77,0,1,""],"CI_DB_utility::list_databases":[76,0,1,""],reduce_double_slashes:[138,1,1,""],"CI_Loader::dbforge":[111,0,1,""],"CI_Table::add_row":[127,0,1,""],"CI_Upload::initialize":[131,0,1,""],valid_email:[129,1,1,""],"CI_DB_result::next_row":[56,0,1,""],CI_Unit_test:[146,2,1,""],"CI_Cache::increment":[67,0,1,""],"CI_Session::sess_regenerate":[106,0,1,""],index_page:[82,1,1,""],delete_files:[117,1,1,""],is_php:[108,1,1,""],"CI_Email::set_alt_message":[23,0,1,""],"CI_Encryption::create_key":[80,0,1,""],"CI_Output::append_output":[100,0,1,""],"CI_Encryption::decrypt":[80,0,1,""],"CI_Table::set_heading":[127,0,1,""],humanize:[41,1,1,""],"CI_Session::__get":[106,0,1,""],anchor_popup:[82,1,1,""],"CI_DB_result::data_seek":[56,0,1,""],"CI_Session::sess_destroy":[106,0,1,""],"CI_Trackback::data":[124,0,1,""],"CI_DB_utility::xml_from_result":[76,0,1,""],"CI_Session::flashdata":[106,0,1,""],"CI_DB_driver::cache_off":[89,0,1,""],"CI_Config::system_url":[7,0,1,""],"CI_Loader::model":[111,0,1,""],"CI_Unit_test::active":[146,0,1,""],"CI_Session::has_userdata":[106,0,1,""],"CI_Cache::save":[67,0,1,""],"CI_Xmlrpc::server":[99,0,1,""],"CI_DB_query_builder::set_update_batch":[152,0,1,""],"CI_Session::userdata":[106,0,1,""],CI_Email:[23,2,1,""],"CI_Session::umark_temp":[106,0,1,""],set_status_header:[108,1,1,""],convert_accented_characters:[150,1,1,""],CI_Cart:[133,2,1,""],alternator:[138,1,1,""],"CI_Session::set_tempdata":[106,0,1,""],"CI_Unit_test::run":[146,0,1,""],"CI_Migration::current":[88,0,1,""],"CI_Loader::config":[111,0,1,""],"CI_Output::set_status_header":[100,0,1,""],CI_Zip:[115,2,1,""],"CI_Loader::driver":[111,0,1,""],nl2br_except_pre:[47,1,1,""],random_string:[138,1,1,""],"CI_Cart::total_items":[133,0,1,""],CI_FTP:[151,2,1,""],"CI_Unit_test::report":[146,0,1,""],"CI_Cart::total":[133,0,1,""],redirect:[82,1,1,""],strip_quotes:[138,1,1,""],"CI_Email::print_debugger":[23,0,1,""],"CI_User_agent::is_mobile":[96,0,1,""],mb_strpos:[25,1,1,""],"CI_Security::get_random_bytes":[143,0,1,""],CI_Parser:[118,2,1,""],"CI_DB_result::set_row":[56,0,1,""],"CI_DB_query_builder::stop_cache":[152,0,1,""],"CI_DB_driver::last_query":[89,0,1,""],ascii_to_entities:[150,1,1,""],CI_DB_forge:[77,2,1,""],"CI_Xmlrpc::display_error":[99,0,1,""],"CI_User_agent::agent_string":[96,0,1,""],octal_permissions:[117,1,1,""],form_error:[94,1,1,""],xss_clean:[70,1,1,""],"CI_Calendar::parse_template":[19,0,1,""],form_multiselect:[94,1,1,""],"CI_FTP::delete_file":[151,0,1,""],get_cookie:[92,1,1,""],"CI_DB_result::result_object":[56,0,1,""],highlight_code:[150,1,1,""],"CI_Email::cc":[23,0,1,""],"CI_Cart::has_options":[133,0,1,""],"CI_Session::set_flashdata":[106,0,1,""],"CI_Input::post":[109,0,1,""],local_to_gmt:[93,1,1,""],"CI_Image_lib::watermark":[54,0,1,""],"CI_Session::get_flash_keys":[106,0,1,""],"CI_Form_validation::error_array":[51,0,1,""],"CI_Xmlrpc::display_response":[99,0,1,""],timezones:[93,1,1,""],"CI_User_agent::is_referral":[96,0,1,""],password_get_info:[25,1,1,""],"CI_DB_driver::primary":[89,0,1,""],send_email:[129,1,1,""],"CI_DB_driver::close":[89,0,1,""],form_input:[94,1,1,""],"CI_Form_validation::reset_validation":[51,0,1,""],validation_errors:[94,1,1,""],"CI_Table::make_columns":[127,0,1,""],"CI_Loader::get_vars":[111,0,1,""],"CI_DB_query_builder::delete":[152,0,1,""],form_close:[94,1,1,""],"CI_DB_driver::initialize":[89,0,1,""],"CI_Input::get":[109,0,1,""],"CI_URI::ruri_string":[153,0,1,""],"CI_Xmlrpc::send_request":[99,0,1,""],"CI_Loader::add_package_path":[111,0,1,""],"CI_DB_query_builder::set_insert_batch":[152,0,1,""],"CI_Session::mark_as_temp":[106,0,1,""],"CI_Calendar::default_template":[19,0,1,""],"CI_Xmlrpc::request":[99,0,1,""],"CI_Form_validation::set_rules":[51,0,1,""],"CI_URI::total_rsegments":[153,0,1,""],"CI_Encryption::hkdf":[80,0,1,""],"CI_Output::enable_profiler":[100,0,1,""],"CI_Cache::delete":[67,0,1,""],"CI_DB_query_builder::or_like":[152,0,1,""],"CI_DB_result::row":[56,0,1,""],"CI_Cart::get_item":[133,0,1,""],"CI_Config::base_url":[7,0,1,""],"CI_Encryption::initialize":[80,0,1,""],img:[6,1,1,""],CI_Trackback:[124,2,1,""],"CI_User_agent::browser":[96,0,1,""],CI_Session:[106,2,1,""],"CI_DB_result::custom_result_object":[56,0,1,""],set_radio:[94,1,1,""],"CI_Security::get_csrf_token_name":[143,0,1,""],"CI_DB_forge::create_table":[77,0,1,""],"CI_DB_utility::optimize_database":[76,0,1,""],"CI_Cart::update":[133,0,1,""],"CI_Lang::load":[140,0,1,""],"CI_Loader::vars":[111,0,1,""],"CI_Table::set_empty":[127,0,1,""],"CI_Migration::error_string":[88,0,1,""],mailto:[82,1,1,""],hash_pbkdf2:[25,1,1,""],CI_Form_validation:[51,2,1,""],"CI_DB_query_builder::set_dbprefix":[152,0,1,""],timespan:[93,1,1,""],reduce_multiples:[138,1,1,""],"CI_Form_validation::set_error_delimiters":[51,0,1,""],"CI_Email::subject":[23,0,1,""],"CI_FTP::upload":[151,0,1,""],delete_cookie:[92,1,1,""],"CI_Zip::add_dir":[115,0,1,""],get_filenames:[117,1,1,""],"CI_DB_result::num_fields":[56,0,1,""],unix_to_human:[93,1,1,""],array_replace:[25,1,1,""],"CI_Input::set_cookie":[109,0,1,""],"CI_Session::set_userdata":[106,0,1,""],"CI_DB_query_builder::distinct":[152,0,1,""],"CI_Unit_test::use_strict":[146,0,1,""],CI_Upload:[131,2,1,""],"CI_DB_driver::trans_off":[89,0,1,""],form_upload:[94,1,1,""],hex2bin:[25,1,1,""],CI_Calendar:[19,2,1,""],parse_smileys:[13,1,1,""],"CI_DB_query_builder::select_avg":[152,0,1,""],anchor:[82,1,1,""],uri_string:[82,1,1,""],"CI_Form_validation::run":[51,0,1,""],"CI_DB_driver::cache_on":[89,0,1,""],"CI_Output::get_output":[100,0,1,""],"CI_DB_driver::escape_str":[89,0,1,""],"CI_DB_query_builder::or_group_start":[152,0,1,""],human_to_unix:[93,1,1,""],"CI_Output::set_header":[100,0,1,""],"CI_Input::request_headers":[109,0,1,""],"CI_Loader::file":[111,0,1,""],word_censor:[150,1,1,""],"CI_DB_forge::modify_column":[77,0,1,""],CI_Xmlrpc:[99,2,1,""],form_fieldset:[94,1,1,""],"CI_Email::set_header":[23,0,1,""],"CI_Cart::insert":[133,0,1,""],"CI_Loader::remove_package_path":[111,0,1,""],"CI_Security::entity_decode":[143,0,1,""],"CI_Session::get_temp_keys":[106,0,1,""],"CI_DB_driver::escape":[89,0,1,""],"CI_FTP::move":[151,0,1,""],form_label:[94,1,1,""],"CI_DB_driver::protect_identifiers":[89,0,1,""],"CI_Cache::get":[67,0,1,""],"CI_DB_result::previous_row":[56,0,1,""],"CI_DB_query_builder::group_start":[152,0,1,""],"CI_Zip::download":[115,0,1,""],"CI_DB_driver::escape_identifiers":[89,0,1,""],"CI_Loader::get_var":[111,0,1,""],"CI_User_agent::parse":[96,0,1,""],"CI_Encrypt::decode":[112,0,1,""],"CI_Cache::clean":[67,0,1,""],html_escape:[108,1,1,""],symbolic_permissions:[117,1,1,""],form_hidden:[94,1,1,""],log_message:[46,1,1,""],"CI_DB_driver::cache_set_path":[89,0,1,""],"CI_Unit_test::set_template":[146,0,1,""],"CI_DB_driver::field_data":[89,0,1,""],"CI_URI::rsegment":[153,0,1,""],"CI_Loader::language":[111,0,1,""],get_dir_file_info:[117,1,1,""],set_checkbox:[94,1,1,""],"CI_Input::cookie":[109,0,1,""],"CI_Cache::get_metadata":[67,0,1,""],"CI_URI::assoc_to_uri":[153,0,1,""],"CI_Benchmark::mark":[42,0,1,""],"CI_FTP::changedir":[151,0,1,""],"CI_Parser::parse":[118,0,1,""],"CI_Pagination::create_links":[63,0,1,""],entity_decode:[47,1,1,""],"CI_FTP::chmod":[151,0,1,""],do_hash:[70,1,1,""],password_verify:[25,1,1,""],safe_mailto:[82,1,1,""],"Some_class::some_method":[81,0,1,""],"CI_Image_lib::clear":[54,0,1,""],character_limiter:[150,1,1,""],"CI_DB_result::result":[56,0,1,""],"CI_DB_query_builder::or_not_like":[152,0,1,""],"CI_FTP::download":[151,0,1,""],"CI_Zip::read_file":[115,0,1,""],"CI_Unit_test::result":[146,0,1,""],"CI_Zip::archive":[115,0,1,""],"CI_DB_driver::is_write_type":[89,0,1,""],"CI_Calendar::generate":[19,0,1,""],"CI_Form_validation::set_data":[51,0,1,""],read_file:[117,1,1,""],"CI_URI::rsegment_array":[153,0,1,""],"CI_DB_driver::compile_binds":[89,0,1,""],password_needs_rehash:[25,1,1,""],"CI_DB_result::row_object":[56,0,1,""],"CI_Xmlrpc::initialize":[99,0,1,""],"CI_Upload::display_errors":[131,0,1,""],auto_typography:[47,1,1,""],CI_Table:[127,2,1,""],CI_Input:[109,2,1,""],"CI_Trackback::set_error":[124,0,1,""],"CI_Image_lib::initialize":[54,0,1,""],"CI_DB_forge::rename_table":[77,0,1,""],"CI_DB_result::custom_row_object":[56,0,1,""],CI_URI:[153,2,1,""],form_dropdown:[94,1,1,""],br:[6,1,1,""],"CI_DB_utility::optimize_table":[76,0,1,""],"CI_Input::valid_ip":[109,0,1,""],"CI_URI::ruri_to_assoc":[153,0,1,""],"CI_DB_query_builder::where_in":[152,0,1,""],ol:[6,1,1,""],"CI_Output::set_content_type":[100,0,1,""],"CI_User_agent::referrer":[96,0,1,""],"CI_Input::is_ajax_request":[109,0,1,""],quoted_printable_encode:[25,1,1,""],"CI_DB_driver::insert_string":[89,0,1,""],"CI_DB_query_builder::set":[152,0,1,""],"CI_Email::attachment_cid":[23,0,1,""],"CI_DB_driver::display_error":[89,0,1,""],"CI_DB_query_builder::order_by":[152,0,1,""],"CI_Input::method":[109,0,1,""],"CI_Xmlrpc::method":[99,0,1,""],"CI_Input::is_cli_request":[109,0,1,""],"CI_DB_result::row_array":[56,0,1,""],CI_User_agent:[96,2,1,""],"CI_Session::all_userdata":[106,0,1,""],"CI_Session::tempdata":[106,0,1,""],"CI_DB_query_builder::insert_batch":[152,0,1,""],"CI_Trackback::convert_xml":[124,0,1,""],"CI_Output::set_profiler_sections":[100,0,1,""],"CI_Pagination::initialize":[63,0,1,""],"CI_Zip::read_dir":[115,0,1,""],"CI_DB_driver::escape_like_str":[89,0,1,""],"CI_Zip::add_data":[115,0,1,""],"CI_Email::send":[23,0,1,""],"CI_Loader::is_loaded":[111,0,1,""],repeater:[138,1,1,""],is_cli:[108,1,1,""],"CI_DB_query_builder::select_max":[152,0,1,""],"CI_Output::get_header":[100,0,1,""],get_mime_by_extension:[117,1,1,""],"CI_Trackback::get_id":[124,0,1,""],mb_strlen:[25,1,1,""],"CI_User_agent::accept_charset":[96,0,1,""],"CI_DB_query_builder::get_compiled_insert":[152,0,1,""],"CI_Email::clear":[23,0,1,""],"CI_DB_query_builder::group_by":[152,0,1,""],"CI_FTP::mkdir":[151,0,1,""],is_https:[108,1,1,""],ul:[6,1,1,""],"CI_Output::get_content_type":[100,0,1,""],meta:[6,1,1,""],"CI_DB_forge::create_database":[77,0,1,""],"CI_User_agent::robot":[96,0,1,""],get_mimes:[108,1,1,""],"CI_DB_forge::drop_table":[77,0,1,""],word_wrap:[150,1,1,""],set_cookie:[92,1,1,""],"CI_Loader::dbutil":[111,0,1,""],"CI_DB_driver::total_queries":[89,0,1,""],"CI_DB_query_builder::dbprefix":[152,0,1,""],"CI_Email::to":[23,0,1,""],"CI_DB_driver::query":[89,0,1,""],"CI_Trackback::display_errors":[124,0,1,""],"CI_Loader::get_package_paths":[111,0,1,""],"CI_Table::generate":[127,0,1,""],"CI_Config::set_item":[7,0,1,""],"CI_User_agent::platform":[96,0,1,""],"CI_DB_result::result_array":[56,0,1,""],"CI_Loader::library":[111,0,1,""],elements:[145,1,1,""],"CI_User_agent::languages":[96,0,1,""],"CI_DB_query_builder::like":[152,0,1,""],CI_Typography:[20,2,1,""],"CI_Image_lib::crop":[54,0,1,""],function_usable:[108,1,1,""],lang:[86,1,1,""],"CI_Trackback::process":[124,0,1,""],"CI_Session::mark_as_flash":[106,0,1,""],"CI_Loader::clear_vars":[111,0,1,""],CI_DB_utility:[76,2,1,""],"CI_DB_query_builder::join":[152,0,1,""],CI_Migration:[88,2,1,""],form_radio:[94,1,1,""],"CI_FTP::list_files":[151,0,1,""],"CI_User_agent::is_browser":[96,0,1,""],"CI_Trackback::send_success":[124,0,1,""],"CI_Parser::parse_string":[118,0,1,""]}},titleterms:{all:[142,34],code:[128,114],chain:152,queri:[5,97,76,128,56,49,83,152,114],month:19,prefix:[9,27,49,113],row:[133,56],content:[0,77,79,128,50,51],privat:[128,0],specif:[51,80,152],depend:25,friendli:134,send:[23,99,124],form_prep:33,digit:63,string:[5,77,128,138,33,25],fals:[128,33],util:[9,76],verb:101,my_secur:102,word:23,fadeout:44,list:[48,76,113],upload:131,"try":[50,0,131,99,51],item:[44,33,22,57,7,133],adjust:104,quick:114,sign:144,design:53,cache_on:34,pass:[9,0,19,77],download:[43,147],slidetoggl:44,compat:[25,128,104,144],index:[72,5,3,95,103,39],what:[0,99,79,133,27,50,106],hide:[63,44,142],sub:[9,0,137],compar:128,section:[84,81,21],current:63,delet:[152,18],version:[9,114,4,29],xss_clean:33,method:[0,152,54,81,33,56,83,128,51],metadata:[48,106],hash:25,gener:[52,134,56,24,146],is_cli_request:33,punch:134,directory_map:33,let:[50,0],cart:[133,33],address:121,path:[44,110],modifi:77,encryption_kei:80,valu:[30,94,97,33,128],convert:104,memcach:[106,67],bbedit:128,credit:130,chang:[127,51,33,103,29],portabl:80,overrid:[23,33],via:50,display_error:142,prefer:[63,23,19,54,131,88,106,76],base_url:[30,33],deprec:[33,95],instal:[52,55,135],redi:[106,67],total:42,select:152,from:[3,120,98,83,102,103,104,105,57,58,59,60,17,62,123,4,15,72,73,74,75,77,122,30,31,32,33,95,35,36,37,38,39,121,61,40,68,157,126,156,16,158],zip:115,memori:42,internation:140,upgrad:[3,98,120,102,103,104,105,57,58,59,60,17,62,123,4,15,72,73,74,75,122,30,31,32,33,95,35,36,37,38,39,121,61,40,68,157,126,156,16,158],next:[63,19],call:[0,2,102,104,132,51],type:[54,33,99],prep:51,toggl:44,form_valid:33,claus:33,benchmark:[42,84],agent:96,xss:[142,33,143,109],cach:[67,152,18,34],retriev:[48,106,76],setup:44,work:[151,7,80,34,49,18,106],uniqu:33,fetch:[140,7],aliv:149,control:[116,0,139,66,13,154,131,105,51],sqlite:33,stream:109,process:[54,0,131,99,124],time_to_upd:126,wincach:67,"404_overrid":33,templat:[146,19,118,32,33,134,158],topic:[52,24],captcha:148,tag:[128,154],system_url:33,read_fil:33,multipl:[140,27,137,33,14,132,133,114,149,135],goal:53,secur:[70,33,102,142,144,143,109],charset:40,ping:124,write:81,how:[51,80,18,106,34],url_titl:33,instead:33,csv:76,config:[44,3,7,131,51,54,103,104,105,57,58,126,63,72,23,30,31,33,39,121,122,40],updat:[133,120,102,103,104,105,57,58,59,60,17,62,123,15,72,73,74,75,152,122,30,31,32,33,95,35,36,37,38,39,121,61,40,68,157,126,156,16,158],remap:0,cache_delete_al:34,resourc:[9,45],after:33,global_xss_filt:33,random_str:33,date:[33,93],underscor:33,associ:[51,99],trim_slash:33,"short":[128,154],practic:142,light:134,issu:[33,144],alias:13,"switch":140,environ:[14,7],reloc:[3,135],callabl:51,order:152,origin:10,cache_delet:34,move:[102,104,33],autoload:[103,33,57,40,126],reconnect:149,system_path:158,digest:25,paramet:[9,80,99,149],style:[128,144],group:[51,152],cli:[50,32],fix:29,clickabl:13,main:[103,39],easier:83,good:144,"return":[128,33,137],handl:[140,142,46,14,49],auto:[140,27,79,7,45],initi:[44,9,131,133,96,99,54,106,146,19,20,112,114,115,151,76,77,118,80,84,124,127],"break":128,framework:[134,132,14],now:[27,33],introduct:52,drop_tabl:33,name:[116,0,88,76,128,33,9,51],anyth:51,edit:3,troubleshoot:65,drop:77,authent:80,separ:33,mode:[146,80,12],debug:128,register_glob:142,reset:152,weight:134,replac:[3,33,103,105,121,122,113,9],individu:51,"static":139,connect:[149,79],event:44,variabl:[116,44,128,118],ftp:151,typecast:128,space:128,miss:33,profil:[42,84],rel:63,determin:[48,76],watermark:54,migrat:88,manipul:54,free:134,standard:[25,114],cooki:[92,109],base:67,mime:[105,33,121,16],dblib:33,anchor_class:33,indent:128,befor:142,keep:149,filter:[142,33,143,109],length:[80,112],pagin:[63,33],codeignit:[5,59,158,144,141,9,134,135,52,12,120,102,103,104,105,57,58,60,15,16,17,62,123,156,69,75,107,26,72,73,74,28,122,30,31,32,33,81,95,35,36,37,38,39,121,61,40,68,126,43,157,85],timezon:93,first:63,oper:128,suffix:5,fetch_directori:33,arrai:[145,51,114,56,99],number:155,system:113,hook:132,instruct:[104,55],open:128,forgeri:143,convent:9,strict:[146,12],data:[19,137,80,152,142,104,99,106,51,109],licens:78,cache_off:34,messag:[25,51,80,112],statement:128,"final":98,slidedown:44,option:95,tool:81,fetch_method:33,user_ag:[103,122],third_parti:103,apppath:103,enclos:63,than:51,remov:[5,33,95,102,103,104,106,158],structur:[87,154],jqueri:44,store:[104,34,137],bind:49,consumpt:42,typographi:[47,20],ani:[104,33],dash:33,packag:111,reserv:[116,0,101],"null":[128,33],engin:134,callback:[51,101],ancillari:125,destroi:106,rout:[139,33,101,21,22],note:[63,99,118,124,104,106,76],exampl:[63,140,88,76,67,101,151,152,114,127,115,96],thoroughli:134,mit:78,singl:114,anatomi:[99,7,79],simplifi:49,sure:[30,33],who:85,chart:136,textmat:128,beta:[98,3,29],regular:[101,49],pair:118,segment:[0,5],why:50,fetch_class:33,avail:[86,1,129,92,93,94,11,70,138,13,6,145,147,110,148,149,150,117,47,82,155,41],renam:[57,77,135],url:[5,134,33,82,124],tempdata:106,request:[143,99],uri:[0,5,33,101,153,142],doe:[134,18,34],dummi:67,ext:[103,33],bracket:128,clean:134,pars:118,hmac:80,shop:133,show:[44,19,51],text:[54,128,33,140,150],concurr:106,syntax:[154,156],session:[103,33,156,106],corner:44,xml:[99,1,76],cell:19,transact:12,configur:[44,97,80,14],folder:[104,3],local:128,info:52,contribut:[52,144],get:[141,109],express:101,nativ:9,fadein:44,csrf:[142,143],"new":[21,22],report:[146,14,144],requir:[134,81,71],enabl:[5,12,146,34,84,132,18],organ:0,common:108,default_control:33,contain:33,where:104,view:[44,137,66,118,111,154],certif:10,set:[63,27,23,19,44,54,33,101,21,7,84,76,112,113,9,51,131,80],tablesort:44,mysql:33,highlight_phras:33,result:[76,114,56,152],respons:99,close:[128,149],calendar:[19,3,44],best:142,kei:[16,112,77],databas:[72,52,97,76,77,79,33,34,49,48,83,39,148,142,106,114,149,103,91,126],label:140,dynam:137,approach:12,email:[129,23,33],attribut:63,altern:[67,154],call_funct:2,extend:[9,27,132,113],all_userdata:33,javascript:[44,33],extens:[104,33,134],popul:51,protect:[142,49],last:63,delimit:51,plugin:[44,104],pdo:33,tutori:[51,64,13,52],logic:[128,139],improv:34,prep_for_form:95,load:[86,140,1,129,7,9,92,93,94,11,70,137,138,13,102,104,6,45,145,147,150,110,148,27,79,117,47,82,155,41],point:[42,132,84],overview:[51,13,26],loader:111,header:158,rpc:99,guid:[128,131,52,104,57,58,15,16,17,126,40,72,73,74,75,37,38,39,122,123,68,156,157,158],empti:[30,33],github:43,basic:[52,49],magic_quotes_runtim:142,argument:128,present:48,look:[152,127],defin:[0,132],behavior:[80,14],error:[72,12,128,32,33,46,14,49,99,51,158],anchor:63,loop:137,pack:134,file:[117,5,87,59,3,128,7,95,131,9,51,60,120,54,154,14,140,102,103,104,105,57,58,106,15,16,17,62,63,123,67,111,126,75,142,72,73,74,23,76,122,30,31,32,33,34,35,36,37,38,39,121,61,40,68,88,156,157,158],helper:[86,1,129,90,92,93,94,51,52,11,70,138,13,56,104,6,145,147,150,110,148,27,117,33,47,82,83,155,41],slideup:44,tabl:[76,77,128,48,103,121,124,156,127],site:[143,34],inform:83,parent:104,inflector:41,develop:10,welcom:[52,85],get_post:33,perform:34,make:[30,83,33],cross:143,same:132,fragment:118,html:[6,33,127],document:[81,134,76,144],http:101,optim:76,driver:[87,28,89,67,33,80,106],effect:[44,14],user:[134,96,52,104,57,58,15,16,17,126,40,72,73,74,75,37,38,39,122,123,68,156,157,158],mani:33,php:[72,5,144,122,128,31,67,33,95,154,103,39,105,57,58,40,121,126,109],sha1:33,builder:[97,152,114],object:[114,56],anim:44,client:99,command:50,thi:[86,1,2,129,34,92,93,94,11,70,138,13,6,145,147,110,148,150,117,47,82,155,41],model:[75,79,66,21,22,126],explan:[51,97,99],comment:128,identifi:49,execut:[83,42],tip:[106,144],"_post":51,toggleclass:44,languag:[86,140,33,3,40],previous:33,web:18,get_dir_file_info:104,add:[3,40,126],valid:[51,33,156,142],guidelin:144,input:[142,33,109],save:51,applic:[136,31,104,111,84,134,135],format:[128,99],world:[50,0],password:[25,142],insert:[142,114,152],do_hash:33,success:[51,131],whitespac:128,manual:[12,49,7,149],server:[109,99,71],necessari:104,cascad:51,output:[0,100],manag:[12,34,135],subhead:81,parenthet:128,"export":76,bonu:106,apc:67,librari:[52,23,44,33,80,102,146,112,119,9,106,107],confirm:158,definit:96,per:128,unit:146,overlai:54,refer:[140,89,7,91,131,93,133,51,96,52,99,54,100,56,151,103,106,143,109,63,146,19,20,67,111,88,112,25,152,115,23,76,77,118,80,34,153,124,42,127],core:[104,33,132,113],previou:[63,19,4],run:[50,146,12,135],usag:[88,76,118,67,33,95,151,115],step:[3,120,102,103,104,105,57,58,59,60,17,62,123,15,72,73,74,75,122,30,31,32,33,95,35,36,37,38,39,121,61,40,68,157,126,156,16,158],post:[105,109],mssql:33,about:[83,106],column:77,commun:134,page:[63,0,79,139,81,131,18,50,51],cipher:80,modal:44,constructor:[0,104],backup:76,disabl:[63,146,84],repair:76,own:[27,28,99,101,113,9,51,107],within:[9,137],encod:115,automat:[154,149],two:54,wrap:23,storag:9,your:[0,59,3,44,122,80,95,48,9,51,135,60,99,83,101,84,102,103,104,105,57,58,142,15,16,17,62,19,123,73,68,21,75,107,112,113,149,72,27,74,28,76,79,30,31,32,33,34,35,36,37,38,39,121,61,40,124,157,42,126,156,120,158,127],log:[33,29],support:[154,80,144],fast:134,custom:[63,146,2,80,56,106],standard_d:33,start:[114,141],flashdata:106,add_column:33,"function":[86,1,2,128,129,34,92,93,94,11,70,138,13,6,108,145,147,150,110,148,25,116,27,117,33,47,82,155,41],head:81,form:[140,33,22,131,105,94,51,109],forg:[33,77],link:[63,19],translat:51,line:[50,128,33,140],"true":128,bug:29,conclus:8,count:152,"default":[128,0,80,14,105],bugfix:29,access:[106,109],displai:[133,146,42,19,21],limit:152,sampl:140,similar:152,featur:69,constant:[116,128,31,33,14,103,25,16],creat:[140,146,87,28,19,77,137,113,22,131,88,99,124,9,51,125,107],get_inst:125,multibyt:25,flow:136,parser:118,decrypt:80,exist:[48,76],glanc:134,check:[105,33],echo:154,encrypt:[104,33,16,112,80],when:9,field:[48,51,13,77,94],other:51,branch:144,test:[146,12],imag:54,architectur:53,repeat:33,wildcard:101,"class":[140,0,80,44,128,7,133,131,125,9,51,96,99,54,100,56,151,104,106,143,109,63,146,19,20,67,111,88,112,113,152,114,115,23,76,77,118,33,34,153,84,124,42,127],sql:128,trackback:124,smilei:[13,33],markup:63,receiv:124,algorithm:80,directori:[0,11,3,137,33,87,131,135],descript:76,rule:[51,33,101],potenti:33,time:42,escap:[94,142,49],hello:[50,0]}})
|
src/components/client/perso/PersoPage.js
|
PtitNoony/abretonworkshop
|
'use strict';
import React from 'react';
import { Link } from 'react-router-dom';
import { MenuItem, Nav, Navbar, NavDropdown, NavItem, Tab, Tabs} from 'react-bootstrap';
export default class PersoPage extends React.Component {
render() {
return (
<div className="reactPageContainer">
<div className="abw_page_container">
<Navbar inverse collapseOnSelect>
<Navbar.Header>
<Navbar.Brand>
<a href="/">A Breton's Workshop</a>
</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
<Navbar.Collapse>
<Nav>
<NavItem eventKey={1} onClick={() => this.props.history.push("/bowling")}>Bowling</NavItem>
<NavItem eventKey={2} onClick={() => this.props.history.push("/foe")}>FoE</NavItem>
<NavItem eventKey={3} onClick={() => this.props.history.push("/research")}>Research</NavItem>
<NavItem eventKey={4} >Perso</NavItem>
</Nav>
</Navbar.Collapse>
</Navbar>
<div className="abw_page_content">
<h1>Perso</h1>
<Tabs defaultActiveKey={1} id="persoPageTabs">
<Tab eventKey={1} title="About me">Under construction</Tab>
<Tab eventKey={2} title="CV">Under construction</Tab>
</Tabs>
</div>
</div>
</div>
);
}
}
|
src/components/error-pane/renderer.js
|
jlove29/vega-editor
|
import React from 'react';
import './index.css';
export default class ErrorPane extends React.Component {
render() {
const list = [];
if (this.props.error) {
list.push(<li key={0}><span className='error'>[Error] </span>{this.props.error}</li>);
}
this.props.warningsLogger.warns
.forEach((warning, i) => {
list.push(<li key={i + 1}><span className='warning'>[Warning] </span>{warning}</li>)
});
if (list.length === 0) {
list.push(<li key={'no error'}><span className='info'>[Info] </span>No error or warnings</li>);
}
return (
<div className='error-pane'>
<span onClick={(e) => this.props.showErrorPane()} className='close'>
✖
</span>
<ul>
{list}
</ul>
</div>
);
}
}
|
static-server.js
|
Bernardstanislas/focus-components
|
var components = require('./package.json').components.sort(function(a, b){
if(a.name > b.name){
return 1;
}
if (a.name < b.name){
return -1;
}
return 0;
});
var componentServers = {};
var port = "3000";
/**
* Creates a component map with all existing components.
*/
components.map(function(component) {
var pth = '/' + component.path + '/example/';
console.log('route', component.name, 'path', pth);
componentServers[component.name] = pth; //new static.Server(pth);
});
/**
* Render the existing components list with links.
*/
function componentsUrl(opts) {
opts = opts || {};
var isGhPage = opts.isGhPage || false,
urlRoot = 'http://' + (opts.urlRoot || 'localhost'),
prt = (opts.port !== undefined && opts.port !== '') ? (':' + port + '/') : '';
var sb = "";
for (var component in componentServers) {
sb = sb +
"<li><a href='" + urlRoot +
prt + (isGhPage ? componentServers[component]: component) + "'>" +
component +
"</a><img src ='http://react-components.com/img/react.svg' /></li>";
}
return sb;
}
//Creates a static server for each components example.
var express = require('express');
var app = express();
for (var componentName in componentServers) {
app.use('/' + componentName,
express.static(__dirname + componentServers[componentName])
);
}
function buildPage(opts){
//var style = ' <style>* { box-sizing: border-box; } ul{width: 100%; flex-wrap: wrap; list-style-type: none; display: flex; margin: -1em 0 0 -1em; align-items: flex-start; min-width: 25%;} li{flex-grow: 1; flex: 1; padding: 1em 0 0 1em; align-self: flex-start;}</style>';
var fonts ="<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>"
var style ='<style>body{color: white; background-color: blue; font-family: "Lato", sans-serif;} ul { display: flex; flex-wrap: wrap; list-style-type: none;} li { background: url("https://facebook.github.io/react/img/logo_og.png") bottom center no-repeat; margin-top: 7px; margin-right: 7px; padding-top: 10px; height: 50px; background: white; flex: 1; min-width: 20%; border: 2px solid red;} li a{ text-align: center} li img{width: 20px; }</style> ';
return fonts + style + '<p>The component you requested does not exists</p>' +
'<h1>Components available</h1><ul>' + componentsUrl(opts) +
'</ul>';
}
var page =buildPage({port: port});
var ghPage =buildPage({isGhPage: true, urlRoot: 'kleegroup.github.io/focus-components', port: ''});
app.use('/focus-components/example', express.static(__dirname + "/example"));
app.use('/focus-components/dist', express.static(__dirname + "/dist"));
//Add a special 404 with all existing components and their urls.
app.use(function(req, res, next) {
res.status(404)
.send(page);
});
//Start the application.
app.listen(port, function() {
console.log('application started on port: ', port)
});
//Save the ghPagefile.
//
var fs = require('fs');
fs.writeFile(__dirname + '/components.html', ghPage, function(err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
|
src/app.js
|
bshevchenko/ChronoMint
|
import React from 'react'
import {render} from 'react-dom'
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider'
import themeDefault from './themeDefault'
import injectTapEventPlugin from 'react-tap-event-plugin'
import router from './router.js'
import IPFSDAO from './dao/IPFSDAO'
import OrbitDAO from './dao/OrbitDAO'
import './styles.scss'
import 'font-awesome/css/font-awesome.css'
import 'flexboxgrid/css/flexboxgrid.css'
import ErrorPage from './pages/ErrorPage'
class App {
start () {
IPFSDAO.init().then(ipfsNode => {
OrbitDAO.init(ipfsNode)
/** Needed for onTouchTap @link http://stackoverflow.com/a/34015469/988941 */
injectTapEventPlugin()
render(
<MuiThemeProvider muiTheme={themeDefault}>{router}</MuiThemeProvider>,
document.getElementById('react-root')
)
}).catch(e => {
render(
<MuiThemeProvider muiTheme={themeDefault}>
<ErrorPage error={e} />
</MuiThemeProvider>,
document.getElementById('react-root')
)
})
}
}
export default new App()
|
www/frontend/src/components/News1.js
|
lokiiart/upali-mobile
|
import React from 'react';
const News1 = () => {
return (
<div className="product sub-section section">
<p className="pr content">
广东省省食品药品监督管理局副局长调研我市保健食品生产企业
</p>
<img src="dist/images/news3.png" />
<p className="pr content">
2015年12月13日下午,优波粒(中国)有限公司,接受了省市局一行领导的专访调研。
</p>
<img src="dist/images/news4.png" />
<p className="pr content">
生产营运部总监孙总就企业发展历程、生产技术、生产团队以及原材料的选择和使用等方面进行了讲解,强调了在外部环境不可控的情况下,严格把好企业内部质量关,从生产过程控制、检验检测等关键点建立完整质量控制体系。始终以如履薄冰、如临深渊的状态加强自律,落实企业主体责任。
</p>
<p className="pr content">
陈时飞副局长对我公司的发展予以了肯定,希望企业守法经营、守理经营和守德经营,把好产品质量安全关,以高度的社会责任感,生产出高质量的产品,为百姓健康服务。同时,希望各级保健食品监管部门要研究许可事项的办理,简化程序,服务企业行业,在机构改革时期,加强基础建设,重视保健食品监管机制构建,进一步理清职责,依法履好职、尽好责,促进保健食品产品健康发展。
</p>
</div>
);
};
export default News1;
|
src/components/header.js
|
ak1103dev/ak1103dev.github.io
|
import { Link } from 'gatsby'
import PropTypes from 'prop-types'
import React from 'react'
const Header = ({ siteTitle }) => (
<div
style={{
background: `rebeccapurple`,
marginBottom: `1.45rem`,
}}
>
<div
style={{
margin: `0 auto`,
maxWidth: 960,
padding: `1.45rem 1.0875rem`,
}}
>
<h1 style={{ margin: 0 }}>
<Link
to="/"
style={{
color: `white`,
textDecoration: `none`,
}}
>
{siteTitle}
</Link>
</h1>
</div>
</div>
)
Header.propTypes = {
siteTitle: PropTypes.string,
}
Header.defaultProps = {
siteTitle: ``,
}
export default Header
|
app/renderer/components/widevineInfo.js
|
willy-b/browser-laptop
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
/*
* Educates users that this is DRM, why it is not great, and that
* we don't own the code being executed if it is turned on. Provides
* more info URL link to learn about DRM and Google's license URL link.
*/
const React = require('react')
const ImmutableComponent = require('../../../js/components/immutableComponent')
const appConfig = require('../../../js/constants/appConfig')
const widevineInfoStyle = {
paddingBottom: 10
}
const widevineInfoIconStyle = {
padding: 5
}
const subtextStyle = {
marginBottom: 7
}
class WidevineInfo extends ImmutableComponent {
constructor () {
super()
this.onMoreInfo = this.onMoreInfo.bind(this)
this.onViewLicense = this.onViewLicense.bind(this)
}
onMoreInfo () {
this.props.newFrameAction({
location: appConfig.widevine.moreInfoUrl
}, true)
}
onViewLicense () {
this.props.newFrameAction({
location: appConfig.widevine.licenseUrl
}, true)
}
render () {
return <div style={widevineInfoStyle}>
<div style={subtextStyle} className='subtext'>
<span data-l10n-id='enableWidevineSubtext' />
<span style={widevineInfoIconStyle}
className='fa fa-info-circle'
onClick={this.onMoreInfo}
/>
</div>
<div className='subtext'>
<span data-l10n-id='enableWidevineSubtext2' />
<span style={widevineInfoIconStyle}
className='fa fa-info-circle'
onClick={this.onViewLicense}
/>
</div>
</div>
}
}
module.exports = WidevineInfo
|
src/index.js
|
tmpaul06/gathering-client
|
require('es6-shim');
require('es6-symbol/implement');
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(<App />, document.getElementById('root'));
|
tests/wpt/web-platform-tests/custom-elements/reactions/resources/reactions.js
|
KiChjang/servo
|
let testNumber = 1;
function testNodeConnector(testFunction, name) {
let container = document.createElement('div');
container.appendChild(document.createElement('div'));
document.body.appendChild(container);
test(function () {
var element = define_new_custom_element();
var instance = document.createElement(element.name);
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(container, instance);
assert_array_equals(element.takeLog().types(), ['connected']);
}, name + ' must enqueue a connected reaction');
test(function () {
var element = define_new_custom_element();
var instance = document.createElement(element.name);
assert_array_equals(element.takeLog().types(), ['constructed']);
var newDoc = document.implementation.createHTMLDocument();
testFunction(container, instance);
assert_array_equals(element.takeLog().types(), ['connected']);
testFunction(newDoc.documentElement, instance);
assert_array_equals(element.takeLog().types(), ['disconnected', 'adopted', 'connected']);
}, name + ' must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document');
container.parentNode.removeChild(container);
}
function testNodeDisconnector(testFunction, name) {
let container = document.createElement('div');
container.appendChild(document.createElement('div'));
document.body.appendChild(container);
test(function () {
var element = define_new_custom_element();
var instance = document.createElement(element.name);
assert_array_equals(element.takeLog().types(), ['constructed']);
container.appendChild(instance);
assert_array_equals(element.takeLog().types(), ['connected']);
testFunction(instance, window);
assert_array_equals(element.takeLog().types(), ['disconnected']);
}, name + ' must enqueue a disconnected reaction');
container.parentNode.removeChild(container);
}
function testInsertingMarkup(testFunction, name) {
let container = document.createElement('div');
container.appendChild(document.createElement('div'));
document.body.appendChild(container);
test(function () {
var element = define_new_custom_element();
testFunction(container, `<${element.name}></${element.name}>`);
assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
}, name + ' must enqueue a connected reaction for a newly constructed custom element');
test(function () {
var element = define_new_custom_element(['title']);
testFunction(container, `<${element.name} id="hello" title="hi"></${element.name}>`);
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged', 'connected']);
assert_attribute_log_entry(logEntries[1], {name: 'title', oldValue: null, newValue: 'hi', namespace: null});
}, name + ' must enqueue a attributeChanged reaction for a newly constructed custom element');
container.parentNode.removeChild(container);
}
function testParsingMarkup(testFunction, name) {
test(function () {
var element = define_new_custom_element(['id']);
assert_array_equals(element.takeLog().types(), []);
var instance = testFunction(document, `<${element.name} id="hello" class="foo"></${element.name}>`);
assert_equals(Object.getPrototypeOf(instance.querySelector(element.name)), element.class.prototype);
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged']);
assert_attribute_log_entry(logEntries[1], {name: 'id', oldValue: null, newValue: 'hello', namespace: null});
}, name + ' must construct a custom element');
}
function testCloner(testFunction, name) {
let container = document.createElement('div');
container.appendChild(document.createElement('div'));
document.body.appendChild(container);
test(function () {
var element = define_new_custom_element(['id']);
var instance = document.createElement(element.name);
container.appendChild(instance);
instance.setAttribute('id', 'foo');
assert_array_equals(element.takeLog().types(), ['constructed', 'connected', 'attributeChanged']);
var newInstance = testFunction(instance);
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'id', oldValue: null, newValue: 'foo', namespace: null});
}, name + ' must enqueue an attributeChanged reaction when cloning an element with an observed attribute');
test(function () {
var element = define_new_custom_element(['id']);
var instance = document.createElement(element.name);
container.appendChild(instance);
instance.setAttribute('lang', 'en');
assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
var newInstance = testFunction(instance);
assert_array_equals(element.takeLog().types(), ['constructed']);
}, name + ' must not enqueue an attributeChanged reaction when cloning an element with an unobserved attribute');
test(function () {
var element = define_new_custom_element(['title', 'class']);
var instance = document.createElement(element.name);
container.appendChild(instance);
instance.setAttribute('lang', 'en');
instance.className = 'foo';
instance.setAttribute('title', 'hello world');
assert_array_equals(element.takeLog().types(), ['constructed', 'connected', 'attributeChanged', 'attributeChanged']);
var newInstance = testFunction(instance);
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['constructed', 'attributeChanged', 'attributeChanged']);
assert_attribute_log_entry(logEntries[1], {name: 'class', oldValue: null, newValue: 'foo', namespace: null});
assert_attribute_log_entry(logEntries[2], {name: 'title', oldValue: null, newValue: 'hello world', namespace: null});
}, name + ' must enqueue an attributeChanged reaction when cloning an element only for observed attributes');
}
function testReflectAttributeWithContentValues(jsAttributeName, contentAttributeName, validValue1, contentValue1, validValue2, contentValue2, name, elementName, interfaceName) {
test(function () {
if (elementName === undefined) {
var element = define_new_custom_element([contentAttributeName]);
var instance = document.createElement(element.name);
} else {
var element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName);
var instance = document.createElement(elementName, { is: element.name });
}
assert_array_equals(element.takeLog().types(), ['constructed']);
instance[jsAttributeName] = validValue1;
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: contentAttributeName, oldValue: null, newValue: contentValue1, namespace: null});
}, name + ' must enqueue an attributeChanged reaction when adding ' + contentAttributeName + ' content attribute');
test(function () {
if (elementName === undefined) {
var element = define_new_custom_element([contentAttributeName]);
var instance = document.createElement(element.name);
} else {
var element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName);
var instance = document.createElement(elementName, { is: element.name });
}
instance[jsAttributeName] = validValue1;
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
instance[jsAttributeName] = validValue2;
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: contentAttributeName, oldValue: contentValue1, newValue: contentValue2, namespace: null});
}, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute');
}
function testReflectAttribute(jsAttributeName, contentAttributeName, validValue1, validValue2, name, elementName, interfaceName) {
testReflectAttributeWithContentValues(jsAttributeName, contentAttributeName, validValue1, validValue1, validValue2, validValue2, name, elementName, interfaceName);
}
function testReflectBooleanAttribute(jsAttributeName, contentAttributeName, name, elementName, interfaceName) {
testReflectAttributeWithContentValues(jsAttributeName, contentAttributeName, true, '', false, null, name, elementName, interfaceName);
}
function testReflectAttributeWithContentValuesAndDependentAttributes(jsAttributeName, contentAttributeName, validValue1, contentValue1, validValue2, contentValue2, name, elementName, getParentElement, setAttributes, interfaceName) {
let parentElement = getParentElement();
test(() => {
let element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName);
let instance = document.createElement(elementName, { is: element.name });
assert_array_equals(element.takeLog().types(), ['constructed']);
parentElement.appendChild(instance);
assert_array_equals(element.takeLog().types(), ['connected']);
setAttributes(instance);
instance[jsAttributeName] = validValue1;
let logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), { name: contentAttributeName, oldValue: null, newValue: contentValue1, namespace: null });
}, name + ' must enqueue an attributeChanged reaction when adding a new attribute');
test(() => {
let element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName);
let instance = document.createElement(elementName, { is: element.name });
parentElement.appendChild(instance);
setAttributes(instance);
instance[jsAttributeName] = validValue1;
assert_array_equals(element.takeLog().types(), ['constructed', 'connected', 'attributeChanged']);
instance[jsAttributeName] = validValue2;
let logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), { name: contentAttributeName, oldValue: contentValue1, newValue: contentValue2, namespace: null });
}, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute');
}
function testReflectAttributeWithDependentAttributes(jsAttributeName, contentAttributeName, validValue1, validValue2, name, elementName, getParentElement, setAttributes, interfaceName) {
testReflectAttributeWithContentValuesAndDependentAttributes(jsAttributeName, contentAttributeName, validValue1, validValue1, validValue2, validValue2, name, elementName, getParentElement, setAttributes, interfaceName);
}
function testReflectBooleanAttributeWithDependentAttributes(jsAttributeName, contentAttributeName, name, elementName, getParentElement, setAttributes, interfaceName) {
testReflectAttributeWithContentValuesAndDependentAttributes(jsAttributeName, contentAttributeName, true, '', false, null, name, elementName, getParentElement, setAttributes, interfaceName);
}
function testReflectAttributeWithContentValuesAndParentNode(jsAttributeName, contentAttributeName, validValue1, contentValue1, validValue2, contentValue2, name, elementName, getParentElement, interfaceName) {
let parentElement = getParentElement();
test(() => {
let element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName);
let instance = document.createElement(elementName, { is: element.name });
assert_array_equals(element.takeLog().types(), ['constructed']);
parentElement.appendChild(instance);
assert_array_equals(element.takeLog().types(), ['connected']);
instance[jsAttributeName] = validValue1;
let logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), { name: contentAttributeName, oldValue: null, newValue: contentValue1, namespace: null });
}, name + ' must enqueue an attributeChanged reaction when adding a new attribute');
test(() => {
let element = define_build_in_custom_element([contentAttributeName], interfaceName, elementName);
let instance = document.createElement(elementName, { is: element.name });
parentElement.appendChild(instance);
assert_array_equals(element.takeLog().types(), ['constructed', 'connected']);
instance[jsAttributeName] = validValue1;
assert_array_equals(element.takeLog().types(), ['attributeChanged']);
instance[jsAttributeName] = validValue2;
let logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), { name: contentAttributeName, oldValue: contentValue1, newValue: contentValue2, namespace: null });
}, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute');
}
function testReflectAttributeWithParentNode(jsAttributeName, contentAttributeName, validValue1, validValue2, name, elementName, getParentElement, interfaceName) {
testReflectAttributeWithContentValuesAndParentNode(jsAttributeName, contentAttributeName, validValue1, validValue1, validValue2, validValue2, name, elementName, getParentElement, interfaceName);
}
function testReflectBooleanAttributeWithParentNode(jsAttributeName, contentAttributeName, name, elementName, getParentElement, interfaceName) {
testReflectAttributeWithContentValuesAndParentNode(jsAttributeName, contentAttributeName, true, '', false, null, name, elementName, getParentElement, interfaceName);
}
function testAttributeAdder(testFunction, name) {
test(function () {
var element = define_new_custom_element(['id']);
var instance = document.createElement(element.name);
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, 'id', 'foo');
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'id', oldValue: null, newValue: 'foo', namespace: null});
}, name + ' must enqueue an attributeChanged reaction when adding an attribute');
test(function () {
var element = define_new_custom_element(['class']);
var instance = document.createElement(element.name);
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, 'data-lang', 'en');
assert_array_equals(element.takeLog().types(), []);
}, name + ' must not enqueue an attributeChanged reaction when adding an unobserved attribute');
test(function () {
var element = define_new_custom_element(['title']);
var instance = document.createElement(element.name);
instance.setAttribute('title', 'hello');
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
testFunction(instance, 'title', 'world');
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'title', oldValue: 'hello', newValue: 'world', namespace: null});
}, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute');
test(function () {
var element = define_new_custom_element([]);
var instance = document.createElement(element.name);
instance.setAttribute('data-lang', 'zh');
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, 'data-lang', 'en');
assert_array_equals(element.takeLog().types(), []);
}, name + ' must enqueue an attributeChanged reaction when replacing an existing unobserved attribute');
}
function testAttributeMutator(testFunction, name) {
test(function () {
var element = define_new_custom_element(['title']);
var instance = document.createElement(element.name);
instance.setAttribute('title', 'hello');
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
testFunction(instance, 'title', 'world');
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'title', oldValue: 'hello', newValue: 'world', namespace: null});
}, name + ' must enqueue an attributeChanged reaction when replacing an existing attribute');
test(function () {
var element = define_new_custom_element(['class']);
var instance = document.createElement(element.name);
instance.setAttribute('data-lang', 'zh');
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, 'data-lang', 'en');
assert_array_equals(element.takeLog().types(), []);
}, name + ' must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute');
}
function testAttributeRemover(testFunction, name, options) {
if (options && !options.onlyExistingAttribute) {
test(function () {
var element = define_new_custom_element(['title']);
var instance = document.createElement(element.name);
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, 'title');
assert_array_equals(element.takeLog().types(), []);
}, name + ' must not enqueue an attributeChanged reaction when removing an attribute that does not exist');
}
test(function () {
var element = define_new_custom_element([]);
var instance = document.createElement(element.name);
instance.setAttribute('data-lang', 'hello');
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, 'data-lang');
assert_array_equals(element.takeLog().types(), []);
}, name + ' must not enqueue an attributeChanged reaction when removing an unobserved attribute');
test(function () {
var element = define_new_custom_element(['title']);
var instance = document.createElement(element.name);
instance.setAttribute('title', 'hello');
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
testFunction(instance, 'title');
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'title', oldValue: 'hello', newValue: null, namespace: null});
}, name + ' must enqueue an attributeChanged reaction when removing an existing attribute');
test(function () {
var element = define_new_custom_element([]);
var instance = document.createElement(element.name);
instance.setAttribute('data-lang', 'ja');
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, 'data-lang');
assert_array_equals(element.takeLog().types(), []);
}, name + ' must not enqueue an attributeChanged reaction when removing an existing unobserved attribute');
}
function test_mutating_style_property_value(testFunction, name, options) {
const propertyName = (options || {}).propertyName || 'color';
const idlName = (options || {}).idlName || 'color';
const value1 = (options || {}).value1 || 'blue';
const rule1 = `${propertyName}: ${value1};`;
const value2 = (options || {}).value2 || 'red';
const rule2 = `${propertyName}: ${value2};`;
test(function () {
var element = define_new_custom_element(['style']);
var instance = document.createElement(element.name);
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, propertyName, idlName, value1);
assert_equals(instance.getAttribute('style'), rule1);
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: null, newValue: rule1, namespace: null});
}, name + ' must enqueue an attributeChanged reaction when it adds the observed style attribute');
test(function () {
var element = define_new_custom_element(['title']);
var instance = document.createElement(element.name);
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, propertyName, idlName, value1);
assert_equals(instance.getAttribute('style'), rule1);
assert_array_equals(element.takeLog().types(), []);
}, name + ' must not enqueue an attributeChanged reaction when it adds the style attribute but the style attribute is not observed');
test(function () {
var element = define_new_custom_element(['style']);
var instance = document.createElement(element.name);
testFunction(instance, propertyName, idlName, value1);
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
testFunction(instance, propertyName, idlName, value2);
assert_equals(instance.getAttribute('style'), rule2);
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: rule1, newValue: rule2, namespace: null});
}, name + ' must enqueue an attributeChanged reaction when it mutates the observed style attribute');
test(function () {
var element = define_new_custom_element([]);
var instance = document.createElement(element.name);
testFunction(instance, propertyName, idlName, value1);
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, propertyName, idlName, value2);
assert_equals(instance.getAttribute('style'), rule2);
assert_array_equals(element.takeLog().types(), []);
}, name + ' must not enqueue an attributeChanged reaction when it mutates the style attribute but the style attribute is not observed');
}
function test_removing_style_property_value(testFunction, name) {
test(function () {
var element = define_new_custom_element(['style']);
var instance = document.createElement(element.name);
instance.setAttribute('style', 'color: red; display: none;');
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
testFunction(instance, 'color', 'color');
assert_equals(instance.getAttribute('style'), 'display: none;'); // Don't make this empty since browser behaviors are inconsistent now.
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: 'color: red; display: none;', newValue: 'display: none;', namespace: null});
}, name + ' must enqueue an attributeChanged reaction when it removes a property from the observed style attribute');
test(function () {
var element = define_new_custom_element(['class']);
var instance = document.createElement(element.name);
instance.setAttribute('style', 'color: red; display: none;');
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, 'color', 'color');
assert_equals(instance.getAttribute('style'), 'display: none;'); // Don't make this empty since browser behaviors are inconsistent now.
assert_array_equals(element.takeLog().types(), []);
}, name + ' must not enqueue an attributeChanged reaction when it removes a property from the style attribute but the style attribute is not observed');
}
function test_mutating_style_property_priority(testFunction, name) {
test(function () {
var element = define_new_custom_element(['style']);
var instance = document.createElement(element.name);
instance.setAttribute('style', 'color: red');
assert_array_equals(element.takeLog().types(), ['constructed', 'attributeChanged']);
testFunction(instance, 'color', 'color', true);
assert_equals(instance.getAttribute('style'), 'color: red !important;');
var logEntries = element.takeLog();
assert_array_equals(logEntries.types(), ['attributeChanged']);
assert_attribute_log_entry(logEntries.last(), {name: 'style', oldValue: 'color: red', newValue: 'color: red !important;', namespace: null});
}, name + ' must enqueue an attributeChanged reaction when it makes a property important and the style attribute is observed');
test(function () {
var element = define_new_custom_element(['id']);
var instance = document.createElement(element.name);
instance.setAttribute('style', 'color: red');
assert_array_equals(element.takeLog().types(), ['constructed']);
testFunction(instance, 'color', 'color', true);
assert_equals(instance.getAttribute('style'), 'color: red !important;');
assert_array_equals(element.takeLog().types(), []);
}, name + ' must enqueue an attributeChanged reaction when it makes a property important but the style attribute is not observed');
}
|
src/components/Feedback/Feedback.js
|
jshin47/ireactforyou
|
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import withStyles from 'isomorphic-style-loader/lib/withStyles';
import s from './Feedback.scss';
function Feedback() {
return (
<div className={s.root}>
<div className={s.container}>
<a
className={s.link}
href="https://gitter.im/kriasoft/react-starter-kit"
>Ask a question</a>
<span className={s.spacer}>|</span>
<a
className={s.link}
href="https://github.com/kriasoft/react-starter-kit/issues/new"
>Report an issue</a>
</div>
</div>
);
}
export default withStyles(Feedback, s);
|
packages/material-ui-icons/src/HighlightTwoTone.js
|
Kagami/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path d="M11 20h2v-3.83l3-3V11H8v2.17l3 3z" opacity=".3" /><path d="M6 14l3 3v5h6v-5l3-3V9H6v5zm2-3h8v2.17l-3 3V20h-2v-3.83l-3-3V11zM11 2h2v3h-2zM4.9156 4.4638L7.036 6.586 5.6212 7.9996 3.5008 5.8774zM18.3722 8.0004L16.958 6.5862l2.1213-2.1213 1.4142 1.4142z" /></React.Fragment>
, 'HighlightTwoTone');
|
src/Component.js
|
jeremyxgo/react-component-boilerplate
|
import React from 'react';
import classNames from 'classnames';
import styles from './style.scss';
export default class Component extends React.Component {
static propTypes = {
content: React.PropTypes.string,
onClick: React.PropTypes.func
}
static defaultProps = {
content: 'Component',
onClick: (e) => {
console.log('The `click` function has not been implemented yet.');
}
}
constructor(props) {
super(props);
}
render() {
let className = classNames(
styles.component,
styles.button
);
return (
<div className={className} onClick={this.props.onClick}>
<span>{this.props.content}</span>
</div>
);
}
};
|
packages/flow-upgrade/src/upgrades/0.53.0/ReactUtilityTypes/codemod.js
|
MichaelDeBoey/flow
|
/**
* @format
*/
'use strict';
// All the event names that we need to add <> to.
const SYNTHETIC_EVENT_NAMES = new Set([
'SyntheticEvent',
'SyntheticAnimationEvent',
'SyntheticClipboardEvent',
'SyntheticCompositionEvent',
'SyntheticInputEvent',
'SyntheticUIEvent',
'SyntheticFocusEvent',
'SyntheticKeyboardEvent',
'SyntheticMouseEvent',
'SyntheticDragEvent',
'SyntheticWheelEvent',
'SyntheticTouchEvent',
'SyntheticTransitionEvent',
]);
/**
* This codemod alters, removes, and replaces various React utilities that
* had API changes when upgrading to this version. This includes the following
* list:
*
* - `React$Node`.
* - `React$Element`.
* - `ReactClass`.
* - `ReactComponent`.
* - The return type of React component render.
*/
module.exports = (j, root) => {
const recast = require('recast');
const ReactUtils = require('../../../codemods/ReactUtils')(j);
const reactName = ReactUtils.getImportedReactName(root);
const componentPattern = ReactUtils.getImportedComponentClassPattern(root);
const hasElement = ReactUtils.hasDestructuredElement(root, reactName);
// There is a bug in recast so we can't use `root.find()`. Instead we need to
// visit with recast manually so we can visit the nodes it misses.
root.paths().forEach(path => {
recast.visit(path, {
// Here is where we do all of our transformations.
visitGenericTypeAnnotation: visitGenericTypeAnnotation,
// We want to replace default React imports with a namespace import.
visitImportDeclaration: visitImportDeclaration,
// recast has a bug where it won't visit `superTypeParameters` on class
// declarations and expressions. Fix that here.
visitClassDeclaration: visitClass,
visitClassExpression: visitClass,
});
});
function visitClass(path) {
// Continue traversing the path. This is the default behavior.
this.traverse(path);
// There is a bug in recast which means we end up not traversing
// `superTypeParameters`! So handle that that bug by visiting
// `superTypeParameters` here.
this.visitWithoutReset(path.get('superTypeParameters'));
}
function visitImportDeclaration(path) {
const node = path.node;
// import React from 'react'; ==> import * as React from 'react';
if (
node.importKind === 'value' &&
node.source &&
node.source.type === 'Literal' &&
node.source.value === 'react' &&
node.specifiers.length === 1 &&
node.specifiers[0].type === 'ImportDefaultSpecifier'
) {
node.specifiers[0] = j.importNamespaceSpecifier(node.specifiers[0].local);
}
// Continue traversal if we do not want to apply a transformation to
// this node.
this.traverse(path);
}
function visitGenericTypeAnnotation(path) {
const node = path.node;
// React$Node<any> ==> React.Node
if (
node.id.type === 'Identifier' &&
(node.id.name === 'React$Node' || node.id.name === 'ReactNode')
) {
// React.Node no longer has type parameters.
node.typeParameters = null;
// Use the exported type from the React module. If it does not exist then
// use React$Node.
node.id = reactName
? j.qualifiedTypeIdentifier(
j.identifier(reactName),
j.identifier('Node'),
)
: j.identifier('React$Node');
// We have handled this node. No need to continue traversing.
return false;
}
// React$Element<Config> ==> React.Element<React.ComponentType<Props>>
if (
// React$Element or ReactElement
(node.id.type === 'Identifier' &&
(node.id.name === 'React$Element' ||
node.id.name === 'ReactElement')) ||
// React.Element
(node.id.type === 'QualifiedTypeIdentifier' &&
node.id.qualification &&
node.id.qualification.type === 'Identifier' &&
node.id.qualification.name === reactName &&
node.id.id &&
node.id.id.type === 'Identifier' &&
node.id.id.name === 'Element') ||
// const {Element} = React;
// Element
(hasElement &&
node.id.type === 'Identifier' &&
node.id.name === 'Element')
) {
// If we have no type parameters then add an empty type parameter
// instantiation.
if (!node.typeParameters) {
node.typeParameters = j.typeParameterInstantiation([]);
}
// If we have a first type parameter...
if (node.typeParameters.params[0]) {
const firstTypeParam = node.typeParameters.params[0];
// ...and that type parameter is not `any`, `mixed`, or `*`...
if (
firstTypeParam &&
firstTypeParam.type !== 'AnyTypeAnnotation' &&
firstTypeParam.type !== 'ExistsTypeAnnotation'
) {
// ...then wrap the type parameter with `React.ComponentType<Props>`.
node.typeParameters.params[0] = j.genericTypeAnnotation(
// Get the `React.ComponentType` type name, or use the global.
reactName
? j.qualifiedTypeIdentifier(
j.identifier(reactName),
j.identifier('ComponentType'),
)
: j.identifier('React$ComponentType'),
// Put the type param we are wrapping as the first and only
// type argument.
j.typeParameterInstantiation([firstTypeParam]),
);
}
}
// If we do not have a first type parameter, or our type parameter is `*`
// then we want to use `any` instead. This is because using `*` will often
// cause errors that are unrelated to whether or not the code is correct.
// Almost all of the time when a user writes `React.Element<*>` they meant
// `React.Element<any>`. They just felt bad about writing `any`.
if (
node.typeParameters.params.length === 0 ||
node.typeParameters.params[0].type === 'ExistsTypeAnnotation'
) {
node.typeParameters = j.typeParameterInstantiation([
j.anyTypeAnnotation(),
]);
}
// Update the type identifier to be `React.Element` or the
// equivalent global.
node.id = reactName
? j.qualifiedTypeIdentifier(
j.identifier(reactName),
j.identifier('Element'),
)
: j.identifier('React$Element');
// We have handled this node. No need to continue traversing.
return false;
}
// ReactClass<Config> ==> React.ComponentType<Props>
if (
node.id.type === 'Identifier' &&
node.id.name === 'ReactClass' &&
node.typeParameters &&
node.typeParameters.type === 'TypeParameterInstantiation'
) {
// Replace ReactClass with the new type.
return j.genericTypeAnnotation(
// Get the component type name. Either as a qualified name from our
// React import or using the global.
reactName
? j.qualifiedTypeIdentifier(
j.identifier(reactName),
j.identifier('ComponentType'),
)
: j.identifier('React$ComponentType'),
// Keep the type parameters we had previously.
node.typeParameters,
);
}
// React$Component<Defaults, Props, State> ==> React.Component<Props, State>
if (
((node.id.type === 'Identifier' &&
(node.id.name === 'ReactComponent' ||
node.id.name === 'React$Component')) ||
(componentPattern && componentPattern(node.id))) &&
node.typeParameters &&
node.typeParameters.type === 'TypeParameterInstantiation'
) {
// Remove the default props type argument.
if (node.typeParameters.params.length >= 3) {
node.typeParameters.params.shift();
}
// If the user has destructured React and used Component or PureComponent
// directly then we should not update the identifier of this node.
if (
node.id.type === 'Identifier' &&
(node.id.name === 'Component' || node.id.name === 'PureComponent')
) {
return false;
}
// Replace the identifier with React.Component
node.id = reactName
? j.qualifiedTypeIdentifier(
j.identifier(reactName),
j.identifier('Component'),
)
: j.identifier('React$Component');
// We have handled this node. No need to continue traversing.
return false;
}
// SyntheticEvent ==> SyntheticEvent<>
if (
node.id.type === 'Identifier' &&
SYNTHETIC_EVENT_NAMES.has(node.id.name)
) {
node.typeParameters = j.typeParameterInstantiation([]);
return false;
}
// Continue traversal if we do not want to apply a transformation to
// this node.
this.traverse(path);
}
// render(): React.Element<any> ==> render(): React.Node
if (componentPattern) {
root
.find(j.ClassDeclaration, {
superClass: componentPattern,
body: {type: 'ClassBody'},
})
.forEach(handleReactClassPath);
root
.find(j.ClassExpression, {
superClass: componentPattern,
body: {type: 'ClassBody'},
})
.forEach(handleReactClassPath);
}
function handleReactClassPath(path) {
// For every member in the class's body...
path.node.body.body.forEach(method => {
// If this member is the component's render method and it has a
// return type...
if (
method.type === 'MethodDefinition' &&
method.key &&
method.key.type === 'Identifier' &&
method.key.name === 'render' &&
method.value &&
method.value.type === 'FunctionExpression' &&
method.value.returnType &&
method.value.returnType.type === 'TypeAnnotation'
) {
const returnType = method.value.returnType;
// If this is a return type from render that people commonly use then
// replace it with the new recommendation. React.Node
if (
isRenderReturnReactElement(returnType.typeAnnotation) ||
(returnType.typeAnnotation.type === 'NullableTypeAnnotation' &&
isRenderReturnReactElement(
returnType.typeAnnotation.typeAnnotation,
))
) {
returnType.typeAnnotation = reactName
? j.qualifiedTypeIdentifier(
j.identifier(reactName),
j.identifier('Node'),
)
: j.identifier('React$Node');
}
}
});
}
function isRenderReturnReactElement(node) {
// Is the node React.Element<any>, React.Element<mixed>,
// or React.Element<*>?
return (
reactName &&
node &&
node.type === 'GenericTypeAnnotation' &&
node.id.type === 'QualifiedTypeIdentifier' &&
node.id.qualification.type === 'Identifier' &&
node.id.qualification.name === reactName &&
node.id.id.type === 'Identifier' &&
node.id.id.name === 'Element' &&
node.typeParameters &&
node.typeParameters.type === 'TypeParameterInstantiation' &&
(node.typeParameters.params.length === 0 ||
(node.typeParameters.params[0] &&
(node.typeParameters.params[0].type === 'AnyTypeAnnotation' ||
node.typeParameters.params[0].type === 'ExistsTypeAnnotation')))
);
}
return true;
};
|
src/elements/input.js
|
jessy1092/react-semantify
|
import React from 'react';
import filter from '../filter';
const stateArray = ['loading', 'focus', 'error'];
const defaultClassName = 'ui input';
const componentName = 'Input';
const Basic = React.createClass({
render: function () {
const { props: { className, children, ...other } } = this;
if (typeof children != 'undefined') {
return (
<div {...other} >
{children}
</div>
);
} else {
return (
<div className={className}>
<input {...other}/>
</div>
)
}
}
});
const Input = new filter(Basic)
.stateFilter(stateArray)
.classGenerator(defaultClassName)
.getComposeComponent(componentName);
export default Input;
|
src/svg-icons/content/clear.js
|
lawrence-yu/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ContentClear = (props) => (
<SvgIcon {...props}>
<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>
</SvgIcon>
);
ContentClear = pure(ContentClear);
ContentClear.displayName = 'ContentClear';
ContentClear.muiName = 'SvgIcon';
export default ContentClear;
|
src/app/app.js
|
technics/isomorphic-js
|
'use strict';
import React from 'react';
import App from './components/App';
// Attach the app to the DOM.
React.render(<App />, document.getElementById('app'));
|
src/svg-icons/action/settings-brightness.js
|
tan-jerene/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionSettingsBrightness = (props) => (
<SvgIcon {...props}>
<path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02zM8 16h2.5l1.5 1.5 1.5-1.5H16v-2.5l1.5-1.5-1.5-1.5V8h-2.5L12 6.5 10.5 8H8v2.5L6.5 12 8 13.5V16zm4-7c1.66 0 3 1.34 3 3s-1.34 3-3 3V9z"/>
</SvgIcon>
);
ActionSettingsBrightness = pure(ActionSettingsBrightness);
ActionSettingsBrightness.displayName = 'ActionSettingsBrightness';
ActionSettingsBrightness.muiName = 'SvgIcon';
export default ActionSettingsBrightness;
|
docs/app/Examples/elements/Rail/Types/index.js
|
shengnian/shengnian-ui-react
|
import React from 'react'
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'
const RailTypesExamples = () => (
<ExampleSection title='Types'>
<ComponentExample
title='Rail'
description='A rail can be presented on the left or right side of a container.'
examplePath='elements/Rail/Types/RailExampleRail'
/>
<ComponentExample
title='Internal'
description='A rail can attach itself to the inside of a container.'
examplePath='elements/Rail/Types/RailExampleInternal'
/>
<ComponentExample
title='Dividing'
description='A rail can create a division between itself and a container.'
examplePath='elements/Rail/Types/RailExampleDividing'
/>
</ExampleSection>
)
export default RailTypesExamples
|
docs/src/app/components/pages/components/CircularProgress/ExampleSimple.js
|
matthewoates/material-ui
|
import React from 'react';
import CircularProgress from 'material-ui/CircularProgress';
const CircularProgressExampleSimple = () => (
<div>
<CircularProgress />
<CircularProgress size={60} thickness={7} />
<CircularProgress size={80} thickness={5} />
</div>
);
export default CircularProgressExampleSimple;
|
src/containers/NotFoundPage.js
|
daheim/daheim-app-ui
|
import React from 'react'
import {goBack} from 'react-router-redux'
import {connect} from 'react-redux'
class NotFoundPage extends React.Component {
static propTypes = {
goBack: React.PropTypes.func.isRequired
}
goBack = (e) => {
e.preventDefault()
this.props.goBack()
}
render () {
return (
<div style={{maxWidth: 400, margin: '0 auto', padding: '16px 10px'}}>
<div style={{background: 'rgba(255,255,255,0.9)', borderRadius: 10, padding: 20, paddingTop: 12}}>
<h1 style={{textAlign: 'center'}}>vier null vier</h1>
<p>Seite nicht gefunden. <a href='#' onClick={this.goBack}>Zurück.</a></p>
</div>
</div>
)
}
}
export default connect(null, {goBack})(NotFoundPage)
|
src/frontend/react/App.js
|
FakeYou/voerr
|
import React from 'react';
import { Link } from 'react-router';
import Nav from 'react/components/nav';
import LoginActions from 'flux/actions/LoginActions';
import 'assets/style/app';
export default class App extends React.Component {
componentWillMount() {
LoginActions.requestUser();
}
componentDidUpdate() {
LoginActions.requestUser();
}
render() {
return (
<div>
<Nav/>
{this.props.children}
</div>
);
}
}
|
ajax/libs/yui/3.8.1/event-custom-base/event-custom-base-debug.js
|
dhowe/cdnjs
|
YUI.add('event-custom-base', function (Y, NAME) {
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
*/
Y.Env.evt = {
handles: {},
plugins: {}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* Allows for the insertion of methods that are executed before or after
* a specified method
* @class Do
* @static
*/
var DO_BEFORE = 0,
DO_AFTER = 1,
DO = {
/**
* Cache of objects touched by the utility
* @property objs
* @static
* @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object
* replaces the role of this property, but is considered to be private, and
* is only mentioned to provide a migration path.
*
* If you have a use case which warrants migration to the _yuiaop property,
* please file a ticket to let us know what it's used for and we can see if
* we need to expose hooks for that functionality more formally.
*/
objs: null,
/**
* <p>Execute the supplied method before the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt>
* <dd>Replace the arguments that the original function will be
* called with.</dd>
* <dt></code>Y.Do.Prevent(message)</code></dt>
* <dd>Don't execute the wrapped function. Other before phase
* wrappers will be executed.</dd>
* </dl>
*
* @method before
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {string} handle for the subscription
* @static
*/
before: function(fn, obj, sFn, c) {
// Y.log('Do before: ' + sFn, 'info', 'event');
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_BEFORE, f, obj, sFn);
},
/**
* <p>Execute the supplied method after the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt>
* <dd>Return <code>returnValue</code> instead of the wrapped
* method's original return value. This can be further altered by
* other after phase wrappers.</dd>
* </dl>
*
* <p>The static properties <code>Y.Do.originalRetVal</code> and
* <code>Y.Do.currentRetVal</code> will be populated for reference.</p>
*
* @method after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return {string} handle for the subscription
* @static
*/
after: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_AFTER, f, obj, sFn);
},
/**
* Execute the supplied method before or after the specified function.
* Used by <code>before</code> and <code>after</code>.
*
* @method _inject
* @param when {string} before or after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {string} handle for the subscription
* @private
* @static
*/
_inject: function(when, fn, obj, sFn) {
// object id
var id = Y.stamp(obj), o, sid;
if (!obj._yuiaop) {
// create a map entry for the obj if it doesn't exist, to hold overridden methods
obj._yuiaop = {};
}
o = obj._yuiaop;
if (!o[sFn]) {
// create a map entry for the method if it doesn't exist
o[sFn] = new Y.Do.Method(obj, sFn);
// re-route the method to our wrapper
obj[sFn] = function() {
return o[sFn].exec.apply(o[sFn], arguments);
};
}
// subscriber id
sid = id + Y.stamp(fn) + sFn;
// register the callback
o[sFn].register(sid, fn, when);
return new Y.EventHandle(o[sFn], sid);
},
/**
* Detach a before or after subscription.
*
* @method detach
* @param handle {string} the subscription handle
* @static
*/
detach: function(handle) {
if (handle.detach) {
handle.detach();
}
},
_unload: function(e, me) {
}
};
Y.Do = DO;
//////////////////////////////////////////////////////////////////////////
/**
* Contains the return value from the wrapped method, accessible
* by 'after' event listeners.
*
* @property originalRetVal
* @static
* @since 3.2.0
*/
/**
* Contains the current state of the return value, consumable by
* 'after' event listeners, and updated if an after subscriber
* changes the return value generated by the wrapped function.
*
* @property currentRetVal
* @static
* @since 3.2.0
*/
//////////////////////////////////////////////////////////////////////////
/**
* Wrapper for a displaced method with aop enabled
* @class Do.Method
* @constructor
* @param obj The object to operate on
* @param sFn The name of the method to displace
*/
DO.Method = function(obj, sFn) {
this.obj = obj;
this.methodName = sFn;
this.method = obj[sFn];
this.before = {};
this.after = {};
};
/**
* Register a aop subscriber
* @method register
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype.register = function (sid, fn, when) {
if (when) {
this.after[sid] = fn;
} else {
this.before[sid] = fn;
}
};
/**
* Unregister a aop subscriber
* @method delete
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype._delete = function (sid) {
// Y.log('Y.Do._delete: ' + sid, 'info', 'Event');
delete this.before[sid];
delete this.after[sid];
};
/**
* <p>Execute the wrapped method. All arguments are passed into the wrapping
* functions. If any of the before wrappers return an instance of
* <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped
* function nor any after phase subscribers will be executed.</p>
*
* <p>The return value will be the return value of the wrapped function or one
* provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or
* <code>Y.Do.AlterReturn</code>.
*
* @method exec
* @param arg* {any} Arguments are passed to the wrapping and wrapped functions
* @return {any} Return value of wrapped function unless overwritten (see above)
*/
DO.Method.prototype.exec = function () {
var args = Y.Array(arguments, 0, true),
i, ret, newRet,
bf = this.before,
af = this.after,
prevented = false;
// execute before
for (i in bf) {
if (bf.hasOwnProperty(i)) {
ret = bf[i].apply(this.obj, args);
if (ret) {
switch (ret.constructor) {
case DO.Halt:
return ret.retVal;
case DO.AlterArgs:
args = ret.newArgs;
break;
case DO.Prevent:
prevented = true;
break;
default:
}
}
}
}
// execute method
if (!prevented) {
ret = this.method.apply(this.obj, args);
}
DO.originalRetVal = ret;
DO.currentRetVal = ret;
// execute after methods.
for (i in af) {
if (af.hasOwnProperty(i)) {
newRet = af[i].apply(this.obj, args);
// Stop processing if a Halt object is returned
if (newRet && newRet.constructor == DO.Halt) {
return newRet.retVal;
// Check for a new return value
} else if (newRet && newRet.constructor == DO.AlterReturn) {
ret = newRet.newRetVal;
// Update the static retval state
DO.currentRetVal = ret;
}
}
}
return ret;
};
//////////////////////////////////////////////////////////////////////////
/**
* Return an AlterArgs object when you want to change the arguments that
* were passed into the function. Useful for Do.before subscribers. An
* example would be a service that scrubs out illegal characters prior to
* executing the core business logic.
* @class Do.AlterArgs
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newArgs {Array} Call parameters to be used for the original method
* instead of the arguments originally passed in.
*/
DO.AlterArgs = function(msg, newArgs) {
this.msg = msg;
this.newArgs = newArgs;
};
/**
* Return an AlterReturn object when you want to change the result returned
* from the core method to the caller. Useful for Do.after subscribers.
* @class Do.AlterReturn
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newRetVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.AlterReturn = function(msg, newRetVal) {
this.msg = msg;
this.newRetVal = newRetVal;
};
/**
* Return a Halt object when you want to terminate the execution
* of all subsequent subscribers as well as the wrapped method
* if it has not exectued yet. Useful for Do.before subscribers.
* @class Do.Halt
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.Halt = function(msg, retVal) {
this.msg = msg;
this.retVal = retVal;
};
/**
* Return a Prevent object when you want to prevent the wrapped function
* from executing, but want the remaining listeners to execute. Useful
* for Do.before subscribers.
* @class Do.Prevent
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
*/
DO.Prevent = function(msg) {
this.msg = msg;
};
/**
* Return an Error object when you want to terminate the execution
* of all subsequent method calls.
* @class Do.Error
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
* @deprecated use Y.Do.Halt or Y.Do.Prevent
*/
DO.Error = DO.Halt;
//////////////////////////////////////////////////////////////////////////
// Y["Event"] && Y.Event.addListener(window, "unload", Y.Do._unload, Y.Do);
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
// var onsubscribeType = "_event:onsub",
var YArray = Y.Array,
AFTER = 'after',
CONFIGS = [
'broadcast',
'monitored',
'bubbles',
'context',
'contextFn',
'currentTarget',
'defaultFn',
'defaultTargetOnly',
'details',
'emitFacade',
'fireOnce',
'async',
'host',
'preventable',
'preventedFn',
'queuable',
'silent',
'stoppedFn',
'target',
'type'
],
CONFIGS_HASH = YArray.hash(CONFIGS),
nativeSlice = Array.prototype.slice,
YUI3_SIGNATURE = 9,
YUI_LOG = 'yui:log',
mixConfigs = function(r, s, ov) {
var p;
for (p in s) {
if (CONFIGS_HASH[p] && (ov || !(p in r))) {
r[p] = s[p];
}
}
return r;
};
/**
* The CustomEvent class lets you define events for your application
* that can be subscribed to by one or more independent component.
*
* @param {String} type The type of event, which is passed to the callback
* when the event fires.
* @param {object} o configuration object.
* @class CustomEvent
* @constructor
*/
Y.CustomEvent = function(type, o) {
this._kds = Y.CustomEvent.keepDeprecatedSubs;
o = o || {};
this.id = Y.stamp(this);
/**
* The type of event, returned to subscribers when the event fires
* @property type
* @type string
*/
this.type = type;
/**
* The context the the event will fire from by default. Defaults to the YUI
* instance.
* @property context
* @type object
*/
this.context = Y;
/**
* Monitor when an event is attached or detached.
*
* @property monitored
* @type boolean
*/
// this.monitored = false;
this.logSystem = (type == YUI_LOG);
/**
* If 0, this event does not broadcast. If 1, the YUI instance is notified
* every time this event fires. If 2, the YUI instance and the YUI global
* (if event is enabled on the global) are notified every time this event
* fires.
* @property broadcast
* @type int
*/
// this.broadcast = 0;
/**
* By default all custom events are logged in the debug build, set silent
* to true to disable debug outpu for this event.
* @property silent
* @type boolean
*/
this.silent = this.logSystem;
/**
* Specifies whether this event should be queued when the host is actively
* processing an event. This will effect exectution order of the callbacks
* for the various events.
* @property queuable
* @type boolean
* @default false
*/
// this.queuable = false;
/**
* The subscribers to this event
* @property subscribers
* @type Subscriber {}
* @deprecated
*/
if (this._kds) {
this.subscribers = {};
}
/**
* The subscribers to this event
* @property _subscribers
* @type Subscriber []
* @private
*/
this._subscribers = [];
/**
* 'After' subscribers
* @property afters
* @type Subscriber {}
*/
if (this._kds) {
this.afters = {};
}
/**
* 'After' subscribers
* @property _afters
* @type Subscriber []
* @private
*/
this._afters = [];
/**
* This event has fired if true
*
* @property fired
* @type boolean
* @default false;
*/
// this.fired = false;
/**
* An array containing the arguments the custom event
* was last fired with.
* @property firedWith
* @type Array
*/
// this.firedWith;
/**
* This event should only fire one time if true, and if
* it has fired, any new subscribers should be notified
* immediately.
*
* @property fireOnce
* @type boolean
* @default false;
*/
// this.fireOnce = false;
/**
* fireOnce listeners will fire syncronously unless async
* is set to true
* @property async
* @type boolean
* @default false
*/
//this.async = false;
/**
* Flag for stopPropagation that is modified during fire()
* 1 means to stop propagation to bubble targets. 2 means
* to also stop additional subscribers on this target.
* @property stopped
* @type int
*/
// this.stopped = 0;
/**
* Flag for preventDefault that is modified during fire().
* if it is not 0, the default behavior for this event
* @property prevented
* @type int
*/
// this.prevented = 0;
/**
* Specifies the host for this custom event. This is used
* to enable event bubbling
* @property host
* @type EventTarget
*/
// this.host = null;
/**
* The default function to execute after event listeners
* have fire, but only if the default action was not
* prevented.
* @property defaultFn
* @type Function
*/
// this.defaultFn = null;
/**
* The function to execute if a subscriber calls
* stopPropagation or stopImmediatePropagation
* @property stoppedFn
* @type Function
*/
// this.stoppedFn = null;
/**
* The function to execute if a subscriber calls
* preventDefault
* @property preventedFn
* @type Function
*/
// this.preventedFn = null;
/**
* Specifies whether or not this event's default function
* can be cancelled by a subscriber by executing preventDefault()
* on the event facade
* @property preventable
* @type boolean
* @default true
*/
this.preventable = true;
/**
* Specifies whether or not a subscriber can stop the event propagation
* via stopPropagation(), stopImmediatePropagation(), or halt()
*
* Events can only bubble if emitFacade is true.
*
* @property bubbles
* @type boolean
* @default true
*/
this.bubbles = true;
/**
* Supports multiple options for listener signatures in order to
* port YUI 2 apps.
* @property signature
* @type int
* @default 9
*/
this.signature = YUI3_SIGNATURE;
// this.subCount = 0;
// this.afterCount = 0;
// this.hasSubscribers = false;
// this.hasAfters = false;
/**
* If set to true, the custom event will deliver an EventFacade object
* that is similar to a DOM event object.
* @property emitFacade
* @type boolean
* @default false
*/
// this.emitFacade = false;
this.applyConfig(o, true);
// this.log("Creating " + this.type);
};
/**
* Static flag to enable population of the <a href="#property_subscribers">`subscribers`</a>
* and <a href="#property_subscribers">`afters`</a> properties held on a `CustomEvent` instance.
*
* These properties were changed to private properties (`_subscribers` and `_afters`), and
* converted from objects to arrays for performance reasons.
*
* Setting this property to true will populate the deprecated `subscribers` and `afters`
* properties for people who may be using them (which is expected to be rare). There will
* be a performance hit, compared to the new array based implementation.
*
* If you are using these deprecated properties for a use case which the public API
* does not support, please file an enhancement request, and we can provide an alternate
* public implementation which doesn't have the performance cost required to maintiain the
* properties as objects.
*
* @property keepDeprecatedSubs
* @static
* @for CustomEvent
* @type boolean
* @default false
* @deprecated
*/
Y.CustomEvent.keepDeprecatedSubs = false;
Y.CustomEvent.mixConfigs = mixConfigs;
Y.CustomEvent.prototype = {
constructor: Y.CustomEvent,
/**
* Returns the number of subscribers for this event as the sum of the on()
* subscribers and after() subscribers.
*
* @method hasSubs
* @return Number
*/
hasSubs: function(when) {
var s = this._subscribers.length, a = this._afters.length, sib = this.sibling;
if (sib) {
s += sib._subscribers.length;
a += sib._afters.length;
}
if (when) {
return (when == 'after') ? a : s;
}
return (s + a);
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('detach', 'attach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
this.monitored = true;
var type = this.id + '|' + this.type + '_' + what,
args = nativeSlice.call(arguments, 0);
args[0] = type;
return this.host.on.apply(this.host, args);
},
/**
* Get all of the subscribers to this event and any sibling event
* @method getSubs
* @return {Array} first item is the on subscribers, second the after.
*/
getSubs: function() {
var s = this._subscribers, a = this._afters, sib = this.sibling;
s = (sib) ? s.concat(sib._subscribers) : s.concat();
a = (sib) ? a.concat(sib._afters) : a.concat();
return [s, a];
},
/**
* Apply configuration properties. Only applies the CONFIG whitelist
* @method applyConfig
* @param o hash of properties to apply.
* @param force {boolean} if true, properties that exist on the event
* will be overwritten.
*/
applyConfig: function(o, force) {
mixConfigs(this, o, force);
},
/**
* Create the Subscription for subscribing function, context, and bound
* arguments. If this is a fireOnce event, the subscriber is immediately
* notified.
*
* @method _on
* @param fn {Function} Subscription callback
* @param [context] {Object} Override `this` in the callback
* @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire()
* @param [when] {String} "after" to slot into after subscribers
* @return {EventHandle}
* @protected
*/
_on: function(fn, context, args, when) {
if (!fn) { this.log('Invalid callback for CE: ' + this.type); }
var s = new Y.Subscriber(fn, context, args, when);
if (this.fireOnce && this.fired) {
if (this.async) {
setTimeout(Y.bind(this._notify, this, s, this.firedWith), 0);
} else {
this._notify(s, this.firedWith);
}
}
if (when == AFTER) {
this._afters.push(s);
} else {
this._subscribers.push(s);
}
if (this._kds) {
if (when == AFTER) {
this.afters[s.id] = s;
} else {
this.subscribers[s.id] = s;
}
}
return new Y.EventHandle(this, s);
},
/**
* Listen for this event
* @method subscribe
* @param {Function} fn The function to execute.
* @return {EventHandle} Unsubscribe handle.
* @deprecated use on.
*/
subscribe: function(fn, context) {
Y.log('ce.subscribe deprecated, use "on"', 'warn', 'deprecated');
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, true);
},
/**
* Listen for this event
* @method on
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} An object with a detach method to detch the handler(s).
*/
on: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
if (this.monitored && this.host) {
this.host._monitor('attach', this, {
args: arguments
});
}
return this._on(fn, context, a, true);
},
/**
* Listen for this event after the normal subscribers have been notified and
* the default behavior has been applied. If a normal subscriber prevents the
* default behavior, it also prevents after listeners from firing.
* @method after
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} handle Unsubscribe handle.
*/
after: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, AFTER);
},
/**
* Detach listeners.
* @method detach
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int} returns the number of subscribers unsubscribed.
*/
detach: function(fn, context) {
// unsubscribe handle
if (fn && fn.detach) {
return fn.detach();
}
var i, s,
found = 0,
subs = this._subscribers,
afters = this._afters;
for (i = subs.length; i >= 0; i--) {
s = subs[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, subs, i);
found++;
}
}
for (i = afters.length; i >= 0; i--) {
s = afters[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, afters, i);
found++;
}
}
return found;
},
/**
* Detach listeners.
* @method unsubscribe
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int|undefined} returns the number of subscribers unsubscribed.
* @deprecated use detach.
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Notify a single subscriber
* @method _notify
* @param {Subscriber} s the subscriber.
* @param {Array} args the arguments array to apply to the listener.
* @protected
*/
_notify: function(s, args, ef) {
this.log(this.type + '->' + 'sub: ' + s.id);
var ret;
ret = s.notify(args, this);
if (false === ret || this.stopped > 1) {
this.log(this.type + ' cancelled by subscriber');
return false;
}
return true;
},
/**
* Logger abstraction to centralize the application of the silent flag
* @method log
* @param {string} msg message to log.
* @param {string} cat log category.
*/
log: function(msg, cat) {
if (!this.silent) { Y.log(this.id + ': ' + msg, cat || 'info', 'event'); }
},
/**
* Notifies the subscribers. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters:
* <ul>
* <li>The type of event</li>
* <li>All of the arguments fire() was executed with as an array</li>
* <li>The custom object (if any) that was passed into the subscribe()
* method</li>
* </ul>
* @method fire
* @param {Object*} arguments an arbitrary set of parameters to pass to
* the handler.
* @return {boolean} false if one of the subscribers returned false,
* true otherwise.
*
*/
fire: function() {
if (this.fireOnce && this.fired) {
this.log('fireOnce event: ' + this.type + ' already fired');
return true;
} else {
var args = nativeSlice.call(arguments, 0);
// this doesn't happen if the event isn't published
// this.host._monitor('fire', this.type, args);
this.fired = true;
if (this.fireOnce) {
this.firedWith = args;
}
if (this.emitFacade) {
return this.fireComplex(args);
} else {
return this.fireSimple(args);
}
}
},
/**
* Set up for notifying subscribers of non-emitFacade events.
*
* @method fireSimple
* @param args {Array} Arguments passed to fire()
* @return Boolean false if a subscriber returned false
* @protected
*/
fireSimple: function(args) {
this.stopped = 0;
this.prevented = 0;
if (this.hasSubs()) {
var subs = this.getSubs();
this._procSubs(subs[0], args);
this._procSubs(subs[1], args);
}
this._broadcast(args);
return this.stopped ? false : true;
},
// Requires the event-custom-complex module for full funcitonality.
fireComplex: function(args) {
this.log('Missing event-custom-complex needed to emit a facade for: ' + this.type);
args[0] = args[0] || {};
return this.fireSimple(args);
},
/**
* Notifies a list of subscribers.
*
* @method _procSubs
* @param subs {Array} List of subscribers
* @param args {Array} Arguments passed to fire()
* @param ef {}
* @return Boolean false if a subscriber returns false or stops the event
* propagation via e.stopPropagation(),
* e.stopImmediatePropagation(), or e.halt()
* @private
*/
_procSubs: function(subs, args, ef) {
var s, i, l;
for (i = 0, l = subs.length; i < l; i++) {
s = subs[i];
if (s && s.fn) {
if (false === this._notify(s, args, ef)) {
this.stopped = 2;
}
if (this.stopped == 2) {
return false;
}
}
}
return true;
},
/**
* Notifies the YUI instance if the event is configured with broadcast = 1,
* and both the YUI instance and Y.Global if configured with broadcast = 2.
*
* @method _broadcast
* @param args {Array} Arguments sent to fire()
* @private
*/
_broadcast: function(args) {
if (!this.stopped && this.broadcast) {
var a = args.concat();
a.unshift(this.type);
if (this.host !== Y) {
Y.fire.apply(Y, a);
}
if (this.broadcast == 2) {
Y.Global.fire.apply(Y.Global, a);
}
}
},
/**
* Removes all listeners
* @method unsubscribeAll
* @return {int} The number of listeners unsubscribed.
* @deprecated use detachAll.
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Removes all listeners
* @method detachAll
* @return {int} The number of listeners unsubscribed.
*/
detachAll: function() {
return this.detach();
},
/**
* Deletes the subscriber from the internal store of on() and after()
* subscribers.
*
* @method _delete
* @param s subscriber object.
* @param subs (optional) on or after subscriber array
* @param index (optional) The index found.
* @private
*/
_delete: function(s, subs, i) {
var when = s._when;
if (!subs) {
subs = (when === AFTER) ? this._afters : this._subscribers;
i = YArray.indexOf(subs, s, 0);
}
if (s && subs[i] === s) {
subs.splice(i, 1);
}
if (this._kds) {
if (when === AFTER) {
delete this.afters[s.id];
} else {
delete this.subscribers[s.id];
}
}
if (this.monitored && this.host) {
this.host._monitor('detach', this, {
ce: this,
sub: s
});
}
if (s) {
s.deleted = true;
}
}
};
/**
* Stores the subscriber information to be used when the event fires.
* @param {Function} fn The wrapped function to execute.
* @param {Object} context The value of the keyword 'this' in the listener.
* @param {Array} args* 0..n additional arguments to supply the listener.
*
* @class Subscriber
* @constructor
*/
Y.Subscriber = function(fn, context, args, when) {
/**
* The callback that will be execute when the event fires
* This is wrapped by Y.rbind if obj was supplied.
* @property fn
* @type Function
*/
this.fn = fn;
/**
* Optional 'this' keyword for the listener
* @property context
* @type Object
*/
this.context = context;
/**
* Unique subscriber id
* @property id
* @type String
*/
this.id = Y.stamp(this);
/**
* Additional arguments to propagate to the subscriber
* @property args
* @type Array
*/
this.args = args;
this._when = when;
/**
* Custom events for a given fire transaction.
* @property events
* @type {EventTarget}
*/
// this.events = null;
/**
* This listener only reacts to the event once
* @property once
*/
// this.once = false;
};
Y.Subscriber.prototype = {
constructor: Y.Subscriber,
_notify: function(c, args, ce) {
if (this.deleted && !this.postponed) {
if (this.postponed) {
delete this.fn;
delete this.context;
} else {
delete this.postponed;
return null;
}
}
var a = this.args, ret;
switch (ce.signature) {
case 0:
ret = this.fn.call(c, ce.type, args, c);
break;
case 1:
ret = this.fn.call(c, args[0] || null, c);
break;
default:
if (a || args) {
args = args || [];
a = (a) ? args.concat(a) : args;
ret = this.fn.apply(c, a);
} else {
ret = this.fn.call(c);
}
}
if (this.once) {
ce._delete(this);
}
return ret;
},
/**
* Executes the subscriber.
* @method notify
* @param args {Array} Arguments array for the subscriber.
* @param ce {CustomEvent} The custom event that sent the notification.
*/
notify: function(args, ce) {
var c = this.context,
ret = true;
if (!c) {
c = (ce.contextFn) ? ce.contextFn() : ce.context;
}
// only catch errors if we will not re-throw them.
if (Y.config && Y.config.throwFail) {
ret = this._notify(c, args, ce);
} else {
try {
ret = this._notify(c, args, ce);
} catch (e) {
Y.error(this + ' failed: ' + e.message, e);
}
}
return ret;
},
/**
* Returns true if the fn and obj match this objects properties.
* Used by the unsubscribe method to match the right subscriber.
*
* @method contains
* @param {Function} fn the function to execute.
* @param {Object} context optional 'this' keyword for the listener.
* @return {boolean} true if the supplied arguments match this
* subscriber's signature.
*/
contains: function(fn, context) {
if (context) {
return ((this.fn == fn) && this.context == context);
} else {
return (this.fn == fn);
}
},
valueOf : function() {
return this.id;
}
};
/**
* Return value from all subscribe operations
* @class EventHandle
* @constructor
* @param {CustomEvent} evt the custom event.
* @param {Subscriber} sub the subscriber.
*/
Y.EventHandle = function(evt, sub) {
/**
* The custom event
*
* @property evt
* @type CustomEvent
*/
this.evt = evt;
/**
* The subscriber object
*
* @property sub
* @type Subscriber
*/
this.sub = sub;
};
Y.EventHandle.prototype = {
batch: function(f, c) {
f.call(c || this, this);
if (Y.Lang.isArray(this.evt)) {
Y.Array.each(this.evt, function(h) {
h.batch.call(c || h, f);
});
}
},
/**
* Detaches this subscriber
* @method detach
* @return {int} the number of detached listeners
*/
detach: function() {
var evt = this.evt, detached = 0, i;
if (evt) {
// Y.log('EventHandle.detach: ' + this.sub, 'info', 'Event');
if (Y.Lang.isArray(evt)) {
for (i = 0; i < evt.length; i++) {
detached += evt[i].detach();
}
} else {
evt._delete(this.sub);
detached = 1;
}
}
return detached;
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('attach', 'detach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
return this.evt.monitor.apply(this.evt, arguments);
}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* EventTarget provides the implementation for any object to
* publish, subscribe and fire to custom events, and also
* alows other EventTargets to target the object with events
* sourced from the other object.
* EventTarget is designed to be used with Y.augment to wrap
* EventCustom in an interface that allows events to be listened to
* and fired by name. This makes it possible for implementing code to
* subscribe to an event that either has not been created yet, or will
* not be created at all.
* @class EventTarget
* @param opts a configuration object
* @config emitFacade {boolean} if true, all events will emit event
* facade payloads by default (default false)
* @config prefix {String} the prefix to apply to non-prefixed event names
*/
var L = Y.Lang,
PREFIX_DELIMITER = ':',
CATEGORY_DELIMITER = '|',
AFTER_PREFIX = '~AFTER~',
WILD_TYPE_RE = /(.*?)(:)(.*?)/,
_wildType = Y.cached(function(type) {
return type.replace(WILD_TYPE_RE, "*$2$3");
}),
/**
* If the instance has a prefix attribute and the
* event type is not prefixed, the instance prefix is
* applied to the supplied type.
* @method _getType
* @private
*/
_getType = Y.cached(function(type, pre) {
if (!pre || (typeof type !== "string") || type.indexOf(PREFIX_DELIMITER) > -1) {
return type;
}
return pre + PREFIX_DELIMITER + type;
}),
/**
* Returns an array with the detach key (if provided),
* and the prefixed event name from _getType
* Y.on('detachcategory| menu:click', fn)
* @method _parseType
* @private
*/
_parseType = Y.cached(function(type, pre) {
var t = type, detachcategory, after, i;
if (!L.isString(t)) {
return t;
}
i = t.indexOf(AFTER_PREFIX);
if (i > -1) {
after = true;
t = t.substr(AFTER_PREFIX.length);
// Y.log(t);
}
i = t.indexOf(CATEGORY_DELIMITER);
if (i > -1) {
detachcategory = t.substr(0, (i));
t = t.substr(i+1);
if (t == '*') {
t = null;
}
}
// detach category, full type with instance prefix, is this an after listener, short type
return [detachcategory, (pre) ? _getType(t, pre) : t, after, t];
}),
ET = function(opts) {
// Y.log('EventTarget constructor executed: ' + this._yuid);
var o = (L.isObject(opts)) ? opts : {};
this._yuievt = this._yuievt || {
id: Y.guid(),
events: {},
targets: {},
config: o,
chain: ('chain' in o) ? o.chain : Y.config.chain,
bubbling: false,
defaults: {
context: o.context || this,
host: this,
emitFacade: o.emitFacade,
fireOnce: o.fireOnce,
queuable: o.queuable,
monitored: o.monitored,
broadcast: o.broadcast,
defaultTargetOnly: o.defaultTargetOnly,
bubbles: ('bubbles' in o) ? o.bubbles : true
}
};
};
ET.prototype = {
constructor: ET,
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>on</code> except the
* listener is immediatelly detached when it is executed.
* @method once
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
once: function() {
var handle = this.on.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>after</code> except the
* listener is immediatelly detached when it is executed.
* @method onceAfter
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
onceAfter: function() {
var handle = this.after.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Takes the type parameter passed to 'on' and parses out the
* various pieces that could be included in the type. If the
* event type is passed without a prefix, it will be expanded
* to include the prefix one is supplied or the event target
* is configured with a default prefix.
* @method parseType
* @param {String} type the type
* @param {String} [pre=this._yuievt.config.prefix] the prefix
* @since 3.3.0
* @return {Array} an array containing:
* * the detach category, if supplied,
* * the prefixed event type,
* * whether or not this is an after listener,
* * the supplied event type
*/
parseType: function(type, pre) {
return _parseType(type, pre || this._yuievt.config.prefix);
},
/**
* Subscribe a callback function to a custom event fired by this object or
* from an object that bubbles its events to this object.
*
* Callback functions for events published with `emitFacade = true` will
* receive an `EventFacade` as the first argument (typically named "e").
* These callbacks can then call `e.preventDefault()` to disable the
* behavior published to that event's `defaultFn`. See the `EventFacade`
* API for all available properties and methods. Subscribers to
* non-`emitFacade` events will receive the arguments passed to `fire()`
* after the event name.
*
* To subscribe to multiple events at once, pass an object as the first
* argument, where the key:value pairs correspond to the eventName:callback,
* or pass an array of event names as the first argument to subscribe to
* all listed events with the same callback.
*
* Returning `false` from a callback is supported as an alternative to
* calling `e.preventDefault(); e.stopPropagation();`. However, it is
* recommended to use the event methods whenever possible.
*
* @method on
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
on: function(type, fn, context) {
var yuievt = this._yuievt,
parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce,
detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype,
Node = Y.Node, n, domevent, isArr;
// full name, args, detachcategory, after
this._monitor('attach', parts[1], {
args: arguments,
category: parts[0],
after: parts[2]
});
if (L.isObject(type)) {
if (L.isFunction(type)) {
return Y.Do.before.apply(Y.Do, arguments);
}
f = fn;
c = context;
args = nativeSlice.call(arguments, 0);
ret = [];
if (L.isArray(type)) {
isArr = true;
}
after = type._after;
delete type._after;
Y.each(type, function(v, k) {
if (L.isObject(v)) {
f = v.fn || ((L.isFunction(v)) ? v : f);
c = v.context || c;
}
var nv = (after) ? AFTER_PREFIX : '';
args[0] = nv + ((isArr) ? v : k);
args[1] = f;
args[2] = c;
ret.push(this.on.apply(this, args));
}, this);
return (yuievt.chain) ? this : new Y.EventHandle(ret);
}
detachcategory = parts[0];
after = parts[2];
shorttype = parts[3];
// extra redirection so we catch adaptor events too. take a look at this.
if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) {
args = nativeSlice.call(arguments, 0);
args.splice(2, 0, Node.getDOMNode(this));
// Y.log("Node detected, redirecting with these args: " + args);
return Y.on.apply(Y, args);
}
type = parts[1];
if (Y.instanceOf(this, YUI)) {
adapt = Y.Env.evt.plugins[type];
args = nativeSlice.call(arguments, 0);
args[0] = shorttype;
if (Node) {
n = args[2];
if (Y.instanceOf(n, Y.NodeList)) {
n = Y.NodeList.getDOMNodes(n);
} else if (Y.instanceOf(n, Node)) {
n = Node.getDOMNode(n);
}
domevent = (shorttype in Node.DOM_EVENTS);
// Captures both DOM events and event plugins.
if (domevent) {
args[2] = n;
}
}
// check for the existance of an event adaptor
if (adapt) {
Y.log('Using adaptor for ' + shorttype + ', ' + n, 'info', 'event');
handle = adapt.on.apply(Y, args);
} else if ((!type) || domevent) {
handle = Y.Event._attach(args);
}
}
if (!handle) {
ce = yuievt.events[type] || this.publish(type);
handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true);
}
if (detachcategory) {
store[detachcategory] = store[detachcategory] || {};
store[detachcategory][type] = store[detachcategory][type] || [];
store[detachcategory][type].push(handle);
}
return (yuievt.chain) ? this : handle;
},
/**
* subscribe to an event
* @method subscribe
* @deprecated use on
*/
subscribe: function() {
Y.log('EventTarget subscribe() is deprecated, use on()', 'warn', 'deprecated');
return this.on.apply(this, arguments);
},
/**
* Detach one or more listeners the from the specified event
* @method detach
* @param type {string|Object} Either the handle to the subscriber or the
* type of event. If the type
* is not specified, it will attempt to remove
* the listener from all hosted events.
* @param fn {Function} The subscribed function to unsubscribe, if not
* supplied, all subscribers will be removed.
* @param context {Object} The custom object passed to subscribe. This is
* optional, but if supplied will be used to
* disambiguate multiple listeners that are the same
* (e.g., you subscribe many object using a function
* that lives on the prototype)
* @return {EventTarget} the host
*/
detach: function(type, fn, context) {
var evts = this._yuievt.events, i,
Node = Y.Node, isNode = Node && (Y.instanceOf(this, Node));
// detachAll disabled on the Y instance.
if (!type && (this !== Y)) {
for (i in evts) {
if (evts.hasOwnProperty(i)) {
evts[i].detach(fn, context);
}
}
if (isNode) {
Y.Event.purgeElement(Node.getDOMNode(this));
}
return this;
}
var parts = _parseType(type, this._yuievt.config.prefix),
detachcategory = L.isArray(parts) ? parts[0] : null,
shorttype = (parts) ? parts[3] : null,
adapt, store = Y.Env.evt.handles, detachhost, cat, args,
ce,
keyDetacher = function(lcat, ltype, host) {
var handles = lcat[ltype], ce, i;
if (handles) {
for (i = handles.length - 1; i >= 0; --i) {
ce = handles[i].evt;
if (ce.host === host || ce.el === host) {
handles[i].detach();
}
}
}
};
if (detachcategory) {
cat = store[detachcategory];
type = parts[1];
detachhost = (isNode) ? Y.Node.getDOMNode(this) : this;
if (cat) {
if (type) {
keyDetacher(cat, type, detachhost);
} else {
for (i in cat) {
if (cat.hasOwnProperty(i)) {
keyDetacher(cat, i, detachhost);
}
}
}
return this;
}
// If this is an event handle, use it to detach
} else if (L.isObject(type) && type.detach) {
type.detach();
return this;
// extra redirection so we catch adaptor events too. take a look at this.
} else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) {
args = nativeSlice.call(arguments, 0);
args[2] = Node.getDOMNode(this);
Y.detach.apply(Y, args);
return this;
}
adapt = Y.Env.evt.plugins[shorttype];
// The YUI instance handles DOM events and adaptors
if (Y.instanceOf(this, YUI)) {
args = nativeSlice.call(arguments, 0);
// use the adaptor specific detach code if
if (adapt && adapt.detach) {
adapt.detach.apply(Y, args);
return this;
// DOM event fork
} else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) {
args[0] = type;
Y.Event.detach.apply(Y.Event, args);
return this;
}
}
// ce = evts[type];
ce = evts[parts[1]];
if (ce) {
ce.detach(fn, context);
}
return this;
},
/**
* detach a listener
* @method unsubscribe
* @deprecated use detach
*/
unsubscribe: function() {
Y.log('EventTarget unsubscribe() is deprecated, use detach()', 'warn', 'deprecated');
return this.detach.apply(this, arguments);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method detachAll
* @param type {String} The type, or name of the event
*/
detachAll: function(type) {
return this.detach(type);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method unsubscribeAll
* @param type {String} The type, or name of the event
* @deprecated use detachAll
*/
unsubscribeAll: function() {
Y.log('EventTarget unsubscribeAll() is deprecated, use detachAll()', 'warn', 'deprecated');
return this.detachAll.apply(this, arguments);
},
/**
* Creates a new custom event of the specified type. If a custom event
* by that name already exists, it will not be re-created. In either
* case the custom event is returned.
*
* @method publish
*
* @param type {String} the type, or name of the event
* @param opts {object} optional config params. Valid properties are:
*
* <ul>
* <li>
* 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)
* </li>
* <li>
* 'bubbles': whether or not this event bubbles (true)
* Events can only bubble if emitFacade is true.
* </li>
* <li>
* 'context': the default execution context for the listeners (this)
* </li>
* <li>
* 'defaultFn': the default function to execute when this event fires if preventDefault was not called
* </li>
* <li>
* 'emitFacade': whether or not this event emits a facade (false)
* </li>
* <li>
* 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click'
* </li>
* <li>
* 'fireOnce': if an event is configured to fire once, new subscribers after
* the fire will be notified immediately.
* </li>
* <li>
* 'async': fireOnce event listeners will fire synchronously if the event has already
* fired unless async is true.
* </li>
* <li>
* 'preventable': whether or not preventDefault() has an effect (true)
* </li>
* <li>
* 'preventedFn': a function that is executed when preventDefault is called
* </li>
* <li>
* 'queuable': whether or not this event can be queued during bubbling (false)
* </li>
* <li>
* 'silent': if silent is true, debug messages are not provided for this event.
* </li>
* <li>
* 'stoppedFn': a function that is executed when stopPropagation is called
* </li>
*
* <li>
* 'monitored': specifies whether or not this event should send notifications about
* when the event has been attached, detached, or published.
* </li>
* <li>
* 'type': the event type (valid option if not provided as the first parameter to publish)
* </li>
* </ul>
*
* @return {CustomEvent} the custom event
*
*/
publish: function(type, opts) {
var events, ce, ret, defaults,
edata = this._yuievt,
pre = edata.config.prefix;
if (L.isObject(type)) {
ret = {};
Y.each(type, function(v, k) {
ret[k] = this.publish(k, v || opts);
}, this);
return ret;
}
type = (pre) ? _getType(type, pre) : type;
events = edata.events;
ce = events[type];
this._monitor('publish', type, {
args: arguments
});
if (ce) {
// ce.log("publish applying new config to published event: '"+type+"' exists", 'info', 'event');
if (opts) {
ce.applyConfig(opts, true);
}
} else {
// TODO: Lazy publish goes here.
defaults = edata.defaults;
// apply defaults
ce = new Y.CustomEvent(type, defaults);
if (opts) {
ce.applyConfig(opts, true);
}
events[type] = ce;
}
// make sure we turn the broadcast flag off if this
// event was published as a result of bubbling
// if (opts instanceof Y.CustomEvent) {
// events[type].broadcast = false;
// }
return events[type];
},
/**
* This is the entry point for the event monitoring system.
* You can monitor 'attach', 'detach', 'fire', and 'publish'.
* When configured, these events generate an event. click ->
* click_attach, click_detach, click_publish -- these can
* be subscribed to like other events to monitor the event
* system. Inividual published events can have monitoring
* turned on or off (publish can't be turned off before it
* it published) by setting the events 'monitor' config.
*
* @method _monitor
* @param what {String} 'attach', 'detach', 'fire', or 'publish'
* @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object.
* @param o {Object} Information about the event interaction, such as
* fire() args, subscription category, publish config
* @private
*/
_monitor: function(what, eventType, o) {
var monitorevt, ce, type;
if (eventType) {
if (typeof eventType === "string") {
type = eventType;
ce = this.getEvent(eventType, true);
} else {
ce = eventType;
type = eventType.type;
}
if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {
monitorevt = type + '_' + what;
o.monitored = what;
this.fire.call(this, monitorevt, o);
}
}
},
/**
* Fire a custom event by name. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters.
*
* If the custom event object hasn't been created, then the event hasn't
* been published and it has no subscribers. For performance sake, we
* immediate exit in this case. This means the event won't bubble, so
* if the intention is that a bubble target be notified, the event must
* be published on this object first.
*
* The first argument is the event type, and any additional arguments are
* passed to the listeners as parameters. If the first of these is an
* object literal, and the event is configured to emit an event facade,
* that object is mixed into the event facade and the facade is provided
* in place of the original object.
*
* @method fire
* @param type {String|Object} The type of the event, or an object that contains
* a 'type' property.
* @param arguments {Object*} an arbitrary set of parameters to pass to
* the handler. If the first of these is an object literal and the event is
* configured to emit an event facade, the event facade will replace that
* parameter after the properties the object literal contains are copied to
* the event facade.
* @return {EventTarget} the event host
*/
fire: function(type) {
var typeIncluded = L.isString(type),
t = (typeIncluded) ? type : (type && type.type),
yuievt = this._yuievt,
pre = yuievt.config.prefix,
ce, ret,
ce2,
args = (typeIncluded) ? nativeSlice.call(arguments, 1) : arguments;
t = (pre) ? _getType(t, pre) : t;
ce = this.getEvent(t, true);
ce2 = this.getSibling(t, ce);
if (ce2 && !ce) {
ce = this.publish(t);
}
this._monitor('fire', (ce || t), {
args: args
});
// this event has not been published or subscribed to
if (!ce) {
if (yuievt.hasTargets) {
return this.bubble({ type: t }, args, this);
}
// otherwise there is nothing to be done
ret = true;
} else {
ce.sibling = ce2;
ret = ce.fire.apply(ce, args);
}
return (yuievt.chain) ? this : ret;
},
getSibling: function(type, ce) {
var ce2;
// delegate to *:type events if there are subscribers
if (type.indexOf(PREFIX_DELIMITER) > -1) {
type = _wildType(type);
// console.log(type);
ce2 = this.getEvent(type, true);
if (ce2) {
// console.log("GOT ONE: " + type);
ce2.applyConfig(ce);
ce2.bubbles = false;
ce2.broadcast = 0;
// ret = ce2.fire.apply(ce2, a);
}
}
return ce2;
},
/**
* Returns the custom event of the provided type has been created, a
* falsy value otherwise
* @method getEvent
* @param type {String} the type, or name of the event
* @param prefixed {String} if true, the type is prefixed already
* @return {CustomEvent} the custom event or null
*/
getEvent: function(type, prefixed) {
var pre, e;
if (!prefixed) {
pre = this._yuievt.config.prefix;
type = (pre) ? _getType(type, pre) : type;
}
e = this._yuievt.events;
return e[type] || null;
},
/**
* Subscribe to a custom event hosted by this object. The
* supplied callback will execute after any listeners add
* via the subscribe method, and after the default function,
* if configured for the event, has executed.
*
* @method after
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
after: function(type, fn) {
var a = nativeSlice.call(arguments, 0);
switch (L.type(type)) {
case 'function':
return Y.Do.after.apply(Y.Do, arguments);
case 'array':
// YArray.each(a[0], function(v) {
// v = AFTER_PREFIX + v;
// });
// break;
case 'object':
a[0]._after = true;
break;
default:
a[0] = AFTER_PREFIX + type;
}
return this.on.apply(this, a);
},
/**
* Executes the callback before a DOM event, custom event
* or method. If the first argument is a function, it
* is assumed the target is a method. For DOM and custom
* events, this is an alias for Y.on.
*
* For DOM and custom events:
* type, callback, context, 0-n arguments
*
* For methods:
* callback, object (method host), methodName, context, 0-n arguments
*
* @method before
* @return detach handle
*/
before: function() {
return this.on.apply(this, arguments);
}
};
Y.EventTarget = ET;
// make Y an event target
Y.mix(Y, ET.prototype);
ET.call(Y, { bubbles: false });
YUI.Env.globalEvents = YUI.Env.globalEvents || new ET();
/**
* Hosts YUI page level events. This is where events bubble to
* when the broadcast config is set to 2. This property is
* only available if the custom event module is loaded.
* @property Global
* @type EventTarget
* @for YUI
*/
Y.Global = YUI.Env.globalEvents;
// @TODO implement a global namespace function on Y.Global?
/**
`Y.on()` can do many things:
<ul>
<li>Subscribe to custom events `publish`ed and `fire`d from Y</li>
<li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and
`fire`d from any object in the YUI instance sandbox</li>
<li>Subscribe to DOM events</li>
<li>Subscribe to the execution of a method on any object, effectively
treating that method as an event</li>
</ul>
For custom event subscriptions, pass the custom event name as the first argument and callback as the second. The `this` object in the callback will be `Y` unless an override is passed as the third argument.
Y.on('io:complete', function () {
Y.MyApp.updateStatus('Transaction complete');
});
To subscribe to DOM events, pass the name of a DOM event as the first argument
and a CSS selector string as the third argument after the callback function.
Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`,
array, or simply omitted (the default is the `window` object).
Y.on('click', function (e) {
e.preventDefault();
// proceed with ajax form submission
var url = this.get('action');
...
}, '#my-form');
The `this` object in DOM event callbacks will be the `Node` targeted by the CSS
selector or other identifier.
`on()` subscribers for DOM events or custom events `publish`ed with a
`defaultFn` can prevent the default behavior with `e.preventDefault()` from the
event object passed as the first parameter to the subscription callback.
To subscribe to the execution of an object method, pass arguments corresponding to the call signature for
<a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>.
NOTE: The formal parameter list below is for events, not for function
injection. See `Y.Do.before` for that signature.
@method on
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@see Do.before
@for YUI
**/
/**
Listen for an event one time. Equivalent to `on()`, except that
the listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see on
@method once
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Listen for an event one time. Equivalent to `once()`, except, like `after()`,
the subscription callback executes after all `on()` subscribers and the event's
`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase
subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()`
subscribers will execute.
The listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see once
@method onceAfter
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Like `on()`, this method creates a subscription to a custom event or to the
execution of a method on an object.
For events, `after()` subscribers are executed after the event's
`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
NOTE: The subscription signature shown is for events, not for function
injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a>
for that signature.
@see on
@see Do.after
@method after
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [args*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
}, '@VERSION@', {"requires": ["oop"]});
|
components/PageHeader.js
|
turntwogg/esports-aggregator
|
import React from 'react';
import classNames from 'classnames';
import { Container } from '@turntwo/react-ui';
import Heading from './Heading';
import { useTheme } from '@turntwo/react-ui';
const PageHeader = ({
children,
flex,
flexCenter,
flexMobile,
noFlex,
title,
...rest
}) => {
const theme = useTheme();
return (
<header
className={classNames('page-header', {
'page-header--has-children': children,
})}
{...rest}
>
<Container>
<div
className={classNames('page-header-inner', {
'page-header-inner--flex-mobile': flexMobile,
'page-header-inner--flex-center': flexCenter,
'page-header-inner--no-flex': noFlex,
})}
>
<Heading element="h1" className="page-title" style={{ margin: 0 }}>
{title}
</Heading>
{children && <div className="page-header-metadata">{children}</div>}
</div>
</Container>
<style jsx>{`
.page-header {
margin-bottom: 24px;
}
.page-header-inner {
padding-bottom: 8px;
border-bottom: 2px solid rgb(113, 2, 68);
}
.page-header-metadata {
display: flex;
align-items: center;
margin-top: ${theme.baseSpacingUnit / 2}px;
margin-left: auto;
}
.page-title {
margin-bottom: 0;
color: #04133b;
}
.page-header-inner--flex-mobile {
display: flex;
}
.page-header-inner--no-flex {
display: block !important;
}
@media (min-width: ${theme.breakpoints.m}px) {
.page-header-metadata {
margin-top: 0;
margin-left: auto;
}
.page-header-inner--flex {
display: flex;
}
.page-header-inner--flex-center {
align-items: center;
}
.page-header-inner--flex .page-title {
margin-right: 16px;
}
.page-header--has-children .page-header-inner {
display: flex;
}
}
`}</style>
</header>
);
};
export default PageHeader;
|
src/bower_components/react/react-with-addons.js
|
appbaseio/Now
|
/**
* React (with addons) v0.14.0
*/
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.React = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactWithAddons
*/
/**
* This module exists purely in the open source project, and is meant as a way
* to create a separate standalone build of React. This build has "addons", or
* functionality we've built and think might be useful but doesn't have a good
* place to live inside React core.
*/
'use strict';
var LinkedStateMixin = _dereq_(22);
var React = _dereq_(26);
var ReactComponentWithPureRenderMixin = _dereq_(37);
var ReactCSSTransitionGroup = _dereq_(29);
var ReactFragment = _dereq_(64);
var ReactTransitionGroup = _dereq_(94);
var ReactUpdates = _dereq_(96);
var cloneWithProps = _dereq_(117);
var shallowCompare = _dereq_(139);
var update = _dereq_(142);
var warning = _dereq_(172);
var warnedAboutBatchedUpdates = false;
React.addons = {
CSSTransitionGroup: ReactCSSTransitionGroup,
LinkedStateMixin: LinkedStateMixin,
PureRenderMixin: ReactComponentWithPureRenderMixin,
TransitionGroup: ReactTransitionGroup,
batchedUpdates: function () {
if ("development" !== 'production') {
"development" !== 'production' ? warning(warnedAboutBatchedUpdates, 'React.addons.batchedUpdates is deprecated. Use ' + 'ReactDOM.unstable_batchedUpdates instead.') : undefined;
warnedAboutBatchedUpdates = true;
}
return ReactUpdates.batchedUpdates.apply(this, arguments);
},
cloneWithProps: cloneWithProps,
createFragment: ReactFragment.create,
shallowCompare: shallowCompare,
update: update
};
if ("development" !== 'production') {
React.addons.Perf = _dereq_(55);
React.addons.TestUtils = _dereq_(91);
}
module.exports = React;
},{"117":117,"139":139,"142":142,"172":172,"22":22,"26":26,"29":29,"37":37,"55":55,"64":64,"91":91,"94":94,"96":96}],2:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule AutoFocusUtils
* @typechecks static-only
*/
'use strict';
var ReactMount = _dereq_(72);
var findDOMNode = _dereq_(121);
var focusNode = _dereq_(154);
var Mixin = {
componentDidMount: function () {
if (this.props.autoFocus) {
focusNode(findDOMNode(this));
}
}
};
var AutoFocusUtils = {
Mixin: Mixin,
focusDOMComponent: function () {
focusNode(ReactMount.getNode(this._rootNodeID));
}
};
module.exports = AutoFocusUtils;
},{"121":121,"154":154,"72":72}],3:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015 Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule BeforeInputEventPlugin
* @typechecks static-only
*/
'use strict';
var EventConstants = _dereq_(15);
var EventPropagators = _dereq_(19);
var ExecutionEnvironment = _dereq_(146);
var FallbackCompositionState = _dereq_(20);
var SyntheticCompositionEvent = _dereq_(103);
var SyntheticInputEvent = _dereq_(107);
var keyOf = _dereq_(165);
var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space
var START_KEYCODE = 229;
var canUseCompositionEvent = ExecutionEnvironment.canUseDOM && 'CompositionEvent' in window;
var documentMode = null;
if (ExecutionEnvironment.canUseDOM && 'documentMode' in document) {
documentMode = document.documentMode;
}
// Webkit offers a very useful `textInput` event that can be used to
// directly represent `beforeInput`. The IE `textinput` event is not as
// useful, so we don't use it.
var canUseTextInputEvent = ExecutionEnvironment.canUseDOM && 'TextEvent' in window && !documentMode && !isPresto();
// In IE9+, we have access to composition events, but the data supplied
// by the native compositionend event may be incorrect. Japanese ideographic
// spaces, for instance (\u3000) are not recorded correctly.
var useFallbackCompositionData = ExecutionEnvironment.canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11);
/**
* Opera <= 12 includes TextEvent in window, but does not fire
* text input events. Rely on keypress instead.
*/
function isPresto() {
var opera = window.opera;
return typeof opera === 'object' && typeof opera.version === 'function' && parseInt(opera.version(), 10) <= 12;
}
var SPACEBAR_CODE = 32;
var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE);
var topLevelTypes = EventConstants.topLevelTypes;
// Events and their corresponding property names.
var eventTypes = {
beforeInput: {
phasedRegistrationNames: {
bubbled: keyOf({ onBeforeInput: null }),
captured: keyOf({ onBeforeInputCapture: null })
},
dependencies: [topLevelTypes.topCompositionEnd, topLevelTypes.topKeyPress, topLevelTypes.topTextInput, topLevelTypes.topPaste]
},
compositionEnd: {
phasedRegistrationNames: {
bubbled: keyOf({ onCompositionEnd: null }),
captured: keyOf({ onCompositionEndCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionEnd, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onCompositionStart: null }),
captured: keyOf({ onCompositionStartCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionStart, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
},
compositionUpdate: {
phasedRegistrationNames: {
bubbled: keyOf({ onCompositionUpdate: null }),
captured: keyOf({ onCompositionUpdateCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topCompositionUpdate, topLevelTypes.topKeyDown, topLevelTypes.topKeyPress, topLevelTypes.topKeyUp, topLevelTypes.topMouseDown]
}
};
// Track whether we've ever handled a keypress on the space key.
var hasSpaceKeypress = false;
/**
* Return whether a native keypress event is assumed to be a command.
* This is required because Firefox fires `keypress` events for key commands
* (cut, copy, select-all, etc.) even though no character is inserted.
*/
function isKeypressCommand(nativeEvent) {
return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) &&
// ctrlKey && altKey is equivalent to AltGr, and is not a command.
!(nativeEvent.ctrlKey && nativeEvent.altKey);
}
/**
* Translate native top level events into event types.
*
* @param {string} topLevelType
* @return {object}
*/
function getCompositionEventType(topLevelType) {
switch (topLevelType) {
case topLevelTypes.topCompositionStart:
return eventTypes.compositionStart;
case topLevelTypes.topCompositionEnd:
return eventTypes.compositionEnd;
case topLevelTypes.topCompositionUpdate:
return eventTypes.compositionUpdate;
}
}
/**
* Does our fallback best-guess model think this event signifies that
* composition has begun?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionStart(topLevelType, nativeEvent) {
return topLevelType === topLevelTypes.topKeyDown && nativeEvent.keyCode === START_KEYCODE;
}
/**
* Does our fallback mode think that this event is the end of composition?
*
* @param {string} topLevelType
* @param {object} nativeEvent
* @return {boolean}
*/
function isFallbackCompositionEnd(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topKeyUp:
// Command keys insert or clear IME input.
return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1;
case topLevelTypes.topKeyDown:
// Expect IME keyCode on each keydown. If we get any other
// code we must have exited earlier.
return nativeEvent.keyCode !== START_KEYCODE;
case topLevelTypes.topKeyPress:
case topLevelTypes.topMouseDown:
case topLevelTypes.topBlur:
// Events are not possible without cancelling IME.
return true;
default:
return false;
}
}
/**
* Google Input Tools provides composition data via a CustomEvent,
* with the `data` property populated in the `detail` object. If this
* is available on the event object, use it. If not, this is a plain
* composition event and we have nothing special to extract.
*
* @param {object} nativeEvent
* @return {?string}
*/
function getDataFromCustomEvent(nativeEvent) {
var detail = nativeEvent.detail;
if (typeof detail === 'object' && 'data' in detail) {
return detail.data;
}
return null;
}
// Track the current IME composition fallback object, if any.
var currentComposition = null;
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticCompositionEvent.
*/
function extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var eventType;
var fallbackData;
if (canUseCompositionEvent) {
eventType = getCompositionEventType(topLevelType);
} else if (!currentComposition) {
if (isFallbackCompositionStart(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionStart;
}
} else if (isFallbackCompositionEnd(topLevelType, nativeEvent)) {
eventType = eventTypes.compositionEnd;
}
if (!eventType) {
return null;
}
if (useFallbackCompositionData) {
// The current composition is stored statically and must not be
// overwritten while composition continues.
if (!currentComposition && eventType === eventTypes.compositionStart) {
currentComposition = FallbackCompositionState.getPooled(topLevelTarget);
} else if (eventType === eventTypes.compositionEnd) {
if (currentComposition) {
fallbackData = currentComposition.getData();
}
}
}
var event = SyntheticCompositionEvent.getPooled(eventType, topLevelTargetID, nativeEvent, nativeEventTarget);
if (fallbackData) {
// Inject data generated from fallback path into the synthetic event.
// This matches the property of native CompositionEventInterface.
event.data = fallbackData;
} else {
var customData = getDataFromCustomEvent(nativeEvent);
if (customData !== null) {
event.data = customData;
}
}
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The string corresponding to this `beforeInput` event.
*/
function getNativeBeforeInputChars(topLevelType, nativeEvent) {
switch (topLevelType) {
case topLevelTypes.topCompositionEnd:
return getDataFromCustomEvent(nativeEvent);
case topLevelTypes.topKeyPress:
/**
* If native `textInput` events are available, our goal is to make
* use of them. However, there is a special case: the spacebar key.
* In Webkit, preventing default on a spacebar `textInput` event
* cancels character insertion, but it *also* causes the browser
* to fall back to its default spacebar behavior of scrolling the
* page.
*
* Tracking at:
* https://code.google.com/p/chromium/issues/detail?id=355103
*
* To avoid this issue, use the keypress event as if no `textInput`
* event is available.
*/
var which = nativeEvent.which;
if (which !== SPACEBAR_CODE) {
return null;
}
hasSpaceKeypress = true;
return SPACEBAR_CHAR;
case topLevelTypes.topTextInput:
// Record the characters to be added to the DOM.
var chars = nativeEvent.data;
// If it's a spacebar character, assume that we have already handled
// it at the keypress level and bail immediately. Android Chrome
// doesn't give us keycodes, so we need to blacklist it.
if (chars === SPACEBAR_CHAR && hasSpaceKeypress) {
return null;
}
return chars;
default:
// For other native event types, do nothing.
return null;
}
}
/**
* For browsers that do not provide the `textInput` event, extract the
* appropriate string to use for SyntheticInputEvent.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} nativeEvent Native browser event.
* @return {?string} The fallback string for this `beforeInput` event.
*/
function getFallbackBeforeInputChars(topLevelType, nativeEvent) {
// If we are currently composing (IME) and using a fallback to do so,
// try to extract the composed characters from the fallback object.
if (currentComposition) {
if (topLevelType === topLevelTypes.topCompositionEnd || isFallbackCompositionEnd(topLevelType, nativeEvent)) {
var chars = currentComposition.getData();
FallbackCompositionState.release(currentComposition);
currentComposition = null;
return chars;
}
return null;
}
switch (topLevelType) {
case topLevelTypes.topPaste:
// If a paste event occurs after a keypress, throw out the input
// chars. Paste events should not lead to BeforeInput events.
return null;
case topLevelTypes.topKeyPress:
/**
* As of v27, Firefox may fire keypress events even when no character
* will be inserted. A few possibilities:
*
* - `which` is `0`. Arrow keys, Esc key, etc.
*
* - `which` is the pressed key code, but no char is available.
* Ex: 'AltGr + d` in Polish. There is no modified character for
* this key combination and no character is inserted into the
* document, but FF fires the keypress for char code `100` anyway.
* No `input` event will occur.
*
* - `which` is the pressed key code, but a command combination is
* being used. Ex: `Cmd+C`. No character is inserted, and no
* `input` event will occur.
*/
if (nativeEvent.which && !isKeypressCommand(nativeEvent)) {
return String.fromCharCode(nativeEvent.which);
}
return null;
case topLevelTypes.topCompositionEnd:
return useFallbackCompositionData ? null : nativeEvent.data;
default:
return null;
}
}
/**
* Extract a SyntheticInputEvent for `beforeInput`, based on either native
* `textInput` or fallback behavior.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {?object} A SyntheticInputEvent.
*/
function extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var chars;
if (canUseTextInputEvent) {
chars = getNativeBeforeInputChars(topLevelType, nativeEvent);
} else {
chars = getFallbackBeforeInputChars(topLevelType, nativeEvent);
}
// If no characters are being inserted, no BeforeInput event should
// be fired.
if (!chars) {
return null;
}
var event = SyntheticInputEvent.getPooled(eventTypes.beforeInput, topLevelTargetID, nativeEvent, nativeEventTarget);
event.data = chars;
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
/**
* Create an `onBeforeInput` event to match
* http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents.
*
* This event plugin is based on the native `textInput` event
* available in Chrome, Safari, Opera, and IE. This event fires after
* `onKeyPress` and `onCompositionEnd`, but before `onInput`.
*
* `beforeInput` is spec'd but not implemented in any browsers, and
* the `input` event does not provide any useful information about what has
* actually been added, contrary to the spec. Thus, `textInput` is the best
* available event to identify the characters that have actually been inserted
* into the target node.
*
* This plugin is also responsible for emitting `composition` events, thus
* allowing us to share composition fallback code for both `beforeInput` and
* `composition` event types.
*/
var BeforeInputEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
return [extractCompositionEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget), extractBeforeInputEvent(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget)];
}
};
module.exports = BeforeInputEventPlugin;
},{"103":103,"107":107,"146":146,"15":15,"165":165,"19":19,"20":20}],4:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSProperty
*/
'use strict';
/**
* CSS properties which accept numbers but are not in units of "px".
*/
var isUnitlessNumber = {
animationIterationCount: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
columnCount: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
flexOrder: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
stopOpacity: true,
strokeDashoffset: true,
strokeOpacity: true,
strokeWidth: true
};
/**
* @param {string} prefix vendor-specific prefix, eg: Webkit
* @param {string} key style name, eg: transitionDuration
* @return {string} style name prefixed with `prefix`, properly camelCased, eg:
* WebkitTransitionDuration
*/
function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
}
/**
* Support style names that may come passed in prefixed by adding permutations
* of vendor prefixes.
*/
var prefixes = ['Webkit', 'ms', 'Moz', 'O'];
// Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an
// infinite loop, because it iterates over the newly added props too.
Object.keys(isUnitlessNumber).forEach(function (prop) {
prefixes.forEach(function (prefix) {
isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop];
});
});
/**
* Most style properties can be unset by doing .style[prop] = '' but IE8
* doesn't like doing that with shorthand properties so for the properties that
* IE8 breaks on, which are listed here, we instead unset each of the
* individual properties. See http://bugs.jquery.com/ticket/12385.
* The 4-value 'clock' properties like margin, padding, border-width seem to
* behave without any problems. Curiously, list-style works too without any
* special prodding.
*/
var shorthandPropertyExpansions = {
background: {
backgroundAttachment: true,
backgroundColor: true,
backgroundImage: true,
backgroundPositionX: true,
backgroundPositionY: true,
backgroundRepeat: true
},
backgroundPosition: {
backgroundPositionX: true,
backgroundPositionY: true
},
border: {
borderWidth: true,
borderStyle: true,
borderColor: true
},
borderBottom: {
borderBottomWidth: true,
borderBottomStyle: true,
borderBottomColor: true
},
borderLeft: {
borderLeftWidth: true,
borderLeftStyle: true,
borderLeftColor: true
},
borderRight: {
borderRightWidth: true,
borderRightStyle: true,
borderRightColor: true
},
borderTop: {
borderTopWidth: true,
borderTopStyle: true,
borderTopColor: true
},
font: {
fontStyle: true,
fontVariant: true,
fontWeight: true,
fontSize: true,
lineHeight: true,
fontFamily: true
},
outline: {
outlineWidth: true,
outlineStyle: true,
outlineColor: true
}
};
var CSSProperty = {
isUnitlessNumber: isUnitlessNumber,
shorthandPropertyExpansions: shorthandPropertyExpansions
};
module.exports = CSSProperty;
},{}],5:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSPropertyOperations
* @typechecks static-only
*/
'use strict';
var CSSProperty = _dereq_(4);
var ExecutionEnvironment = _dereq_(146);
var ReactPerf = _dereq_(78);
var camelizeStyleName = _dereq_(148);
var dangerousStyleValue = _dereq_(118);
var hyphenateStyleName = _dereq_(159);
var memoizeStringOnly = _dereq_(167);
var warning = _dereq_(172);
var processStyleName = memoizeStringOnly(function (styleName) {
return hyphenateStyleName(styleName);
});
var hasShorthandPropertyBug = false;
var styleFloatAccessor = 'cssFloat';
if (ExecutionEnvironment.canUseDOM) {
var tempStyle = document.createElement('div').style;
try {
// IE8 throws "Invalid argument." if resetting shorthand style properties.
tempStyle.font = '';
} catch (e) {
hasShorthandPropertyBug = true;
}
// IE8 only supports accessing cssFloat (standard) as styleFloat
if (document.documentElement.style.cssFloat === undefined) {
styleFloatAccessor = 'styleFloat';
}
}
if ("development" !== 'production') {
// 'msTransform' is correct, but the other prefixes should be capitalized
var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/;
// style values shouldn't contain a semicolon
var badStyleValueWithSemicolonPattern = /;\s*$/;
var warnedStyleNames = {};
var warnedStyleValues = {};
var warnHyphenatedStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
"development" !== 'production' ? warning(false, 'Unsupported style property %s. Did you mean %s?', name, camelizeStyleName(name)) : undefined;
};
var warnBadVendoredStyleName = function (name) {
if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) {
return;
}
warnedStyleNames[name] = true;
"development" !== 'production' ? warning(false, 'Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)) : undefined;
};
var warnStyleValueWithSemicolon = function (name, value) {
if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) {
return;
}
warnedStyleValues[value] = true;
"development" !== 'production' ? warning(false, 'Style property values shouldn\'t contain a semicolon. ' + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')) : undefined;
};
/**
* @param {string} name
* @param {*} value
*/
var warnValidStyle = function (name, value) {
if (name.indexOf('-') > -1) {
warnHyphenatedStyleName(name);
} else if (badVendoredStyleNamePattern.test(name)) {
warnBadVendoredStyleName(name);
} else if (badStyleValueWithSemicolonPattern.test(value)) {
warnStyleValueWithSemicolon(name, value);
}
};
}
/**
* Operations for dealing with CSS properties.
*/
var CSSPropertyOperations = {
/**
* Serializes a mapping of style properties for use as inline styles:
*
* > createMarkupForStyles({width: '200px', height: 0})
* "width:200px;height:0;"
*
* Undefined values are ignored so that declarative programming is easier.
* The result should be HTML-escaped before insertion into the DOM.
*
* @param {object} styles
* @return {?string}
*/
createMarkupForStyles: function (styles) {
var serialized = '';
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
var styleValue = styles[styleName];
if ("development" !== 'production') {
warnValidStyle(styleName, styleValue);
}
if (styleValue != null) {
serialized += processStyleName(styleName) + ':';
serialized += dangerousStyleValue(styleName, styleValue) + ';';
}
}
return serialized || null;
},
/**
* Sets the value for multiple styles on a node. If a value is specified as
* '' (empty string), the corresponding style property will be unset.
*
* @param {DOMElement} node
* @param {object} styles
*/
setValueForStyles: function (node, styles) {
var style = node.style;
for (var styleName in styles) {
if (!styles.hasOwnProperty(styleName)) {
continue;
}
if ("development" !== 'production') {
warnValidStyle(styleName, styles[styleName]);
}
var styleValue = dangerousStyleValue(styleName, styles[styleName]);
if (styleName === 'float') {
styleName = styleFloatAccessor;
}
if (styleValue) {
style[styleName] = styleValue;
} else {
var expansion = hasShorthandPropertyBug && CSSProperty.shorthandPropertyExpansions[styleName];
if (expansion) {
// Shorthand property that IE8 won't like unsetting, so unset each
// component to placate it
for (var individualStyleName in expansion) {
style[individualStyleName] = '';
}
} else {
style[styleName] = '';
}
}
}
}
};
ReactPerf.measureMethods(CSSPropertyOperations, 'CSSPropertyOperations', {
setValueForStyles: 'setValueForStyles'
});
module.exports = CSSPropertyOperations;
},{"118":118,"146":146,"148":148,"159":159,"167":167,"172":172,"4":4,"78":78}],6:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CallbackQueue
*/
'use strict';
var PooledClass = _dereq_(25);
var assign = _dereq_(24);
var invariant = _dereq_(160);
/**
* A specialized pseudo-event module to help keep track of components waiting to
* be notified when their DOM representations are available for use.
*
* This implements `PooledClass`, so you should never need to instantiate this.
* Instead, use `CallbackQueue.getPooled()`.
*
* @class ReactMountReady
* @implements PooledClass
* @internal
*/
function CallbackQueue() {
this._callbacks = null;
this._contexts = null;
}
assign(CallbackQueue.prototype, {
/**
* Enqueues a callback to be invoked when `notifyAll` is invoked.
*
* @param {function} callback Invoked when `notifyAll` is invoked.
* @param {?object} context Context to call `callback` with.
* @internal
*/
enqueue: function (callback, context) {
this._callbacks = this._callbacks || [];
this._contexts = this._contexts || [];
this._callbacks.push(callback);
this._contexts.push(context);
},
/**
* Invokes all enqueued callbacks and clears the queue. This is invoked after
* the DOM representation of a component has been created or updated.
*
* @internal
*/
notifyAll: function () {
var callbacks = this._callbacks;
var contexts = this._contexts;
if (callbacks) {
!(callbacks.length === contexts.length) ? "development" !== 'production' ? invariant(false, 'Mismatched list of contexts in callback queue') : invariant(false) : undefined;
this._callbacks = null;
this._contexts = null;
for (var i = 0; i < callbacks.length; i++) {
callbacks[i].call(contexts[i]);
}
callbacks.length = 0;
contexts.length = 0;
}
},
/**
* Resets the internal queue.
*
* @internal
*/
reset: function () {
this._callbacks = null;
this._contexts = null;
},
/**
* `PooledClass` looks for this.
*/
destructor: function () {
this.reset();
}
});
PooledClass.addPoolingTo(CallbackQueue);
module.exports = CallbackQueue;
},{"160":160,"24":24,"25":25}],7:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ChangeEventPlugin
*/
'use strict';
var EventConstants = _dereq_(15);
var EventPluginHub = _dereq_(16);
var EventPropagators = _dereq_(19);
var ExecutionEnvironment = _dereq_(146);
var ReactUpdates = _dereq_(96);
var SyntheticEvent = _dereq_(105);
var getEventTarget = _dereq_(127);
var isEventSupported = _dereq_(132);
var isTextInputElement = _dereq_(133);
var keyOf = _dereq_(165);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
change: {
phasedRegistrationNames: {
bubbled: keyOf({ onChange: null }),
captured: keyOf({ onChangeCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topChange, topLevelTypes.topClick, topLevelTypes.topFocus, topLevelTypes.topInput, topLevelTypes.topKeyDown, topLevelTypes.topKeyUp, topLevelTypes.topSelectionChange]
}
};
/**
* For IE shims
*/
var activeElement = null;
var activeElementID = null;
var activeElementValue = null;
var activeElementValueProp = null;
/**
* SECTION: handle `change` event
*/
function shouldUseChangeEvent(elem) {
var nodeName = elem.nodeName && elem.nodeName.toLowerCase();
return nodeName === 'select' || nodeName === 'input' && elem.type === 'file';
}
var doesChangeEventBubble = false;
if (ExecutionEnvironment.canUseDOM) {
// See `handleChange` comment below
doesChangeEventBubble = isEventSupported('change') && (!('documentMode' in document) || document.documentMode > 8);
}
function manualDispatchChangeEvent(nativeEvent) {
var event = SyntheticEvent.getPooled(eventTypes.change, activeElementID, nativeEvent, getEventTarget(nativeEvent));
EventPropagators.accumulateTwoPhaseDispatches(event);
// If change and propertychange bubbled, we'd just bind to it like all the
// other events and have it go through ReactBrowserEventEmitter. Since it
// doesn't, we manually listen for the events and so we have to enqueue and
// process the abstract event manually.
//
// Batching is necessary here in order to ensure that all event handlers run
// before the next rerender (including event handlers attached to ancestor
// elements instead of directly on the input). Without this, controlled
// components don't work properly in conjunction with event bubbling because
// the component is rerendered and the value reverted before all the event
// handlers can run. See https://github.com/facebook/react/issues/708.
ReactUpdates.batchedUpdates(runEventInBatch, event);
}
function runEventInBatch(event) {
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue(false);
}
function startWatchingForChangeEventIE8(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElement.attachEvent('onchange', manualDispatchChangeEvent);
}
function stopWatchingForChangeEventIE8() {
if (!activeElement) {
return;
}
activeElement.detachEvent('onchange', manualDispatchChangeEvent);
activeElement = null;
activeElementID = null;
}
function getTargetIDForChangeEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topChange) {
return topLevelTargetID;
}
}
function handleEventsForChangeEventIE8(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForChangeEventIE8();
startWatchingForChangeEventIE8(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForChangeEventIE8();
}
}
/**
* SECTION: handle `input` event
*/
var isInputEventSupported = false;
if (ExecutionEnvironment.canUseDOM) {
// IE9 claims to support the input event but fails to trigger it when
// deleting text, so we ignore its input events
isInputEventSupported = isEventSupported('input') && (!('documentMode' in document) || document.documentMode > 9);
}
/**
* (For old IE.) Replacement getter/setter for the `value` property that gets
* set on the active element.
*/
var newValueProp = {
get: function () {
return activeElementValueProp.get.call(this);
},
set: function (val) {
// Cast to a string so we can do equality checks.
activeElementValue = '' + val;
activeElementValueProp.set.call(this, val);
}
};
/**
* (For old IE.) Starts tracking propertychange events on the passed-in element
* and override the value property so that we can distinguish user events from
* value changes in JS.
*/
function startWatchingForValueChange(target, targetID) {
activeElement = target;
activeElementID = targetID;
activeElementValue = target.value;
activeElementValueProp = Object.getOwnPropertyDescriptor(target.constructor.prototype, 'value');
Object.defineProperty(activeElement, 'value', newValueProp);
activeElement.attachEvent('onpropertychange', handlePropertyChange);
}
/**
* (For old IE.) Removes the event listeners from the currently-tracked element,
* if any exists.
*/
function stopWatchingForValueChange() {
if (!activeElement) {
return;
}
// delete restores the original property definition
delete activeElement.value;
activeElement.detachEvent('onpropertychange', handlePropertyChange);
activeElement = null;
activeElementID = null;
activeElementValue = null;
activeElementValueProp = null;
}
/**
* (For old IE.) Handles a propertychange event, sending a `change` event if
* the value of the active element has changed.
*/
function handlePropertyChange(nativeEvent) {
if (nativeEvent.propertyName !== 'value') {
return;
}
var value = nativeEvent.srcElement.value;
if (value === activeElementValue) {
return;
}
activeElementValue = value;
manualDispatchChangeEvent(nativeEvent);
}
/**
* If a `change` event should be fired, returns the target's ID.
*/
function getTargetIDForInputEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topInput) {
// In modern browsers (i.e., not IE8 or IE9), the input event is exactly
// what we want so fall through here and trigger an abstract event
return topLevelTargetID;
}
}
// For IE8 and IE9.
function handleEventsForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topFocus) {
// In IE8, we can capture almost all .value changes by adding a
// propertychange handler and looking for events with propertyName
// equal to 'value'
// In IE9, propertychange fires for most input events but is buggy and
// doesn't fire when text is deleted, but conveniently, selectionchange
// appears to fire in all of the remaining cases so we catch those and
// forward the event if the value has changed
// In either case, we don't want to call the event handler if the value
// is changed from JS so we redefine a setter for `.value` that updates
// our activeElementValue variable, allowing us to ignore those changes
//
// stopWatching() should be a noop here but we call it just in case we
// missed a blur event somehow.
stopWatchingForValueChange();
startWatchingForValueChange(topLevelTarget, topLevelTargetID);
} else if (topLevelType === topLevelTypes.topBlur) {
stopWatchingForValueChange();
}
}
// For IE8 and IE9.
function getTargetIDForInputEventIE(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topSelectionChange || topLevelType === topLevelTypes.topKeyUp || topLevelType === topLevelTypes.topKeyDown) {
// On the selectionchange event, the target is just document which isn't
// helpful for us so just check activeElement instead.
//
// 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire
// propertychange on the first input event after setting `value` from a
// script and fires only keydown, keypress, keyup. Catching keyup usually
// gets it and catching keydown lets us fire an event for the first
// keystroke if user does a key repeat (it'll be a little delayed: right
// before the second keystroke). Other input methods (e.g., paste) seem to
// fire selectionchange normally.
if (activeElement && activeElement.value !== activeElementValue) {
activeElementValue = activeElement.value;
return activeElementID;
}
}
}
/**
* SECTION: handle `click` event
*/
function shouldUseClickEvent(elem) {
// Use the `click` event to detect changes to checkbox and radio inputs.
// This approach works across all browsers, whereas `change` does not fire
// until `blur` in IE8.
return elem.nodeName && elem.nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio');
}
function getTargetIDForClickEvent(topLevelType, topLevelTarget, topLevelTargetID) {
if (topLevelType === topLevelTypes.topClick) {
return topLevelTargetID;
}
}
/**
* This plugin creates an `onChange` event that normalizes change events
* across form elements. This event fires at a time when it's possible to
* change the element's value without seeing a flicker.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - select
*/
var ChangeEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var getTargetIDFunc, handleEventFunc;
if (shouldUseChangeEvent(topLevelTarget)) {
if (doesChangeEventBubble) {
getTargetIDFunc = getTargetIDForChangeEvent;
} else {
handleEventFunc = handleEventsForChangeEventIE8;
}
} else if (isTextInputElement(topLevelTarget)) {
if (isInputEventSupported) {
getTargetIDFunc = getTargetIDForInputEvent;
} else {
getTargetIDFunc = getTargetIDForInputEventIE;
handleEventFunc = handleEventsForInputEventIE;
}
} else if (shouldUseClickEvent(topLevelTarget)) {
getTargetIDFunc = getTargetIDForClickEvent;
}
if (getTargetIDFunc) {
var targetID = getTargetIDFunc(topLevelType, topLevelTarget, topLevelTargetID);
if (targetID) {
var event = SyntheticEvent.getPooled(eventTypes.change, targetID, nativeEvent, nativeEventTarget);
event.type = 'change';
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
}
}
if (handleEventFunc) {
handleEventFunc(topLevelType, topLevelTarget, topLevelTargetID);
}
}
};
module.exports = ChangeEventPlugin;
},{"105":105,"127":127,"132":132,"133":133,"146":146,"15":15,"16":16,"165":165,"19":19,"96":96}],8:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ClientReactRootIndex
* @typechecks
*/
'use strict';
var nextReactRootIndex = 0;
var ClientReactRootIndex = {
createReactRootIndex: function () {
return nextReactRootIndex++;
}
};
module.exports = ClientReactRootIndex;
},{}],9:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMChildrenOperations
* @typechecks static-only
*/
'use strict';
var Danger = _dereq_(12);
var ReactMultiChildUpdateTypes = _dereq_(74);
var ReactPerf = _dereq_(78);
var setInnerHTML = _dereq_(137);
var setTextContent = _dereq_(138);
var invariant = _dereq_(160);
/**
* Inserts `childNode` as a child of `parentNode` at the `index`.
*
* @param {DOMElement} parentNode Parent node in which to insert.
* @param {DOMElement} childNode Child node to insert.
* @param {number} index Index at which to insert the child.
* @internal
*/
function insertChildAt(parentNode, childNode, index) {
// By exploiting arrays returning `undefined` for an undefined index, we can
// rely exclusively on `insertBefore(node, null)` instead of also using
// `appendChild(node)`. However, using `undefined` is not allowed by all
// browsers so we must replace it with `null`.
// fix render order error in safari
// IE8 will throw error when index out of list size.
var beforeChild = index >= parentNode.childNodes.length ? null : parentNode.childNodes.item(index);
parentNode.insertBefore(childNode, beforeChild);
}
/**
* Operations for updating with DOM children.
*/
var DOMChildrenOperations = {
dangerouslyReplaceNodeWithMarkup: Danger.dangerouslyReplaceNodeWithMarkup,
updateTextContent: setTextContent,
/**
* Updates a component's children by processing a series of updates. The
* update configurations are each expected to have a `parentNode` property.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markupList List of markup strings.
* @internal
*/
processUpdates: function (updates, markupList) {
var update;
// Mapping from parent IDs to initial child orderings.
var initialChildren = null;
// List of children that will be moved or removed.
var updatedChildren = null;
for (var i = 0; i < updates.length; i++) {
update = updates[i];
if (update.type === ReactMultiChildUpdateTypes.MOVE_EXISTING || update.type === ReactMultiChildUpdateTypes.REMOVE_NODE) {
var updatedIndex = update.fromIndex;
var updatedChild = update.parentNode.childNodes[updatedIndex];
var parentID = update.parentID;
!updatedChild ? "development" !== 'production' ? invariant(false, 'processUpdates(): Unable to find child %s of element. This ' + 'probably means the DOM was unexpectedly mutated (e.g., by the ' + 'browser), usually due to forgetting a <tbody> when using tables, ' + 'nesting tags like <form>, <p>, or <a>, or using non-SVG elements ' + 'in an <svg> parent. Try inspecting the child nodes of the element ' + 'with React ID `%s`.', updatedIndex, parentID) : invariant(false) : undefined;
initialChildren = initialChildren || {};
initialChildren[parentID] = initialChildren[parentID] || [];
initialChildren[parentID][updatedIndex] = updatedChild;
updatedChildren = updatedChildren || [];
updatedChildren.push(updatedChild);
}
}
var renderedMarkup;
// markupList is either a list of markup or just a list of elements
if (markupList.length && typeof markupList[0] === 'string') {
renderedMarkup = Danger.dangerouslyRenderMarkup(markupList);
} else {
renderedMarkup = markupList;
}
// Remove updated children first so that `toIndex` is consistent.
if (updatedChildren) {
for (var j = 0; j < updatedChildren.length; j++) {
updatedChildren[j].parentNode.removeChild(updatedChildren[j]);
}
}
for (var k = 0; k < updates.length; k++) {
update = updates[k];
switch (update.type) {
case ReactMultiChildUpdateTypes.INSERT_MARKUP:
insertChildAt(update.parentNode, renderedMarkup[update.markupIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.MOVE_EXISTING:
insertChildAt(update.parentNode, initialChildren[update.parentID][update.fromIndex], update.toIndex);
break;
case ReactMultiChildUpdateTypes.SET_MARKUP:
setInnerHTML(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.TEXT_CONTENT:
setTextContent(update.parentNode, update.content);
break;
case ReactMultiChildUpdateTypes.REMOVE_NODE:
// Already removed by the for-loop above.
break;
}
}
}
};
ReactPerf.measureMethods(DOMChildrenOperations, 'DOMChildrenOperations', {
updateTextContent: 'updateTextContent'
});
module.exports = DOMChildrenOperations;
},{"12":12,"137":137,"138":138,"160":160,"74":74,"78":78}],10:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMProperty
* @typechecks static-only
*/
'use strict';
var invariant = _dereq_(160);
function checkMask(value, bitmask) {
return (value & bitmask) === bitmask;
}
var DOMPropertyInjection = {
/**
* Mapping from normalized, camelcased property names to a configuration that
* specifies how the associated DOM property should be accessed or rendered.
*/
MUST_USE_ATTRIBUTE: 0x1,
MUST_USE_PROPERTY: 0x2,
HAS_SIDE_EFFECTS: 0x4,
HAS_BOOLEAN_VALUE: 0x8,
HAS_NUMERIC_VALUE: 0x10,
HAS_POSITIVE_NUMERIC_VALUE: 0x20 | 0x10,
HAS_OVERLOADED_BOOLEAN_VALUE: 0x40,
/**
* Inject some specialized knowledge about the DOM. This takes a config object
* with the following properties:
*
* isCustomAttribute: function that given an attribute name will return true
* if it can be inserted into the DOM verbatim. Useful for data-* or aria-*
* attributes where it's impossible to enumerate all of the possible
* attribute names,
*
* Properties: object mapping DOM property name to one of the
* DOMPropertyInjection constants or null. If your attribute isn't in here,
* it won't get written to the DOM.
*
* DOMAttributeNames: object mapping React attribute name to the DOM
* attribute name. Attribute names not specified use the **lowercase**
* normalized name.
*
* DOMAttributeNamespaces: object mapping React attribute name to the DOM
* attribute namespace URL. (Attribute names not specified use no namespace.)
*
* DOMPropertyNames: similar to DOMAttributeNames but for DOM properties.
* Property names not specified use the normalized name.
*
* DOMMutationMethods: Properties that require special mutation methods. If
* `value` is undefined, the mutation method should unset the property.
*
* @param {object} domPropertyConfig the config as described above.
*/
injectDOMPropertyConfig: function (domPropertyConfig) {
var Injection = DOMPropertyInjection;
var Properties = domPropertyConfig.Properties || {};
var DOMAttributeNamespaces = domPropertyConfig.DOMAttributeNamespaces || {};
var DOMAttributeNames = domPropertyConfig.DOMAttributeNames || {};
var DOMPropertyNames = domPropertyConfig.DOMPropertyNames || {};
var DOMMutationMethods = domPropertyConfig.DOMMutationMethods || {};
if (domPropertyConfig.isCustomAttribute) {
DOMProperty._isCustomAttributeFunctions.push(domPropertyConfig.isCustomAttribute);
}
for (var propName in Properties) {
!!DOMProperty.properties.hasOwnProperty(propName) ? "development" !== 'production' ? invariant(false, 'injectDOMPropertyConfig(...): You\'re trying to inject DOM property ' + '\'%s\' which has already been injected. You may be accidentally ' + 'injecting the same DOM property config twice, or you may be ' + 'injecting two configs that have conflicting property names.', propName) : invariant(false) : undefined;
var lowerCased = propName.toLowerCase();
var propConfig = Properties[propName];
var propertyInfo = {
attributeName: lowerCased,
attributeNamespace: null,
propertyName: propName,
mutationMethod: null,
mustUseAttribute: checkMask(propConfig, Injection.MUST_USE_ATTRIBUTE),
mustUseProperty: checkMask(propConfig, Injection.MUST_USE_PROPERTY),
hasSideEffects: checkMask(propConfig, Injection.HAS_SIDE_EFFECTS),
hasBooleanValue: checkMask(propConfig, Injection.HAS_BOOLEAN_VALUE),
hasNumericValue: checkMask(propConfig, Injection.HAS_NUMERIC_VALUE),
hasPositiveNumericValue: checkMask(propConfig, Injection.HAS_POSITIVE_NUMERIC_VALUE),
hasOverloadedBooleanValue: checkMask(propConfig, Injection.HAS_OVERLOADED_BOOLEAN_VALUE)
};
!(!propertyInfo.mustUseAttribute || !propertyInfo.mustUseProperty) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Cannot require using both attribute and property: %s', propName) : invariant(false) : undefined;
!(propertyInfo.mustUseProperty || !propertyInfo.hasSideEffects) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Properties that have side effects must use property: %s', propName) : invariant(false) : undefined;
!(propertyInfo.hasBooleanValue + propertyInfo.hasNumericValue + propertyInfo.hasOverloadedBooleanValue <= 1) ? "development" !== 'production' ? invariant(false, 'DOMProperty: Value can be one of boolean, overloaded boolean, or ' + 'numeric value, but not a combination: %s', propName) : invariant(false) : undefined;
if ("development" !== 'production') {
DOMProperty.getPossibleStandardName[lowerCased] = propName;
}
if (DOMAttributeNames.hasOwnProperty(propName)) {
var attributeName = DOMAttributeNames[propName];
propertyInfo.attributeName = attributeName;
if ("development" !== 'production') {
DOMProperty.getPossibleStandardName[attributeName] = propName;
}
}
if (DOMAttributeNamespaces.hasOwnProperty(propName)) {
propertyInfo.attributeNamespace = DOMAttributeNamespaces[propName];
}
if (DOMPropertyNames.hasOwnProperty(propName)) {
propertyInfo.propertyName = DOMPropertyNames[propName];
}
if (DOMMutationMethods.hasOwnProperty(propName)) {
propertyInfo.mutationMethod = DOMMutationMethods[propName];
}
DOMProperty.properties[propName] = propertyInfo;
}
}
};
var defaultValueCache = {};
/**
* DOMProperty exports lookup objects that can be used like functions:
*
* > DOMProperty.isValid['id']
* true
* > DOMProperty.isValid['foobar']
* undefined
*
* Although this may be confusing, it performs better in general.
*
* @see http://jsperf.com/key-exists
* @see http://jsperf.com/key-missing
*/
var DOMProperty = {
ID_ATTRIBUTE_NAME: 'data-reactid',
/**
* Map from property "standard name" to an object with info about how to set
* the property in the DOM. Each object contains:
*
* attributeName:
* Used when rendering markup or with `*Attribute()`.
* attributeNamespace
* propertyName:
* Used on DOM node instances. (This includes properties that mutate due to
* external factors.)
* mutationMethod:
* If non-null, used instead of the property or `setAttribute()` after
* initial render.
* mustUseAttribute:
* Whether the property must be accessed and mutated using `*Attribute()`.
* (This includes anything that fails `<propName> in <element>`.)
* mustUseProperty:
* Whether the property must be accessed and mutated as an object property.
* hasSideEffects:
* Whether or not setting a value causes side effects such as triggering
* resources to be loaded or text selection changes. If true, we read from
* the DOM before updating to ensure that the value is only set if it has
* changed.
* hasBooleanValue:
* Whether the property should be removed when set to a falsey value.
* hasNumericValue:
* Whether the property must be numeric or parse as a numeric and should be
* removed when set to a falsey value.
* hasPositiveNumericValue:
* Whether the property must be positive numeric or parse as a positive
* numeric and should be removed when set to a falsey value.
* hasOverloadedBooleanValue:
* Whether the property can be used as a flag as well as with a value.
* Removed when strictly equal to false; present without a value when
* strictly equal to true; present with a value otherwise.
*/
properties: {},
/**
* Mapping from lowercase property names to the properly cased version, used
* to warn in the case of missing properties. Available only in __DEV__.
* @type {Object}
*/
getPossibleStandardName: "development" !== 'production' ? {} : null,
/**
* All of the isCustomAttribute() functions that have been injected.
*/
_isCustomAttributeFunctions: [],
/**
* Checks whether a property name is a custom attribute.
* @method
*/
isCustomAttribute: function (attributeName) {
for (var i = 0; i < DOMProperty._isCustomAttributeFunctions.length; i++) {
var isCustomAttributeFn = DOMProperty._isCustomAttributeFunctions[i];
if (isCustomAttributeFn(attributeName)) {
return true;
}
}
return false;
},
/**
* Returns the default property value for a DOM property (i.e., not an
* attribute). Most default values are '' or false, but not all. Worse yet,
* some (in particular, `type`) vary depending on the type of element.
*
* TODO: Is it better to grab all the possible properties when creating an
* element to avoid having to create the same element twice?
*/
getDefaultValueForProperty: function (nodeName, prop) {
var nodeDefaults = defaultValueCache[nodeName];
var testElement;
if (!nodeDefaults) {
defaultValueCache[nodeName] = nodeDefaults = {};
}
if (!(prop in nodeDefaults)) {
testElement = document.createElement(nodeName);
nodeDefaults[prop] = testElement[prop];
}
return nodeDefaults[prop];
},
injection: DOMPropertyInjection
};
module.exports = DOMProperty;
},{"160":160}],11:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DOMPropertyOperations
* @typechecks static-only
*/
'use strict';
var DOMProperty = _dereq_(10);
var ReactPerf = _dereq_(78);
var quoteAttributeValueForBrowser = _dereq_(135);
var warning = _dereq_(172);
// Simplified subset
var VALID_ATTRIBUTE_NAME_REGEX = /^[a-zA-Z_][\w\.\-]*$/;
var illegalAttributeNameCache = {};
var validatedAttributeNameCache = {};
function isAttributeNameSafe(attributeName) {
if (validatedAttributeNameCache.hasOwnProperty(attributeName)) {
return true;
}
if (illegalAttributeNameCache.hasOwnProperty(attributeName)) {
return false;
}
if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) {
validatedAttributeNameCache[attributeName] = true;
return true;
}
illegalAttributeNameCache[attributeName] = true;
"development" !== 'production' ? warning(false, 'Invalid attribute name: `%s`', attributeName) : undefined;
return false;
}
function shouldIgnoreValue(propertyInfo, value) {
return value == null || propertyInfo.hasBooleanValue && !value || propertyInfo.hasNumericValue && isNaN(value) || propertyInfo.hasPositiveNumericValue && value < 1 || propertyInfo.hasOverloadedBooleanValue && value === false;
}
if ("development" !== 'production') {
var reactProps = {
children: true,
dangerouslySetInnerHTML: true,
key: true,
ref: true
};
var warnedProperties = {};
var warnUnknownProperty = function (name) {
if (reactProps.hasOwnProperty(name) && reactProps[name] || warnedProperties.hasOwnProperty(name) && warnedProperties[name]) {
return;
}
warnedProperties[name] = true;
var lowerCasedName = name.toLowerCase();
// data-* attributes should be lowercase; suggest the lowercase version
var standardName = DOMProperty.isCustomAttribute(lowerCasedName) ? lowerCasedName : DOMProperty.getPossibleStandardName.hasOwnProperty(lowerCasedName) ? DOMProperty.getPossibleStandardName[lowerCasedName] : null;
// For now, only warn when we have a suggested correction. This prevents
// logging too much when using transferPropsTo.
"development" !== 'production' ? warning(standardName == null, 'Unknown DOM property %s. Did you mean %s?', name, standardName) : undefined;
};
}
/**
* Operations for dealing with DOM properties.
*/
var DOMPropertyOperations = {
/**
* Creates markup for the ID property.
*
* @param {string} id Unescaped ID.
* @return {string} Markup string.
*/
createMarkupForID: function (id) {
return DOMProperty.ID_ATTRIBUTE_NAME + '=' + quoteAttributeValueForBrowser(id);
},
setAttributeForID: function (node, id) {
node.setAttribute(DOMProperty.ID_ATTRIBUTE_NAME, id);
},
/**
* Creates markup for a property.
*
* @param {string} name
* @param {*} value
* @return {?string} Markup string, or null if the property was invalid.
*/
createMarkupForProperty: function (name, value) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
if (shouldIgnoreValue(propertyInfo, value)) {
return '';
}
var attributeName = propertyInfo.attributeName;
if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
return attributeName + '=""';
}
return attributeName + '=' + quoteAttributeValueForBrowser(value);
} else if (DOMProperty.isCustomAttribute(name)) {
if (value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
} else if ("development" !== 'production') {
warnUnknownProperty(name);
}
return null;
},
/**
* Creates markup for a custom property.
*
* @param {string} name
* @param {*} value
* @return {string} Markup string, or empty string if the property was invalid.
*/
createMarkupForCustomAttribute: function (name, value) {
if (!isAttributeNameSafe(name) || value == null) {
return '';
}
return name + '=' + quoteAttributeValueForBrowser(value);
},
/**
* Sets the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
* @param {*} value
*/
setValueForProperty: function (node, name, value) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, value);
} else if (shouldIgnoreValue(propertyInfo, value)) {
this.deleteValueForProperty(node, name);
} else if (propertyInfo.mustUseAttribute) {
var attributeName = propertyInfo.attributeName;
var namespace = propertyInfo.attributeNamespace;
// `setAttribute` with objects becomes only `[object]` in IE8/9,
// ('' + value) makes it output the correct toString()-value.
if (namespace) {
node.setAttributeNS(namespace, attributeName, '' + value);
} else if (propertyInfo.hasBooleanValue || propertyInfo.hasOverloadedBooleanValue && value === true) {
node.setAttribute(attributeName, '');
} else {
node.setAttribute(attributeName, '' + value);
}
} else {
var propName = propertyInfo.propertyName;
// Must explicitly cast values for HAS_SIDE_EFFECTS-properties to the
// property type before comparing; only `value` does and is string.
if (!propertyInfo.hasSideEffects || '' + node[propName] !== '' + value) {
// Contrary to `setAttribute`, object properties are properly
// `toString`ed by IE8/9.
node[propName] = value;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
DOMPropertyOperations.setValueForAttribute(node, name, value);
} else if ("development" !== 'production') {
warnUnknownProperty(name);
}
},
setValueForAttribute: function (node, name, value) {
if (!isAttributeNameSafe(name)) {
return;
}
if (value == null) {
node.removeAttribute(name);
} else {
node.setAttribute(name, '' + value);
}
},
/**
* Deletes the value for a property on a node.
*
* @param {DOMElement} node
* @param {string} name
*/
deleteValueForProperty: function (node, name) {
var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
if (propertyInfo) {
var mutationMethod = propertyInfo.mutationMethod;
if (mutationMethod) {
mutationMethod(node, undefined);
} else if (propertyInfo.mustUseAttribute) {
node.removeAttribute(propertyInfo.attributeName);
} else {
var propName = propertyInfo.propertyName;
var defaultValue = DOMProperty.getDefaultValueForProperty(node.nodeName, propName);
if (!propertyInfo.hasSideEffects || '' + node[propName] !== defaultValue) {
node[propName] = defaultValue;
}
}
} else if (DOMProperty.isCustomAttribute(name)) {
node.removeAttribute(name);
} else if ("development" !== 'production') {
warnUnknownProperty(name);
}
}
};
ReactPerf.measureMethods(DOMPropertyOperations, 'DOMPropertyOperations', {
setValueForProperty: 'setValueForProperty',
setValueForAttribute: 'setValueForAttribute',
deleteValueForProperty: 'deleteValueForProperty'
});
module.exports = DOMPropertyOperations;
},{"10":10,"135":135,"172":172,"78":78}],12:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Danger
* @typechecks static-only
*/
'use strict';
var ExecutionEnvironment = _dereq_(146);
var createNodesFromMarkup = _dereq_(151);
var emptyFunction = _dereq_(152);
var getMarkupWrap = _dereq_(156);
var invariant = _dereq_(160);
var OPEN_TAG_NAME_EXP = /^(<[^ \/>]+)/;
var RESULT_INDEX_ATTR = 'data-danger-index';
/**
* Extracts the `nodeName` from a string of markup.
*
* NOTE: Extracting the `nodeName` does not require a regular expression match
* because we make assumptions about React-generated markup (i.e. there are no
* spaces surrounding the opening tag and there is at least one attribute).
*
* @param {string} markup String of markup.
* @return {string} Node name of the supplied markup.
* @see http://jsperf.com/extract-nodename
*/
function getNodeName(markup) {
return markup.substring(1, markup.indexOf(' '));
}
var Danger = {
/**
* Renders markup into an array of nodes. The markup is expected to render
* into a list of root nodes. Also, the length of `resultList` and
* `markupList` should be the same.
*
* @param {array<string>} markupList List of markup strings to render.
* @return {array<DOMElement>} List of rendered nodes.
* @internal
*/
dangerouslyRenderMarkup: function (markupList) {
!ExecutionEnvironment.canUseDOM ? "development" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Cannot render markup in a worker ' + 'thread. Make sure `window` and `document` are available globally ' + 'before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString for server rendering.') : invariant(false) : undefined;
var nodeName;
var markupByNodeName = {};
// Group markup by `nodeName` if a wrap is necessary, else by '*'.
for (var i = 0; i < markupList.length; i++) {
!markupList[i] ? "development" !== 'production' ? invariant(false, 'dangerouslyRenderMarkup(...): Missing markup.') : invariant(false) : undefined;
nodeName = getNodeName(markupList[i]);
nodeName = getMarkupWrap(nodeName) ? nodeName : '*';
markupByNodeName[nodeName] = markupByNodeName[nodeName] || [];
markupByNodeName[nodeName][i] = markupList[i];
}
var resultList = [];
var resultListAssignmentCount = 0;
for (nodeName in markupByNodeName) {
if (!markupByNodeName.hasOwnProperty(nodeName)) {
continue;
}
var markupListByNodeName = markupByNodeName[nodeName];
// This for-in loop skips the holes of the sparse array. The order of
// iteration should follow the order of assignment, which happens to match
// numerical index order, but we don't rely on that.
var resultIndex;
for (resultIndex in markupListByNodeName) {
if (markupListByNodeName.hasOwnProperty(resultIndex)) {
var markup = markupListByNodeName[resultIndex];
// Push the requested markup with an additional RESULT_INDEX_ATTR
// attribute. If the markup does not start with a < character, it
// will be discarded below (with an appropriate console.error).
markupListByNodeName[resultIndex] = markup.replace(OPEN_TAG_NAME_EXP,
// This index will be parsed back out below.
'$1 ' + RESULT_INDEX_ATTR + '="' + resultIndex + '" ');
}
}
// Render each group of markup with similar wrapping `nodeName`.
var renderNodes = createNodesFromMarkup(markupListByNodeName.join(''), emptyFunction // Do nothing special with <script> tags.
);
for (var j = 0; j < renderNodes.length; ++j) {
var renderNode = renderNodes[j];
if (renderNode.hasAttribute && renderNode.hasAttribute(RESULT_INDEX_ATTR)) {
resultIndex = +renderNode.getAttribute(RESULT_INDEX_ATTR);
renderNode.removeAttribute(RESULT_INDEX_ATTR);
!!resultList.hasOwnProperty(resultIndex) ? "development" !== 'production' ? invariant(false, 'Danger: Assigning to an already-occupied result index.') : invariant(false) : undefined;
resultList[resultIndex] = renderNode;
// This should match resultList.length and markupList.length when
// we're done.
resultListAssignmentCount += 1;
} else if ("development" !== 'production') {
console.error('Danger: Discarding unexpected node:', renderNode);
}
}
}
// Although resultList was populated out of order, it should now be a dense
// array.
!(resultListAssignmentCount === resultList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Did not assign to every index of resultList.') : invariant(false) : undefined;
!(resultList.length === markupList.length) ? "development" !== 'production' ? invariant(false, 'Danger: Expected markup to render %s nodes, but rendered %s.', markupList.length, resultList.length) : invariant(false) : undefined;
return resultList;
},
/**
* Replaces a node with a string of markup at its current position within its
* parent. The markup must render into a single root node.
*
* @param {DOMElement} oldChild Child node to replace.
* @param {string} markup Markup to render in place of the child node.
* @internal
*/
dangerouslyReplaceNodeWithMarkup: function (oldChild, markup) {
!ExecutionEnvironment.canUseDOM ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot render markup in a ' + 'worker thread. Make sure `window` and `document` are available ' + 'globally before requiring React when unit testing or use ' + 'ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
!markup ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Missing markup.') : invariant(false) : undefined;
!(oldChild.tagName.toLowerCase() !== 'html') ? "development" !== 'production' ? invariant(false, 'dangerouslyReplaceNodeWithMarkup(...): Cannot replace markup of the ' + '<html> node. This is because browser quirks make this unreliable ' + 'and/or slow. If you want to render to the root you must use ' + 'server rendering. See ReactDOMServer.renderToString().') : invariant(false) : undefined;
var newChild;
if (typeof markup === 'string') {
newChild = createNodesFromMarkup(markup, emptyFunction)[0];
} else {
newChild = markup;
}
oldChild.parentNode.replaceChild(newChild, oldChild);
}
};
module.exports = Danger;
},{"146":146,"151":151,"152":152,"156":156,"160":160}],13:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule DefaultEventPluginOrder
*/
'use strict';
var keyOf = _dereq_(165);
/**
* Module that is injectable into `EventPluginHub`, that specifies a
* deterministic ordering of `EventPlugin`s. A convenient way to reason about
* plugins, without having to package every one of them. This is better than
* having plugins be ordered in the same order that they are injected because
* that ordering would be influenced by the packaging order.
* `ResponderEventPlugin` must occur before `SimpleEventPlugin` so that
* preventing default on events is convenient in `SimpleEventPlugin` handlers.
*/
var DefaultEventPluginOrder = [keyOf({ ResponderEventPlugin: null }), keyOf({ SimpleEventPlugin: null }), keyOf({ TapEventPlugin: null }), keyOf({ EnterLeaveEventPlugin: null }), keyOf({ ChangeEventPlugin: null }), keyOf({ SelectEventPlugin: null }), keyOf({ BeforeInputEventPlugin: null })];
module.exports = DefaultEventPluginOrder;
},{"165":165}],14:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EnterLeaveEventPlugin
* @typechecks static-only
*/
'use strict';
var EventConstants = _dereq_(15);
var EventPropagators = _dereq_(19);
var SyntheticMouseEvent = _dereq_(109);
var ReactMount = _dereq_(72);
var keyOf = _dereq_(165);
var topLevelTypes = EventConstants.topLevelTypes;
var getFirstReactDOM = ReactMount.getFirstReactDOM;
var eventTypes = {
mouseEnter: {
registrationName: keyOf({ onMouseEnter: null }),
dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
},
mouseLeave: {
registrationName: keyOf({ onMouseLeave: null }),
dependencies: [topLevelTypes.topMouseOut, topLevelTypes.topMouseOver]
}
};
var extractedEvents = [null, null];
var EnterLeaveEventPlugin = {
eventTypes: eventTypes,
/**
* For almost every interaction we care about, there will be both a top-level
* `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that
* we do not extract duplicate events. However, moving the mouse into the
* browser from outside will not fire a `mouseout` event. In this case, we use
* the `mouseover` top-level event.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
if (topLevelType === topLevelTypes.topMouseOver && (nativeEvent.relatedTarget || nativeEvent.fromElement)) {
return null;
}
if (topLevelType !== topLevelTypes.topMouseOut && topLevelType !== topLevelTypes.topMouseOver) {
// Must not be a mouse in or mouse out - ignoring.
return null;
}
var win;
if (topLevelTarget.window === topLevelTarget) {
// `topLevelTarget` is probably a window object.
win = topLevelTarget;
} else {
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
var doc = topLevelTarget.ownerDocument;
if (doc) {
win = doc.defaultView || doc.parentWindow;
} else {
win = window;
}
}
var from;
var to;
var fromID = '';
var toID = '';
if (topLevelType === topLevelTypes.topMouseOut) {
from = topLevelTarget;
fromID = topLevelTargetID;
to = getFirstReactDOM(nativeEvent.relatedTarget || nativeEvent.toElement);
if (to) {
toID = ReactMount.getID(to);
} else {
to = win;
}
to = to || win;
} else {
from = win;
to = topLevelTarget;
toID = topLevelTargetID;
}
if (from === to) {
// Nothing pertains to our managed components.
return null;
}
var leave = SyntheticMouseEvent.getPooled(eventTypes.mouseLeave, fromID, nativeEvent, nativeEventTarget);
leave.type = 'mouseleave';
leave.target = from;
leave.relatedTarget = to;
var enter = SyntheticMouseEvent.getPooled(eventTypes.mouseEnter, toID, nativeEvent, nativeEventTarget);
enter.type = 'mouseenter';
enter.target = to;
enter.relatedTarget = from;
EventPropagators.accumulateEnterLeaveDispatches(leave, enter, fromID, toID);
extractedEvents[0] = leave;
extractedEvents[1] = enter;
return extractedEvents;
}
};
module.exports = EnterLeaveEventPlugin;
},{"109":109,"15":15,"165":165,"19":19,"72":72}],15:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventConstants
*/
'use strict';
var keyMirror = _dereq_(164);
var PropagationPhases = keyMirror({ bubbled: null, captured: null });
/**
* Types of raw signals from the browser caught at the top level.
*/
var topLevelTypes = keyMirror({
topAbort: null,
topBlur: null,
topCanPlay: null,
topCanPlayThrough: null,
topChange: null,
topClick: null,
topCompositionEnd: null,
topCompositionStart: null,
topCompositionUpdate: null,
topContextMenu: null,
topCopy: null,
topCut: null,
topDoubleClick: null,
topDrag: null,
topDragEnd: null,
topDragEnter: null,
topDragExit: null,
topDragLeave: null,
topDragOver: null,
topDragStart: null,
topDrop: null,
topDurationChange: null,
topEmptied: null,
topEncrypted: null,
topEnded: null,
topError: null,
topFocus: null,
topInput: null,
topKeyDown: null,
topKeyPress: null,
topKeyUp: null,
topLoad: null,
topLoadedData: null,
topLoadedMetadata: null,
topLoadStart: null,
topMouseDown: null,
topMouseMove: null,
topMouseOut: null,
topMouseOver: null,
topMouseUp: null,
topPaste: null,
topPause: null,
topPlay: null,
topPlaying: null,
topProgress: null,
topRateChange: null,
topReset: null,
topScroll: null,
topSeeked: null,
topSeeking: null,
topSelectionChange: null,
topStalled: null,
topSubmit: null,
topSuspend: null,
topTextInput: null,
topTimeUpdate: null,
topTouchCancel: null,
topTouchEnd: null,
topTouchMove: null,
topTouchStart: null,
topVolumeChange: null,
topWaiting: null,
topWheel: null
});
var EventConstants = {
topLevelTypes: topLevelTypes,
PropagationPhases: PropagationPhases
};
module.exports = EventConstants;
},{"164":164}],16:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginHub
*/
'use strict';
var EventPluginRegistry = _dereq_(17);
var EventPluginUtils = _dereq_(18);
var ReactErrorUtils = _dereq_(61);
var accumulateInto = _dereq_(115);
var forEachAccumulated = _dereq_(123);
var invariant = _dereq_(160);
var warning = _dereq_(172);
/**
* Internal store for event listeners
*/
var listenerBank = {};
/**
* Internal queue of events that have accumulated their dispatches and are
* waiting to have their dispatches executed.
*/
var eventQueue = null;
/**
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
* @param {boolean} simulated If the event is simulated (changes exn behavior)
* @private
*/
var executeDispatchesAndRelease = function (event, simulated) {
if (event) {
EventPluginUtils.executeDispatchesInOrder(event, simulated);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
var executeDispatchesAndReleaseSimulated = function (e) {
return executeDispatchesAndRelease(e, true);
};
var executeDispatchesAndReleaseTopLevel = function (e) {
return executeDispatchesAndRelease(e, false);
};
/**
* - `InstanceHandle`: [required] Module that performs logical traversals of DOM
* hierarchy given ids of the logical DOM elements involved.
*/
var InstanceHandle = null;
function validateInstanceHandle() {
var valid = InstanceHandle && InstanceHandle.traverseTwoPhase && InstanceHandle.traverseEnterLeave;
"development" !== 'production' ? warning(valid, 'InstanceHandle not injected before use!') : undefined;
}
/**
* This is a unified interface for event plugins to be installed and configured.
*
* Event plugins can implement the following properties:
*
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
* Required. When a top-level event is fired, this method is expected to
* extract synthetic events that will in turn be queued and dispatched.
*
* `eventTypes` {object}
* Optional, plugins that fire events must publish a mapping of registration
* names that are used to register listeners. Values of this mapping must
* be objects that contain `registrationName` or `phasedRegistrationNames`.
*
* `executeDispatch` {function(object, function, string)}
* Optional, allows plugins to override how an event gets dispatched. By
* default, the listener is simply invoked.
*
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
*
* @public
*/
var EventPluginHub = {
/**
* Methods for injecting dependencies.
*/
injection: {
/**
* @param {object} InjectedMount
* @public
*/
injectMount: EventPluginUtils.injection.injectMount,
/**
* @param {object} InjectedInstanceHandle
* @public
*/
injectInstanceHandle: function (InjectedInstanceHandle) {
InstanceHandle = InjectedInstanceHandle;
if ("development" !== 'production') {
validateInstanceHandle();
}
},
getInstanceHandle: function () {
if ("development" !== 'production') {
validateInstanceHandle();
}
return InstanceHandle;
},
/**
* @param {array} InjectedEventPluginOrder
* @public
*/
injectEventPluginOrder: EventPluginRegistry.injectEventPluginOrder,
/**
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
*/
injectEventPluginsByName: EventPluginRegistry.injectEventPluginsByName
},
eventNameDispatchConfigs: EventPluginRegistry.eventNameDispatchConfigs,
registrationNameModules: EventPluginRegistry.registrationNameModules,
/**
* Stores `listener` at `listenerBank[registrationName][id]`. Is idempotent.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {?function} listener The callback to store.
*/
putListener: function (id, registrationName, listener) {
!(typeof listener === 'function') ? "development" !== 'production' ? invariant(false, 'Expected %s listener to be a function, instead got type %s', registrationName, typeof listener) : invariant(false) : undefined;
var bankForRegistrationName = listenerBank[registrationName] || (listenerBank[registrationName] = {});
bankForRegistrationName[id] = listener;
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.didPutListener) {
PluginModule.didPutListener(id, registrationName, listener);
}
},
/**
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
getListener: function (id, registrationName) {
var bankForRegistrationName = listenerBank[registrationName];
return bankForRegistrationName && bankForRegistrationName[id];
},
/**
* Deletes a listener from the registration bank.
*
* @param {string} id ID of the DOM element.
* @param {string} registrationName Name of listener (e.g. `onClick`).
*/
deleteListener: function (id, registrationName) {
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
PluginModule.willDeleteListener(id, registrationName);
}
var bankForRegistrationName = listenerBank[registrationName];
// TODO: This should never be null -- when is it?
if (bankForRegistrationName) {
delete bankForRegistrationName[id];
}
},
/**
* Deletes all listeners for the DOM element with the supplied ID.
*
* @param {string} id ID of the DOM element.
*/
deleteAllListeners: function (id) {
for (var registrationName in listenerBank) {
if (!listenerBank[registrationName][id]) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[registrationName];
if (PluginModule && PluginModule.willDeleteListener) {
PluginModule.willDeleteListener(id, registrationName);
}
delete listenerBank[registrationName][id];
}
},
/**
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @internal
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events;
var plugins = EventPluginRegistry.plugins;
for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
var extractedEvents = possiblePlugin.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
}
}
return events;
},
/**
* Enqueues a synthetic event that should be dispatched when
* `processEventQueue` is invoked.
*
* @param {*} events An accumulation of synthetic events.
* @internal
*/
enqueueEvents: function (events) {
if (events) {
eventQueue = accumulateInto(eventQueue, events);
}
},
/**
* Dispatches all synthetic events on the event queue.
*
* @internal
*/
processEventQueue: function (simulated) {
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
if (simulated) {
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseSimulated);
} else {
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
}
!!eventQueue ? "development" !== 'production' ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing ' + 'an event queue. Support for this has not yet been implemented.') : invariant(false) : undefined;
// This would be a good time to rethrow if any of the event handlers threw.
ReactErrorUtils.rethrowCaughtError();
},
/**
* These are needed for tests only. Do not use!
*/
__purge: function () {
listenerBank = {};
},
__getListenerBank: function () {
return listenerBank;
}
};
module.exports = EventPluginHub;
},{"115":115,"123":123,"160":160,"17":17,"172":172,"18":18,"61":61}],17:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginRegistry
* @typechecks static-only
*/
'use strict';
var invariant = _dereq_(160);
/**
* Injectable ordering of event plugins.
*/
var EventPluginOrder = null;
/**
* Injectable mapping from names to event plugin modules.
*/
var namesToPlugins = {};
/**
* Recomputes the plugin list using the injected plugins and plugin ordering.
*
* @private
*/
function recomputePluginOrdering() {
if (!EventPluginOrder) {
// Wait until an `EventPluginOrder` is injected.
return;
}
for (var pluginName in namesToPlugins) {
var PluginModule = namesToPlugins[pluginName];
var pluginIndex = EventPluginOrder.indexOf(pluginName);
!(pluginIndex > -1) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in ' + 'the plugin ordering, `%s`.', pluginName) : invariant(false) : undefined;
if (EventPluginRegistry.plugins[pluginIndex]) {
continue;
}
!PluginModule.extractEvents ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` ' + 'method, but `%s` does not.', pluginName) : invariant(false) : undefined;
EventPluginRegistry.plugins[pluginIndex] = PluginModule;
var publishedEvents = PluginModule.eventTypes;
for (var eventName in publishedEvents) {
!publishEventForPlugin(publishedEvents[eventName], PluginModule, eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : invariant(false) : undefined;
}
}
}
/**
* Publishes an event so that it can be dispatched by the supplied plugin.
*
* @param {object} dispatchConfig Dispatch configuration for the event.
* @param {object} PluginModule Plugin publishing the event.
* @return {boolean} True if the event was successfully published.
* @private
*/
function publishEventForPlugin(dispatchConfig, PluginModule, eventName) {
!!EventPluginRegistry.eventNameDispatchConfigs.hasOwnProperty(eventName) ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'event name, `%s`.', eventName) : invariant(false) : undefined;
EventPluginRegistry.eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
if (phasedRegistrationNames) {
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
publishRegistrationName(phasedRegistrationName, PluginModule, eventName);
}
}
return true;
} else if (dispatchConfig.registrationName) {
publishRegistrationName(dispatchConfig.registrationName, PluginModule, eventName);
return true;
}
return false;
}
/**
* Publishes a registration name that is used to identify dispatched events and
* can be used with `EventPluginHub.putListener` to register listeners.
*
* @param {string} registrationName Registration name to add.
* @param {object} PluginModule Plugin publishing the event.
* @private
*/
function publishRegistrationName(registrationName, PluginModule, eventName) {
!!EventPluginRegistry.registrationNameModules[registrationName] ? "development" !== 'production' ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName) : invariant(false) : undefined;
EventPluginRegistry.registrationNameModules[registrationName] = PluginModule;
EventPluginRegistry.registrationNameDependencies[registrationName] = PluginModule.eventTypes[eventName].dependencies;
}
/**
* Registers plugins so that they can extract and dispatch events.
*
* @see {EventPluginHub}
*/
var EventPluginRegistry = {
/**
* Ordered list of injected plugins.
*/
plugins: [],
/**
* Mapping from event name to dispatch config
*/
eventNameDispatchConfigs: {},
/**
* Mapping from registration name to plugin module
*/
registrationNameModules: {},
/**
* Mapping from registration name to event name
*/
registrationNameDependencies: {},
/**
* Injects an ordering of plugins (by plugin name). This allows the ordering
* to be decoupled from injection of the actual plugins so that ordering is
* always deterministic regardless of packaging, on-the-fly injection, etc.
*
* @param {array} InjectedEventPluginOrder
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
injectEventPluginOrder: function (InjectedEventPluginOrder) {
!!EventPluginOrder ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than ' + 'once. You are likely trying to load more than one copy of React.') : invariant(false) : undefined;
// Clone the ordering so it cannot be dynamically mutated.
EventPluginOrder = Array.prototype.slice.call(InjectedEventPluginOrder);
recomputePluginOrdering();
},
/**
* Injects plugins to be used by `EventPluginHub`. The plugin names must be
* in the ordering injected by `injectEventPluginOrder`.
*
* Plugins can be injected as part of page initialization or on-the-fly.
*
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
injectEventPluginsByName: function (injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var PluginModule = injectedNamesToPlugins[pluginName];
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== PluginModule) {
!!namesToPlugins[pluginName] ? "development" !== 'production' ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins ' + 'using the same name, `%s`.', pluginName) : invariant(false) : undefined;
namesToPlugins[pluginName] = PluginModule;
isOrderingDirty = true;
}
}
if (isOrderingDirty) {
recomputePluginOrdering();
}
},
/**
* Looks up the plugin for the supplied event.
*
* @param {object} event A synthetic event.
* @return {?object} The plugin that created the supplied event.
* @internal
*/
getPluginModuleForEvent: function (event) {
var dispatchConfig = event.dispatchConfig;
if (dispatchConfig.registrationName) {
return EventPluginRegistry.registrationNameModules[dispatchConfig.registrationName] || null;
}
for (var phase in dispatchConfig.phasedRegistrationNames) {
if (!dispatchConfig.phasedRegistrationNames.hasOwnProperty(phase)) {
continue;
}
var PluginModule = EventPluginRegistry.registrationNameModules[dispatchConfig.phasedRegistrationNames[phase]];
if (PluginModule) {
return PluginModule;
}
}
return null;
},
/**
* Exposed for unit testing.
* @private
*/
_resetEventPlugins: function () {
EventPluginOrder = null;
for (var pluginName in namesToPlugins) {
if (namesToPlugins.hasOwnProperty(pluginName)) {
delete namesToPlugins[pluginName];
}
}
EventPluginRegistry.plugins.length = 0;
var eventNameDispatchConfigs = EventPluginRegistry.eventNameDispatchConfigs;
for (var eventName in eventNameDispatchConfigs) {
if (eventNameDispatchConfigs.hasOwnProperty(eventName)) {
delete eventNameDispatchConfigs[eventName];
}
}
var registrationNameModules = EventPluginRegistry.registrationNameModules;
for (var registrationName in registrationNameModules) {
if (registrationNameModules.hasOwnProperty(registrationName)) {
delete registrationNameModules[registrationName];
}
}
}
};
module.exports = EventPluginRegistry;
},{"160":160}],18:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPluginUtils
*/
'use strict';
var EventConstants = _dereq_(15);
var ReactErrorUtils = _dereq_(61);
var invariant = _dereq_(160);
var warning = _dereq_(172);
/**
* Injected dependencies:
*/
/**
* - `Mount`: [required] Module that can convert between React dom IDs and
* actual node references.
*/
var injection = {
Mount: null,
injectMount: function (InjectedMount) {
injection.Mount = InjectedMount;
if ("development" !== 'production') {
"development" !== 'production' ? warning(InjectedMount && InjectedMount.getNode && InjectedMount.getID, 'EventPluginUtils.injection.injectMount(...): Injected Mount ' + 'module is missing getNode or getID.') : undefined;
}
}
};
var topLevelTypes = EventConstants.topLevelTypes;
function isEndish(topLevelType) {
return topLevelType === topLevelTypes.topMouseUp || topLevelType === topLevelTypes.topTouchEnd || topLevelType === topLevelTypes.topTouchCancel;
}
function isMoveish(topLevelType) {
return topLevelType === topLevelTypes.topMouseMove || topLevelType === topLevelTypes.topTouchMove;
}
function isStartish(topLevelType) {
return topLevelType === topLevelTypes.topMouseDown || topLevelType === topLevelTypes.topTouchStart;
}
var validateEventDispatches;
if ("development" !== 'production') {
validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
var listenersIsArr = Array.isArray(dispatchListeners);
var idsIsArr = Array.isArray(dispatchIDs);
var IDsLen = idsIsArr ? dispatchIDs.length : dispatchIDs ? 1 : 0;
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
"development" !== 'production' ? warning(idsIsArr === listenersIsArr && IDsLen === listenersLen, 'EventPluginUtils: Invalid `event`.') : undefined;
};
}
/**
* Dispatch the event to the listener.
* @param {SyntheticEvent} event SyntheticEvent to handle
* @param {boolean} simulated If the event is simulated (changes exn behavior)
* @param {function} listener Application-level callback
* @param {string} domID DOM id to pass to the callback.
*/
function executeDispatch(event, simulated, listener, domID) {
var type = event.type || 'unknown-event';
event.currentTarget = injection.Mount.getNode(domID);
if (simulated) {
ReactErrorUtils.invokeGuardedCallbackWithCatch(type, listener, event, domID);
} else {
ReactErrorUtils.invokeGuardedCallback(type, listener, event, domID);
}
event.currentTarget = null;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event, simulated) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if ("development" !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
executeDispatch(event, simulated, dispatchListeners[i], dispatchIDs[i]);
}
} else if (dispatchListeners) {
executeDispatch(event, simulated, dispatchListeners, dispatchIDs);
}
event._dispatchListeners = null;
event._dispatchIDs = null;
}
/**
* Standard/simple iteration through an event's collected dispatches, but stops
* at the first dispatch execution returning true, and returns that id.
*
* @return {?string} id of the first dispatch execution who's listener returns
* true, or null if no listener returned true.
*/
function executeDispatchesInOrderStopAtTrueImpl(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchIDs = event._dispatchIDs;
if ("development" !== 'production') {
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and IDs are two parallel arrays that are always in sync.
if (dispatchListeners[i](event, dispatchIDs[i])) {
return dispatchIDs[i];
}
}
} else if (dispatchListeners) {
if (dispatchListeners(event, dispatchIDs)) {
return dispatchIDs;
}
}
return null;
}
/**
* @see executeDispatchesInOrderStopAtTrueImpl
*/
function executeDispatchesInOrderStopAtTrue(event) {
var ret = executeDispatchesInOrderStopAtTrueImpl(event);
event._dispatchIDs = null;
event._dispatchListeners = null;
return ret;
}
/**
* Execution of a "direct" dispatch - there must be at most one dispatch
* accumulated on the event or it is considered an error. It doesn't really make
* sense for an event with multiple dispatches (bubbled) to keep track of the
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
* @return {*} The return value of executing the single dispatch.
*/
function executeDirectDispatch(event) {
if ("development" !== 'production') {
validateEventDispatches(event);
}
var dispatchListener = event._dispatchListeners;
var dispatchID = event._dispatchIDs;
!!Array.isArray(dispatchListener) ? "development" !== 'production' ? invariant(false, 'executeDirectDispatch(...): Invalid `event`.') : invariant(false) : undefined;
var res = dispatchListener ? dispatchListener(event, dispatchID) : null;
event._dispatchListeners = null;
event._dispatchIDs = null;
return res;
}
/**
* @param {SyntheticEvent} event
* @return {boolean} True iff number of dispatches accumulated is greater than 0.
*/
function hasDispatches(event) {
return !!event._dispatchListeners;
}
/**
* General utilities that are useful in creating custom Event Plugins.
*/
var EventPluginUtils = {
isEndish: isEndish,
isMoveish: isMoveish,
isStartish: isStartish,
executeDirectDispatch: executeDirectDispatch,
executeDispatchesInOrder: executeDispatchesInOrder,
executeDispatchesInOrderStopAtTrue: executeDispatchesInOrderStopAtTrue,
hasDispatches: hasDispatches,
getNode: function (id) {
return injection.Mount.getNode(id);
},
getID: function (node) {
return injection.Mount.getID(node);
},
injection: injection
};
module.exports = EventPluginUtils;
},{"15":15,"160":160,"172":172,"61":61}],19:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule EventPropagators
*/
'use strict';
var EventConstants = _dereq_(15);
var EventPluginHub = _dereq_(16);
var warning = _dereq_(172);
var accumulateInto = _dereq_(115);
var forEachAccumulated = _dereq_(123);
var PropagationPhases = EventConstants.PropagationPhases;
var getListener = EventPluginHub.getListener;
/**
* Some event types have a notion of different registration names for different
* "phases" of propagation. This finds listeners by a given phase.
*/
function listenerAtPhase(id, event, propagationPhase) {
var registrationName = event.dispatchConfig.phasedRegistrationNames[propagationPhase];
return getListener(id, registrationName);
}
/**
* Tags a `SyntheticEvent` with dispatched listeners. Creating this function
* here, allows us to not have to bind or create functions for each event.
* Mutating the event's members allows us to not have to create a wrapping
* "dispatch" object that pairs the event with the listener.
*/
function accumulateDirectionalDispatches(domID, upwards, event) {
if ("development" !== 'production') {
"development" !== 'production' ? warning(domID, 'Dispatching id must not be null') : undefined;
}
var phase = upwards ? PropagationPhases.bubbled : PropagationPhases.captured;
var listener = listenerAtPhase(domID, event, phase);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, domID);
}
}
/**
* Collect dispatches (must be entirely collected before dispatching - see unit
* tests). Lazily allocate the array to conserve memory. We must loop through
* each event and perform the traversal for each one. We cannot perform a
* single traversal for the entire collection of events because each event may
* have a different target.
*/
function accumulateTwoPhaseDispatchesSingle(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
EventPluginHub.injection.getInstanceHandle().traverseTwoPhase(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
/**
* Same as `accumulateTwoPhaseDispatchesSingle`, but skips over the targetID.
*/
function accumulateTwoPhaseDispatchesSingleSkipTarget(event) {
if (event && event.dispatchConfig.phasedRegistrationNames) {
EventPluginHub.injection.getInstanceHandle().traverseTwoPhaseSkipTarget(event.dispatchMarker, accumulateDirectionalDispatches, event);
}
}
/**
* Accumulates without regard to direction, does not look for phased
* registration names. Same as `accumulateDirectDispatchesSingle` but without
* requiring that the `dispatchMarker` be the same as the dispatched ID.
*/
function accumulateDispatches(id, ignoredDirection, event) {
if (event && event.dispatchConfig.registrationName) {
var registrationName = event.dispatchConfig.registrationName;
var listener = getListener(id, registrationName);
if (listener) {
event._dispatchListeners = accumulateInto(event._dispatchListeners, listener);
event._dispatchIDs = accumulateInto(event._dispatchIDs, id);
}
}
}
/**
* Accumulates dispatches on an `SyntheticEvent`, but only for the
* `dispatchMarker`.
* @param {SyntheticEvent} event
*/
function accumulateDirectDispatchesSingle(event) {
if (event && event.dispatchConfig.registrationName) {
accumulateDispatches(event.dispatchMarker, null, event);
}
}
function accumulateTwoPhaseDispatches(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingle);
}
function accumulateTwoPhaseDispatchesSkipTarget(events) {
forEachAccumulated(events, accumulateTwoPhaseDispatchesSingleSkipTarget);
}
function accumulateEnterLeaveDispatches(leave, enter, fromID, toID) {
EventPluginHub.injection.getInstanceHandle().traverseEnterLeave(fromID, toID, accumulateDispatches, leave, enter);
}
function accumulateDirectDispatches(events) {
forEachAccumulated(events, accumulateDirectDispatchesSingle);
}
/**
* A small set of propagation patterns, each of which will accept a small amount
* of information, and generate a set of "dispatch ready event objects" - which
* are sets of events that have already been annotated with a set of dispatched
* listener functions/ids. The API is designed this way to discourage these
* propagation strategies from actually executing the dispatches, since we
* always want to collect the entire set of dispatches before executing event a
* single one.
*
* @constructor EventPropagators
*/
var EventPropagators = {
accumulateTwoPhaseDispatches: accumulateTwoPhaseDispatches,
accumulateTwoPhaseDispatchesSkipTarget: accumulateTwoPhaseDispatchesSkipTarget,
accumulateDirectDispatches: accumulateDirectDispatches,
accumulateEnterLeaveDispatches: accumulateEnterLeaveDispatches
};
module.exports = EventPropagators;
},{"115":115,"123":123,"15":15,"16":16,"172":172}],20:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule FallbackCompositionState
* @typechecks static-only
*/
'use strict';
var PooledClass = _dereq_(25);
var assign = _dereq_(24);
var getTextContentAccessor = _dereq_(130);
/**
* This helper class stores information about text content of a target node,
* allowing comparison of content before and after a given event.
*
* Identify the node where selection currently begins, then observe
* both its text content and its current position in the DOM. Since the
* browser may natively replace the target node during composition, we can
* use its position to find its replacement.
*
* @param {DOMEventTarget} root
*/
function FallbackCompositionState(root) {
this._root = root;
this._startText = this.getText();
this._fallbackText = null;
}
assign(FallbackCompositionState.prototype, {
destructor: function () {
this._root = null;
this._startText = null;
this._fallbackText = null;
},
/**
* Get current text of input.
*
* @return {string}
*/
getText: function () {
if ('value' in this._root) {
return this._root.value;
}
return this._root[getTextContentAccessor()];
},
/**
* Determine the differing substring between the initially stored
* text content and the current content.
*
* @return {string}
*/
getData: function () {
if (this._fallbackText) {
return this._fallbackText;
}
var start;
var startValue = this._startText;
var startLength = startValue.length;
var end;
var endValue = this.getText();
var endLength = endValue.length;
for (start = 0; start < startLength; start++) {
if (startValue[start] !== endValue[start]) {
break;
}
}
var minEnd = startLength - start;
for (end = 1; end <= minEnd; end++) {
if (startValue[startLength - end] !== endValue[endLength - end]) {
break;
}
}
var sliceTail = end > 1 ? 1 - end : undefined;
this._fallbackText = endValue.slice(start, sliceTail);
return this._fallbackText;
}
});
PooledClass.addPoolingTo(FallbackCompositionState);
module.exports = FallbackCompositionState;
},{"130":130,"24":24,"25":25}],21:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule HTMLDOMPropertyConfig
*/
'use strict';
var DOMProperty = _dereq_(10);
var ExecutionEnvironment = _dereq_(146);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var MUST_USE_PROPERTY = DOMProperty.injection.MUST_USE_PROPERTY;
var HAS_BOOLEAN_VALUE = DOMProperty.injection.HAS_BOOLEAN_VALUE;
var HAS_SIDE_EFFECTS = DOMProperty.injection.HAS_SIDE_EFFECTS;
var HAS_NUMERIC_VALUE = DOMProperty.injection.HAS_NUMERIC_VALUE;
var HAS_POSITIVE_NUMERIC_VALUE = DOMProperty.injection.HAS_POSITIVE_NUMERIC_VALUE;
var HAS_OVERLOADED_BOOLEAN_VALUE = DOMProperty.injection.HAS_OVERLOADED_BOOLEAN_VALUE;
var hasSVG;
if (ExecutionEnvironment.canUseDOM) {
var implementation = document.implementation;
hasSVG = implementation && implementation.hasFeature && implementation.hasFeature('http://www.w3.org/TR/SVG11/feature#BasicStructure', '1.1');
}
var HTMLDOMPropertyConfig = {
isCustomAttribute: RegExp.prototype.test.bind(/^(data|aria)-[a-z_][a-z\d_.\-]*$/),
Properties: {
/**
* Standard Properties
*/
accept: null,
acceptCharset: null,
accessKey: null,
action: null,
allowFullScreen: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
allowTransparency: MUST_USE_ATTRIBUTE,
alt: null,
async: HAS_BOOLEAN_VALUE,
autoComplete: null,
// autoFocus is polyfilled/normalized by AutoFocusUtils
// autoFocus: HAS_BOOLEAN_VALUE,
autoPlay: HAS_BOOLEAN_VALUE,
capture: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
cellPadding: null,
cellSpacing: null,
charSet: MUST_USE_ATTRIBUTE,
challenge: MUST_USE_ATTRIBUTE,
checked: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
classID: MUST_USE_ATTRIBUTE,
// To set className on SVG elements, it's necessary to use .setAttribute;
// this works on HTML elements too in all browsers except IE8. Conveniently,
// IE8 doesn't support SVG and so we can simply use the attribute in
// browsers that support SVG and the property in browsers that don't,
// regardless of whether the element is HTML or SVG.
className: hasSVG ? MUST_USE_ATTRIBUTE : MUST_USE_PROPERTY,
cols: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
colSpan: null,
content: null,
contentEditable: null,
contextMenu: MUST_USE_ATTRIBUTE,
controls: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
coords: null,
crossOrigin: null,
data: null, // For `<object />` acts as `src`.
dateTime: MUST_USE_ATTRIBUTE,
defer: HAS_BOOLEAN_VALUE,
dir: null,
disabled: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
download: HAS_OVERLOADED_BOOLEAN_VALUE,
draggable: null,
encType: null,
form: MUST_USE_ATTRIBUTE,
formAction: MUST_USE_ATTRIBUTE,
formEncType: MUST_USE_ATTRIBUTE,
formMethod: MUST_USE_ATTRIBUTE,
formNoValidate: HAS_BOOLEAN_VALUE,
formTarget: MUST_USE_ATTRIBUTE,
frameBorder: MUST_USE_ATTRIBUTE,
headers: null,
height: MUST_USE_ATTRIBUTE,
hidden: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
high: null,
href: null,
hrefLang: null,
htmlFor: null,
httpEquiv: null,
icon: null,
id: MUST_USE_PROPERTY,
inputMode: MUST_USE_ATTRIBUTE,
is: MUST_USE_ATTRIBUTE,
keyParams: MUST_USE_ATTRIBUTE,
keyType: MUST_USE_ATTRIBUTE,
label: null,
lang: null,
list: MUST_USE_ATTRIBUTE,
loop: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
low: null,
manifest: MUST_USE_ATTRIBUTE,
marginHeight: null,
marginWidth: null,
max: null,
maxLength: MUST_USE_ATTRIBUTE,
media: MUST_USE_ATTRIBUTE,
mediaGroup: null,
method: null,
min: null,
minLength: MUST_USE_ATTRIBUTE,
multiple: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
muted: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
name: null,
noValidate: HAS_BOOLEAN_VALUE,
open: HAS_BOOLEAN_VALUE,
optimum: null,
pattern: null,
placeholder: null,
poster: null,
preload: null,
radioGroup: null,
readOnly: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
rel: null,
required: HAS_BOOLEAN_VALUE,
role: MUST_USE_ATTRIBUTE,
rows: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
rowSpan: null,
sandbox: null,
scope: null,
scoped: HAS_BOOLEAN_VALUE,
scrolling: null,
seamless: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
selected: MUST_USE_PROPERTY | HAS_BOOLEAN_VALUE,
shape: null,
size: MUST_USE_ATTRIBUTE | HAS_POSITIVE_NUMERIC_VALUE,
sizes: MUST_USE_ATTRIBUTE,
span: HAS_POSITIVE_NUMERIC_VALUE,
spellCheck: null,
src: null,
srcDoc: MUST_USE_PROPERTY,
srcSet: MUST_USE_ATTRIBUTE,
start: HAS_NUMERIC_VALUE,
step: null,
style: null,
summary: null,
tabIndex: null,
target: null,
title: null,
type: null,
useMap: null,
value: MUST_USE_PROPERTY | HAS_SIDE_EFFECTS,
width: MUST_USE_ATTRIBUTE,
wmode: MUST_USE_ATTRIBUTE,
wrap: null,
/**
* RDFa Properties
*/
about: MUST_USE_ATTRIBUTE,
datatype: MUST_USE_ATTRIBUTE,
inlist: MUST_USE_ATTRIBUTE,
prefix: MUST_USE_ATTRIBUTE,
// property is also supported for OpenGraph in meta tags.
property: MUST_USE_ATTRIBUTE,
resource: MUST_USE_ATTRIBUTE,
'typeof': MUST_USE_ATTRIBUTE,
vocab: MUST_USE_ATTRIBUTE,
/**
* Non-standard Properties
*/
// autoCapitalize and autoCorrect are supported in Mobile Safari for
// keyboard hints.
autoCapitalize: null,
autoCorrect: null,
// autoSave allows WebKit/Blink to persist values of input fields on page reloads
autoSave: null,
// itemProp, itemScope, itemType are for
// Microdata support. See http://schema.org/docs/gs.html
itemProp: MUST_USE_ATTRIBUTE,
itemScope: MUST_USE_ATTRIBUTE | HAS_BOOLEAN_VALUE,
itemType: MUST_USE_ATTRIBUTE,
// itemID and itemRef are for Microdata support as well but
// only specified in the the WHATWG spec document. See
// https://html.spec.whatwg.org/multipage/microdata.html#microdata-dom-api
itemID: MUST_USE_ATTRIBUTE,
itemRef: MUST_USE_ATTRIBUTE,
// results show looking glass icon and recent searches on input
// search fields in WebKit/Blink
results: null,
// IE-only attribute that specifies security restrictions on an iframe
// as an alternative to the sandbox attribute on IE<10
security: MUST_USE_ATTRIBUTE,
// IE-only attribute that controls focus behavior
unselectable: MUST_USE_ATTRIBUTE
},
DOMAttributeNames: {
acceptCharset: 'accept-charset',
className: 'class',
htmlFor: 'for',
httpEquiv: 'http-equiv'
},
DOMPropertyNames: {
autoCapitalize: 'autocapitalize',
autoComplete: 'autocomplete',
autoCorrect: 'autocorrect',
autoFocus: 'autofocus',
autoPlay: 'autoplay',
autoSave: 'autosave',
// `encoding` is equivalent to `enctype`, IE8 lacks an `enctype` setter.
// http://www.w3.org/TR/html5/forms.html#dom-fs-encoding
encType: 'encoding',
hrefLang: 'hreflang',
radioGroup: 'radiogroup',
spellCheck: 'spellcheck',
srcDoc: 'srcdoc',
srcSet: 'srcset'
}
};
module.exports = HTMLDOMPropertyConfig;
},{"10":10,"146":146}],22:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule LinkedStateMixin
* @typechecks static-only
*/
'use strict';
var ReactLink = _dereq_(70);
var ReactStateSetters = _dereq_(90);
/**
* A simple mixin around ReactLink.forState().
*/
var LinkedStateMixin = {
/**
* Create a ReactLink that's linked to part of this component's state. The
* ReactLink will have the current value of this.state[key] and will call
* setState() when a change is requested.
*
* @param {string} key state key to update. Note: you may want to use keyOf()
* if you're using Google Closure Compiler advanced mode.
* @return {ReactLink} ReactLink instance linking to the state.
*/
linkState: function (key) {
return new ReactLink(this.state[key], ReactStateSetters.createStateKeySetter(this, key));
}
};
module.exports = LinkedStateMixin;
},{"70":70,"90":90}],23:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule LinkedValueUtils
* @typechecks static-only
*/
'use strict';
var ReactPropTypes = _dereq_(82);
var ReactPropTypeLocations = _dereq_(81);
var invariant = _dereq_(160);
var warning = _dereq_(172);
var hasReadOnlyValue = {
'button': true,
'checkbox': true,
'image': true,
'hidden': true,
'radio': true,
'reset': true,
'submit': true
};
function _assertSingleLink(inputProps) {
!(inputProps.checkedLink == null || inputProps.valueLink == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a valueLink. If you want to use ' + 'checkedLink, you probably don\'t want to use valueLink and vice versa.') : invariant(false) : undefined;
}
function _assertValueLink(inputProps) {
_assertSingleLink(inputProps);
!(inputProps.value == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a valueLink and a value or onChange event. If you want ' + 'to use value or onChange, you probably don\'t want to use valueLink.') : invariant(false) : undefined;
}
function _assertCheckedLink(inputProps) {
_assertSingleLink(inputProps);
!(inputProps.checked == null && inputProps.onChange == null) ? "development" !== 'production' ? invariant(false, 'Cannot provide a checkedLink and a checked property or onChange event. ' + 'If you want to use checked or onChange, you probably don\'t want to ' + 'use checkedLink') : invariant(false) : undefined;
}
var propTypes = {
value: function (props, propName, componentName) {
if (!props[propName] || hasReadOnlyValue[props.type] || props.onChange || props.readOnly || props.disabled) {
return null;
}
return new Error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
checked: function (props, propName, componentName) {
if (!props[propName] || props.onChange || props.readOnly || props.disabled) {
return null;
}
return new Error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.');
},
onChange: ReactPropTypes.func
};
var loggedTypeFailures = {};
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Provide a linked `value` attribute for controlled forms. You should not use
* this outside of the ReactDOM controlled form components.
*/
var LinkedValueUtils = {
checkPropTypes: function (tagName, props, owner) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error = propTypes[propName](props, propName, tagName, ReactPropTypeLocations.prop);
}
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum(owner);
"development" !== 'production' ? warning(false, 'Failed form propType: %s%s', error.message, addendum) : undefined;
}
}
},
/**
* @param {object} inputProps Props for form component
* @return {*} current value of the input either from value prop or link.
*/
getValue: function (inputProps) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.value;
}
return inputProps.value;
},
/**
* @param {object} inputProps Props for form component
* @return {*} current checked status of the input either from checked prop
* or link.
*/
getChecked: function (inputProps) {
if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.value;
}
return inputProps.checked;
},
/**
* @param {object} inputProps Props for form component
* @param {SyntheticEvent} event change event to handle
*/
executeOnChange: function (inputProps, event) {
if (inputProps.valueLink) {
_assertValueLink(inputProps);
return inputProps.valueLink.requestChange(event.target.value);
} else if (inputProps.checkedLink) {
_assertCheckedLink(inputProps);
return inputProps.checkedLink.requestChange(event.target.checked);
} else if (inputProps.onChange) {
return inputProps.onChange.call(undefined, event);
}
}
};
module.exports = LinkedValueUtils;
},{"160":160,"172":172,"81":81,"82":82}],24:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Object.assign
*/
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign
'use strict';
function assign(target, sources) {
if (target == null) {
throw new TypeError('Object.assign target cannot be null or undefined');
}
var to = Object(target);
var hasOwnProperty = Object.prototype.hasOwnProperty;
for (var nextIndex = 1; nextIndex < arguments.length; nextIndex++) {
var nextSource = arguments[nextIndex];
if (nextSource == null) {
continue;
}
var from = Object(nextSource);
// We don't currently support accessors nor proxies. Therefore this
// copy cannot throw. If we ever supported this then we must handle
// exceptions and side-effects. We don't support symbols so they won't
// be transferred.
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
}
return to;
}
module.exports = assign;
},{}],25:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule PooledClass
*/
'use strict';
var invariant = _dereq_(160);
/**
* Static poolers. Several custom versions for each potential number of
* arguments. A completely generic pooler is easy to implement, but would
* require accessing the `arguments` object. In each of these, `this` refers to
* the Class itself, not an instance. If any others are needed, simply add them
* here, or in their own files.
*/
var oneArgumentPooler = function (copyFieldsFrom) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, copyFieldsFrom);
return instance;
} else {
return new Klass(copyFieldsFrom);
}
};
var twoArgumentPooler = function (a1, a2) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2);
return instance;
} else {
return new Klass(a1, a2);
}
};
var threeArgumentPooler = function (a1, a2, a3) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3);
return instance;
} else {
return new Klass(a1, a2, a3);
}
};
var fourArgumentPooler = function (a1, a2, a3, a4) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4);
return instance;
} else {
return new Klass(a1, a2, a3, a4);
}
};
var fiveArgumentPooler = function (a1, a2, a3, a4, a5) {
var Klass = this;
if (Klass.instancePool.length) {
var instance = Klass.instancePool.pop();
Klass.call(instance, a1, a2, a3, a4, a5);
return instance;
} else {
return new Klass(a1, a2, a3, a4, a5);
}
};
var standardReleaser = function (instance) {
var Klass = this;
!(instance instanceof Klass) ? "development" !== 'production' ? invariant(false, 'Trying to release an instance into a pool of a different type.') : invariant(false) : undefined;
instance.destructor();
if (Klass.instancePool.length < Klass.poolSize) {
Klass.instancePool.push(instance);
}
};
var DEFAULT_POOL_SIZE = 10;
var DEFAULT_POOLER = oneArgumentPooler;
/**
* Augments `CopyConstructor` to be a poolable class, augmenting only the class
* itself (statically) not adding any prototypical fields. Any CopyConstructor
* you give this may have a `poolSize` property, and will look for a
* prototypical `destructor` on instances (optional).
*
* @param {Function} CopyConstructor Constructor that can be used to reset.
* @param {Function} pooler Customizable pooler.
*/
var addPoolingTo = function (CopyConstructor, pooler) {
var NewKlass = CopyConstructor;
NewKlass.instancePool = [];
NewKlass.getPooled = pooler || DEFAULT_POOLER;
if (!NewKlass.poolSize) {
NewKlass.poolSize = DEFAULT_POOL_SIZE;
}
NewKlass.release = standardReleaser;
return NewKlass;
};
var PooledClass = {
addPoolingTo: addPoolingTo,
oneArgumentPooler: oneArgumentPooler,
twoArgumentPooler: twoArgumentPooler,
threeArgumentPooler: threeArgumentPooler,
fourArgumentPooler: fourArgumentPooler,
fiveArgumentPooler: fiveArgumentPooler
};
module.exports = PooledClass;
},{"160":160}],26:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule React
*/
'use strict';
var ReactDOM = _dereq_(40);
var ReactDOMServer = _dereq_(50);
var ReactIsomorphic = _dereq_(69);
var assign = _dereq_(24);
var deprecated = _dereq_(119);
// `version` will be added here by ReactIsomorphic.
var React = {};
assign(React, ReactIsomorphic);
assign(React, {
// ReactDOM
findDOMNode: deprecated('findDOMNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.findDOMNode),
render: deprecated('render', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.render),
unmountComponentAtNode: deprecated('unmountComponentAtNode', 'ReactDOM', 'react-dom', ReactDOM, ReactDOM.unmountComponentAtNode),
// ReactDOMServer
renderToString: deprecated('renderToString', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToString),
renderToStaticMarkup: deprecated('renderToStaticMarkup', 'ReactDOMServer', 'react-dom/server', ReactDOMServer, ReactDOMServer.renderToStaticMarkup)
});
React.__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOM;
module.exports = React;
},{"119":119,"24":24,"40":40,"50":50,"69":69}],27:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactBrowserComponentMixin
*/
'use strict';
var ReactInstanceMap = _dereq_(68);
var findDOMNode = _dereq_(121);
var warning = _dereq_(172);
var didWarnKey = '_getDOMNodeDidWarn';
var ReactBrowserComponentMixin = {
/**
* Returns the DOM node rendered by this component.
*
* @return {DOMElement} The root node of this component.
* @final
* @protected
*/
getDOMNode: function () {
"development" !== 'production' ? warning(this.constructor[didWarnKey], '%s.getDOMNode(...) is deprecated. Please use ' + 'ReactDOM.findDOMNode(instance) instead.', ReactInstanceMap.get(this).getName() || this.tagName || 'Unknown') : undefined;
this.constructor[didWarnKey] = true;
return findDOMNode(this);
}
};
module.exports = ReactBrowserComponentMixin;
},{"121":121,"172":172,"68":68}],28:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactBrowserEventEmitter
* @typechecks static-only
*/
'use strict';
var EventConstants = _dereq_(15);
var EventPluginHub = _dereq_(16);
var EventPluginRegistry = _dereq_(17);
var ReactEventEmitterMixin = _dereq_(62);
var ReactPerf = _dereq_(78);
var ViewportMetrics = _dereq_(114);
var assign = _dereq_(24);
var isEventSupported = _dereq_(132);
/**
* Summary of `ReactBrowserEventEmitter` event handling:
*
* - Top-level delegation is used to trap most native browser events. This
* may only occur in the main thread and is the responsibility of
* ReactEventListener, which is injected and can therefore support pluggable
* event sources. This is the only work that occurs in the main thread.
*
* - We normalize and de-duplicate events to account for browser quirks. This
* may be done in the worker thread.
*
* - Forward these native events (with the associated top-level type used to
* trap it) to `EventPluginHub`, which in turn will ask plugins if they want
* to extract any synthetic events.
*
* - The `EventPluginHub` will then process each event by annotating them with
* "dispatches", a sequence of listeners and IDs that care about that event.
*
* - The `EventPluginHub` then dispatches the events.
*
* Overview of React and the event system:
*
* +------------+ .
* | DOM | .
* +------------+ .
* | .
* v .
* +------------+ .
* | ReactEvent | .
* | Listener | .
* +------------+ . +-----------+
* | . +--------+|SimpleEvent|
* | . | |Plugin |
* +-----|------+ . v +-----------+
* | | | . +--------------+ +------------+
* | +-----------.--->|EventPluginHub| | Event |
* | | . | | +-----------+ | Propagators|
* | ReactEvent | . | | |TapEvent | |------------|
* | Emitter | . | |<---+|Plugin | |other plugin|
* | | . | | +-----------+ | utilities |
* | +-----------.--->| | +------------+
* | | | . +--------------+
* +-----|------+ . ^ +-----------+
* | . | |Enter/Leave|
* + . +-------+|Plugin |
* +-------------+ . +-----------+
* | application | .
* |-------------| .
* | | .
* | | .
* +-------------+ .
* .
* React Core . General Purpose Event Plugin System
*/
var alreadyListeningTo = {};
var isMonitoringScrollValue = false;
var reactTopListenersCounter = 0;
// For events like 'submit' which don't consistently bubble (which we trap at a
// lower node than `document`), binding at `document` would cause duplicate
// events so we don't include them here
var topEventMapping = {
topAbort: 'abort',
topBlur: 'blur',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
topChange: 'change',
topClick: 'click',
topCompositionEnd: 'compositionend',
topCompositionStart: 'compositionstart',
topCompositionUpdate: 'compositionupdate',
topContextMenu: 'contextmenu',
topCopy: 'copy',
topCut: 'cut',
topDoubleClick: 'dblclick',
topDrag: 'drag',
topDragEnd: 'dragend',
topDragEnter: 'dragenter',
topDragExit: 'dragexit',
topDragLeave: 'dragleave',
topDragOver: 'dragover',
topDragStart: 'dragstart',
topDrop: 'drop',
topDurationChange: 'durationchange',
topEmptied: 'emptied',
topEncrypted: 'encrypted',
topEnded: 'ended',
topError: 'error',
topFocus: 'focus',
topInput: 'input',
topKeyDown: 'keydown',
topKeyPress: 'keypress',
topKeyUp: 'keyup',
topLoadedData: 'loadeddata',
topLoadedMetadata: 'loadedmetadata',
topLoadStart: 'loadstart',
topMouseDown: 'mousedown',
topMouseMove: 'mousemove',
topMouseOut: 'mouseout',
topMouseOver: 'mouseover',
topMouseUp: 'mouseup',
topPaste: 'paste',
topPause: 'pause',
topPlay: 'play',
topPlaying: 'playing',
topProgress: 'progress',
topRateChange: 'ratechange',
topScroll: 'scroll',
topSeeked: 'seeked',
topSeeking: 'seeking',
topSelectionChange: 'selectionchange',
topStalled: 'stalled',
topSuspend: 'suspend',
topTextInput: 'textInput',
topTimeUpdate: 'timeupdate',
topTouchCancel: 'touchcancel',
topTouchEnd: 'touchend',
topTouchMove: 'touchmove',
topTouchStart: 'touchstart',
topVolumeChange: 'volumechange',
topWaiting: 'waiting',
topWheel: 'wheel'
};
/**
* To ensure no conflicts with other potential React instances on the page
*/
var topListenersIDKey = '_reactListenersID' + String(Math.random()).slice(2);
function getListeningForDocument(mountAt) {
// In IE8, `mountAt` is a host object and doesn't have `hasOwnProperty`
// directly.
if (!Object.prototype.hasOwnProperty.call(mountAt, topListenersIDKey)) {
mountAt[topListenersIDKey] = reactTopListenersCounter++;
alreadyListeningTo[mountAt[topListenersIDKey]] = {};
}
return alreadyListeningTo[mountAt[topListenersIDKey]];
}
/**
* `ReactBrowserEventEmitter` is used to attach top-level event listeners. For
* example:
*
* ReactBrowserEventEmitter.putListener('myID', 'onClick', myFunction);
*
* This would allocate a "registration" of `('onClick', myFunction)` on 'myID'.
*
* @internal
*/
var ReactBrowserEventEmitter = assign({}, ReactEventEmitterMixin, {
/**
* Injectable event backend
*/
ReactEventListener: null,
injection: {
/**
* @param {object} ReactEventListener
*/
injectReactEventListener: function (ReactEventListener) {
ReactEventListener.setHandleTopLevel(ReactBrowserEventEmitter.handleTopLevel);
ReactBrowserEventEmitter.ReactEventListener = ReactEventListener;
}
},
/**
* Sets whether or not any created callbacks should be enabled.
*
* @param {boolean} enabled True if callbacks should be enabled.
*/
setEnabled: function (enabled) {
if (ReactBrowserEventEmitter.ReactEventListener) {
ReactBrowserEventEmitter.ReactEventListener.setEnabled(enabled);
}
},
/**
* @return {boolean} True if callbacks are enabled.
*/
isEnabled: function () {
return !!(ReactBrowserEventEmitter.ReactEventListener && ReactBrowserEventEmitter.ReactEventListener.isEnabled());
},
/**
* We listen for bubbled touch events on the document object.
*
* Firefox v8.01 (and possibly others) exhibited strange behavior when
* mounting `onmousemove` events at some node that was not the document
* element. The symptoms were that if your mouse is not moving over something
* contained within that mount point (for example on the background) the
* top-level listeners for `onmousemove` won't be called. However, if you
* register the `mousemove` on the document object, then it will of course
* catch all `mousemove`s. This along with iOS quirks, justifies restricting
* top-level listeners to the document object only, at least for these
* movement types of events and possibly all events.
*
* @see http://www.quirksmode.org/blog/archives/2010/09/click_event_del.html
*
* Also, `keyup`/`keypress`/`keydown` do not bubble to the window on IE, but
* they bubble to document.
*
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @param {object} contentDocumentHandle Document which owns the container
*/
listenTo: function (registrationName, contentDocumentHandle) {
var mountAt = contentDocumentHandle;
var isListening = getListeningForDocument(mountAt);
var dependencies = EventPluginRegistry.registrationNameDependencies[registrationName];
var topLevelTypes = EventConstants.topLevelTypes;
for (var i = 0; i < dependencies.length; i++) {
var dependency = dependencies[i];
if (!(isListening.hasOwnProperty(dependency) && isListening[dependency])) {
if (dependency === topLevelTypes.topWheel) {
if (isEventSupported('wheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'wheel', mountAt);
} else if (isEventSupported('mousewheel')) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'mousewheel', mountAt);
} else {
// Firefox needs to capture a different mouse scroll event.
// @see http://www.quirksmode.org/dom/events/tests/scroll.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topWheel, 'DOMMouseScroll', mountAt);
}
} else if (dependency === topLevelTypes.topScroll) {
if (isEventSupported('scroll', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topScroll, 'scroll', mountAt);
} else {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topScroll, 'scroll', ReactBrowserEventEmitter.ReactEventListener.WINDOW_HANDLE);
}
} else if (dependency === topLevelTypes.topFocus || dependency === topLevelTypes.topBlur) {
if (isEventSupported('focus', true)) {
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topFocus, 'focus', mountAt);
ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelTypes.topBlur, 'blur', mountAt);
} else if (isEventSupported('focusin')) {
// IE has `focusin` and `focusout` events which bubble.
// @see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topFocus, 'focusin', mountAt);
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelTypes.topBlur, 'focusout', mountAt);
}
// to make sure blur and focus event listeners are only attached once
isListening[topLevelTypes.topBlur] = true;
isListening[topLevelTypes.topFocus] = true;
} else if (topEventMapping.hasOwnProperty(dependency)) {
ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(dependency, topEventMapping[dependency], mountAt);
}
isListening[dependency] = true;
}
}
},
trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapBubbledEvent(topLevelType, handlerBaseName, handle);
},
trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
return ReactBrowserEventEmitter.ReactEventListener.trapCapturedEvent(topLevelType, handlerBaseName, handle);
},
/**
* Listens to window scroll and resize events. We cache scroll values so that
* application code can access them without triggering reflows.
*
* NOTE: Scroll events do not bubble.
*
* @see http://www.quirksmode.org/dom/events/scroll.html
*/
ensureScrollValueMonitoring: function () {
if (!isMonitoringScrollValue) {
var refresh = ViewportMetrics.refreshScrollValues;
ReactBrowserEventEmitter.ReactEventListener.monitorScrollValue(refresh);
isMonitoringScrollValue = true;
}
},
eventNameDispatchConfigs: EventPluginHub.eventNameDispatchConfigs,
registrationNameModules: EventPluginHub.registrationNameModules,
putListener: EventPluginHub.putListener,
getListener: EventPluginHub.getListener,
deleteListener: EventPluginHub.deleteListener,
deleteAllListeners: EventPluginHub.deleteAllListeners
});
ReactPerf.measureMethods(ReactBrowserEventEmitter, 'ReactBrowserEventEmitter', {
putListener: 'putListener',
deleteListener: 'deleteListener'
});
module.exports = ReactBrowserEventEmitter;
},{"114":114,"132":132,"15":15,"16":16,"17":17,"24":24,"62":62,"78":78}],29:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks
* @providesModule ReactCSSTransitionGroup
*/
'use strict';
var React = _dereq_(26);
var assign = _dereq_(24);
var ReactTransitionGroup = _dereq_(94);
var ReactCSSTransitionGroupChild = _dereq_(30);
function createTransitionTimeoutPropValidator(transitionType) {
var timeoutPropName = 'transition' + transitionType + 'Timeout';
var enabledPropName = 'transition' + transitionType;
return function (props) {
// If the transition is enabled
if (props[enabledPropName]) {
// If no timeout duration is provided
if (!props[timeoutPropName]) {
return new Error(timeoutPropName + ' wasn\'t supplied to ReactCSSTransitionGroup: ' + 'this can cause unreliable animations and won\'t be supported in ' + 'a future version of React. See ' + 'https://fb.me/react-animation-transition-group-timeout for more ' + 'information.');
// If the duration isn't a number
} else if (typeof props[timeoutPropName] !== 'number') {
return new Error(timeoutPropName + ' must be a number (in milliseconds)');
}
}
};
}
var ReactCSSTransitionGroup = React.createClass({
displayName: 'ReactCSSTransitionGroup',
propTypes: {
transitionName: ReactCSSTransitionGroupChild.propTypes.name,
transitionAppear: React.PropTypes.bool,
transitionEnter: React.PropTypes.bool,
transitionLeave: React.PropTypes.bool,
transitionAppearTimeout: createTransitionTimeoutPropValidator('Appear'),
transitionEnterTimeout: createTransitionTimeoutPropValidator('Enter'),
transitionLeaveTimeout: createTransitionTimeoutPropValidator('Leave')
},
getDefaultProps: function () {
return {
transitionAppear: false,
transitionEnter: true,
transitionLeave: true
};
},
_wrapChild: function (child) {
// We need to provide this childFactory so that
// ReactCSSTransitionGroupChild can receive updates to name, enter, and
// leave while it is leaving.
return React.createElement(ReactCSSTransitionGroupChild, {
name: this.props.transitionName,
appear: this.props.transitionAppear,
enter: this.props.transitionEnter,
leave: this.props.transitionLeave,
appearTimeout: this.props.transitionAppearTimeout,
enterTimeout: this.props.transitionEnterTimeout,
leaveTimeout: this.props.transitionLeaveTimeout
}, child);
},
render: function () {
return React.createElement(ReactTransitionGroup, assign({}, this.props, { childFactory: this._wrapChild }));
}
});
module.exports = ReactCSSTransitionGroup;
},{"24":24,"26":26,"30":30,"94":94}],30:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks
* @providesModule ReactCSSTransitionGroupChild
*/
'use strict';
var React = _dereq_(26);
var ReactDOM = _dereq_(40);
var CSSCore = _dereq_(144);
var ReactTransitionEvents = _dereq_(93);
var onlyChild = _dereq_(134);
// We don't remove the element from the DOM until we receive an animationend or
// transitionend event. If the user screws up and forgets to add an animation
// their node will be stuck in the DOM forever, so we detect if an animation
// does not start and if it doesn't, we just call the end listener immediately.
var TICK = 17;
var ReactCSSTransitionGroupChild = React.createClass({
displayName: 'ReactCSSTransitionGroupChild',
propTypes: {
name: React.PropTypes.oneOfType([React.PropTypes.string, React.PropTypes.shape({
enter: React.PropTypes.string,
leave: React.PropTypes.string,
active: React.PropTypes.string
}), React.PropTypes.shape({
enter: React.PropTypes.string,
enterActive: React.PropTypes.string,
leave: React.PropTypes.string,
leaveActive: React.PropTypes.string,
appear: React.PropTypes.string,
appearActive: React.PropTypes.string
})]).isRequired,
// Once we require timeouts to be specified, we can remove the
// boolean flags (appear etc.) and just accept a number
// or a bool for the timeout flags (appearTimeout etc.)
appear: React.PropTypes.bool,
enter: React.PropTypes.bool,
leave: React.PropTypes.bool,
appearTimeout: React.PropTypes.number,
enterTimeout: React.PropTypes.number,
leaveTimeout: React.PropTypes.number
},
transition: function (animationType, finishCallback, userSpecifiedDelay) {
var node = ReactDOM.findDOMNode(this);
if (!node) {
if (finishCallback) {
finishCallback();
}
return;
}
var className = this.props.name[animationType] || this.props.name + '-' + animationType;
var activeClassName = this.props.name[animationType + 'Active'] || className + '-active';
var timeout = null;
var endListener = function (e) {
if (e && e.target !== node) {
return;
}
clearTimeout(timeout);
CSSCore.removeClass(node, className);
CSSCore.removeClass(node, activeClassName);
ReactTransitionEvents.removeEndEventListener(node, endListener);
// Usually this optional callback is used for informing an owner of
// a leave animation and telling it to remove the child.
if (finishCallback) {
finishCallback();
}
};
CSSCore.addClass(node, className);
// Need to do this to actually trigger a transition.
this.queueClass(activeClassName);
// If the user specified a timeout delay.
if (userSpecifiedDelay) {
// Clean-up the animation after the specified delay
timeout = setTimeout(endListener, userSpecifiedDelay);
} else {
// DEPRECATED: this listener will be removed in a future version of react
ReactTransitionEvents.addEndEventListener(node, endListener);
}
},
queueClass: function (className) {
this.classNameQueue.push(className);
if (!this.timeout) {
this.timeout = setTimeout(this.flushClassNameQueue, TICK);
}
},
flushClassNameQueue: function () {
if (this.isMounted()) {
this.classNameQueue.forEach(CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this)));
}
this.classNameQueue.length = 0;
this.timeout = null;
},
componentWillMount: function () {
this.classNameQueue = [];
},
componentWillUnmount: function () {
if (this.timeout) {
clearTimeout(this.timeout);
}
},
componentWillAppear: function (done) {
if (this.props.appear) {
this.transition('appear', done, this.props.appearTimeout);
} else {
done();
}
},
componentWillEnter: function (done) {
if (this.props.enter) {
this.transition('enter', done, this.props.enterTimeout);
} else {
done();
}
},
componentWillLeave: function (done) {
if (this.props.leave) {
this.transition('leave', done, this.props.leaveTimeout);
} else {
done();
}
},
render: function () {
return onlyChild(this.props.children);
}
});
module.exports = ReactCSSTransitionGroupChild;
},{"134":134,"144":144,"26":26,"40":40,"93":93}],31:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactChildReconciler
* @typechecks static-only
*/
'use strict';
var ReactReconciler = _dereq_(84);
var instantiateReactComponent = _dereq_(131);
var shouldUpdateReactComponent = _dereq_(140);
var traverseAllChildren = _dereq_(141);
var warning = _dereq_(172);
function instantiateChild(childInstances, child, name) {
// We found a component instance.
var keyUnique = childInstances[name] === undefined;
if ("development" !== 'production') {
"development" !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
}
if (child != null && keyUnique) {
childInstances[name] = instantiateReactComponent(child, null);
}
}
/**
* ReactChildReconciler provides helpers for initializing or updating a set of
* children. Its output is suitable for passing it onto ReactMultiChild which
* does diffed reordering and insertion.
*/
var ReactChildReconciler = {
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildNodes Nested child maps.
* @return {?object} A set of child instances.
* @internal
*/
instantiateChildren: function (nestedChildNodes, transaction, context) {
if (nestedChildNodes == null) {
return null;
}
var childInstances = {};
traverseAllChildren(nestedChildNodes, instantiateChild, childInstances);
return childInstances;
},
/**
* Updates the rendered children and returns a new set of children.
*
* @param {?object} prevChildren Previously initialized set of children.
* @param {?object} nextChildren Flat child element maps.
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @return {?object} A new set of child instances.
* @internal
*/
updateChildren: function (prevChildren, nextChildren, transaction, context) {
// We currently don't have a way to track moves here but if we use iterators
// instead of for..in we can zip the iterators and check if an item has
// moved.
// TODO: If nothing has changed, return the prevChildren object so that we
// can quickly bailout if nothing has changed.
if (!nextChildren && !prevChildren) {
return null;
}
var name;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var prevElement = prevChild && prevChild._currentElement;
var nextElement = nextChildren[name];
if (prevChild != null && shouldUpdateReactComponent(prevElement, nextElement)) {
ReactReconciler.receiveComponent(prevChild, nextElement, transaction, context);
nextChildren[name] = prevChild;
} else {
if (prevChild) {
ReactReconciler.unmountComponent(prevChild, name);
}
// The child must be instantiated before it's mounted.
var nextChildInstance = instantiateReactComponent(nextElement, null);
nextChildren[name] = nextChildInstance;
}
}
// Unmount children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
ReactReconciler.unmountComponent(prevChildren[name]);
}
}
return nextChildren;
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @param {?object} renderedChildren Previously initialized set of children.
* @internal
*/
unmountChildren: function (renderedChildren) {
for (var name in renderedChildren) {
if (renderedChildren.hasOwnProperty(name)) {
var renderedChild = renderedChildren[name];
ReactReconciler.unmountComponent(renderedChild);
}
}
}
};
module.exports = ReactChildReconciler;
},{"131":131,"140":140,"141":141,"172":172,"84":84}],32:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactChildren
*/
'use strict';
var PooledClass = _dereq_(25);
var ReactElement = _dereq_(57);
var emptyFunction = _dereq_(152);
var traverseAllChildren = _dereq_(141);
var twoArgumentPooler = PooledClass.twoArgumentPooler;
var fourArgumentPooler = PooledClass.fourArgumentPooler;
var userProvidedKeyEscapeRegex = /\/(?!\/)/g;
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, '//');
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* traversal. Allows avoiding binding callbacks.
*
* @constructor ForEachBookKeeping
* @param {!function} forEachFunction Function to perform traversal with.
* @param {?*} forEachContext Context to perform context with.
*/
function ForEachBookKeeping(forEachFunction, forEachContext) {
this.func = forEachFunction;
this.context = forEachContext;
this.count = 0;
}
ForEachBookKeeping.prototype.destructor = function () {
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(ForEachBookKeeping, twoArgumentPooler);
function forEachSingleChild(bookKeeping, child, name) {
var func = bookKeeping.func;
var context = bookKeeping.context;
func.call(context, child, bookKeeping.count++);
}
/**
* Iterates through children that are typically specified as `props.children`.
*
* The provided forEachFunc(child, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} forEachFunc
* @param {*} forEachContext Context for forEachContext.
*/
function forEachChildren(children, forEachFunc, forEachContext) {
if (children == null) {
return children;
}
var traverseContext = ForEachBookKeeping.getPooled(forEachFunc, forEachContext);
traverseAllChildren(children, forEachSingleChild, traverseContext);
ForEachBookKeeping.release(traverseContext);
}
/**
* PooledClass representing the bookkeeping associated with performing a child
* mapping. Allows avoiding binding callbacks.
*
* @constructor MapBookKeeping
* @param {!*} mapResult Object containing the ordered map of results.
* @param {!function} mapFunction Function to perform mapping with.
* @param {?*} mapContext Context to perform mapping with.
*/
function MapBookKeeping(mapResult, keyPrefix, mapFunction, mapContext) {
this.result = mapResult;
this.keyPrefix = keyPrefix;
this.func = mapFunction;
this.context = mapContext;
this.count = 0;
}
MapBookKeeping.prototype.destructor = function () {
this.result = null;
this.keyPrefix = null;
this.func = null;
this.context = null;
this.count = 0;
};
PooledClass.addPoolingTo(MapBookKeeping, fourArgumentPooler);
function mapSingleChildIntoContext(bookKeeping, child, childKey) {
var result = bookKeeping.result;
var keyPrefix = bookKeeping.keyPrefix;
var func = bookKeeping.func;
var context = bookKeeping.context;
var mappedChild = func.call(context, child, bookKeeping.count++);
if (Array.isArray(mappedChild)) {
mapIntoWithKeyPrefixInternal(mappedChild, result, childKey, emptyFunction.thatReturnsArgument);
} else if (mappedChild != null) {
if (ReactElement.isValidElement(mappedChild)) {
mappedChild = ReactElement.cloneAndReplaceKey(mappedChild,
// Keep both the (mapped) and old keys if they differ, just as
// traverseAllChildren used to do for objects as children
keyPrefix + (mappedChild !== child ? escapeUserProvidedKey(mappedChild.key || '') + '/' : '') + childKey);
}
result.push(mappedChild);
}
}
function mapIntoWithKeyPrefixInternal(children, array, prefix, func, context) {
var escapedPrefix = '';
if (prefix != null) {
escapedPrefix = escapeUserProvidedKey(prefix) + '/';
}
var traverseContext = MapBookKeeping.getPooled(array, escapedPrefix, func, context);
traverseAllChildren(children, mapSingleChildIntoContext, traverseContext);
MapBookKeeping.release(traverseContext);
}
/**
* Maps children that are typically specified as `props.children`.
*
* The provided mapFunction(child, key, index) will be called for each
* leaf child.
*
* @param {?*} children Children tree container.
* @param {function(*, int)} func The map function.
* @param {*} context Context for mapFunction.
* @return {object} Object containing the ordered map of results.
*/
function mapChildren(children, func, context) {
if (children == null) {
return children;
}
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, func, context);
return result;
}
function forEachSingleChildDummy(traverseContext, child, name) {
return null;
}
/**
* Count the number of children that are typically specified as
* `props.children`.
*
* @param {?*} children Children tree container.
* @return {number} The number of children.
*/
function countChildren(children, context) {
return traverseAllChildren(children, forEachSingleChildDummy, null);
}
/**
* Flatten a children object (typically specified as `props.children`) and
* return an array with appropriately re-keyed children.
*/
function toArray(children) {
var result = [];
mapIntoWithKeyPrefixInternal(children, result, null, emptyFunction.thatReturnsArgument);
return result;
}
var ReactChildren = {
forEach: forEachChildren,
map: mapChildren,
mapIntoWithKeyPrefixInternal: mapIntoWithKeyPrefixInternal,
count: countChildren,
toArray: toArray
};
module.exports = ReactChildren;
},{"141":141,"152":152,"25":25,"57":57}],33:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactClass
*/
'use strict';
var ReactComponent = _dereq_(34);
var ReactElement = _dereq_(57);
var ReactPropTypeLocations = _dereq_(81);
var ReactPropTypeLocationNames = _dereq_(80);
var ReactNoopUpdateQueue = _dereq_(76);
var assign = _dereq_(24);
var emptyObject = _dereq_(153);
var invariant = _dereq_(160);
var keyMirror = _dereq_(164);
var keyOf = _dereq_(165);
var warning = _dereq_(172);
var MIXINS_KEY = keyOf({ mixins: null });
/**
* Policies that describe methods in `ReactClassInterface`.
*/
var SpecPolicy = keyMirror({
/**
* These methods may be defined only once by the class specification or mixin.
*/
DEFINE_ONCE: null,
/**
* These methods may be defined by both the class specification and mixins.
* Subsequent definitions will be chained. These methods must return void.
*/
DEFINE_MANY: null,
/**
* These methods are overriding the base class.
*/
OVERRIDE_BASE: null,
/**
* These methods are similar to DEFINE_MANY, except we assume they return
* objects. We try to merge the keys of the return values of all the mixed in
* functions. If there is a key conflict we throw.
*/
DEFINE_MANY_MERGED: null
});
var injectedMixins = [];
var warnedSetProps = false;
function warnSetProps() {
if (!warnedSetProps) {
warnedSetProps = true;
"development" !== 'production' ? warning(false, 'setProps(...) and replaceProps(...) are deprecated. ' + 'Instead, call render again at the top level.') : undefined;
}
}
/**
* Composite components are higher-level components that compose other composite
* or native components.
*
* To create a new type of `ReactClass`, pass a specification of
* your new class to `React.createClass`. The only requirement of your class
* specification is that you implement a `render` method.
*
* var MyComponent = React.createClass({
* render: function() {
* return <div>Hello World</div>;
* }
* });
*
* The class specification supports a specific protocol of methods that have
* special meaning (e.g. `render`). See `ReactClassInterface` for
* more the comprehensive protocol. Any other properties and methods in the
* class specification will be available on the prototype.
*
* @interface ReactClassInterface
* @internal
*/
var ReactClassInterface = {
/**
* An array of Mixin objects to include when defining your component.
*
* @type {array}
* @optional
*/
mixins: SpecPolicy.DEFINE_MANY,
/**
* An object containing properties and methods that should be defined on
* the component's constructor instead of its prototype (static methods).
*
* @type {object}
* @optional
*/
statics: SpecPolicy.DEFINE_MANY,
/**
* Definition of prop types for this component.
*
* @type {object}
* @optional
*/
propTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types for this component.
*
* @type {object}
* @optional
*/
contextTypes: SpecPolicy.DEFINE_MANY,
/**
* Definition of context types this component sets for its children.
*
* @type {object}
* @optional
*/
childContextTypes: SpecPolicy.DEFINE_MANY,
// ==== Definition methods ====
/**
* Invoked when the component is mounted. Values in the mapping will be set on
* `this.props` if that prop is not specified (i.e. using an `in` check).
*
* This method is invoked before `getInitialState` and therefore cannot rely
* on `this.state` or use `this.setState`.
*
* @return {object}
* @optional
*/
getDefaultProps: SpecPolicy.DEFINE_MANY_MERGED,
/**
* Invoked once before the component is mounted. The return value will be used
* as the initial value of `this.state`.
*
* getInitialState: function() {
* return {
* isOn: false,
* fooBaz: new BazFoo()
* }
* }
*
* @return {object}
* @optional
*/
getInitialState: SpecPolicy.DEFINE_MANY_MERGED,
/**
* @return {object}
* @optional
*/
getChildContext: SpecPolicy.DEFINE_MANY_MERGED,
/**
* Uses props from `this.props` and state from `this.state` to render the
* structure of the component.
*
* No guarantees are made about when or how often this method is invoked, so
* it must not have side effects.
*
* render: function() {
* var name = this.props.name;
* return <div>Hello, {name}!</div>;
* }
*
* @return {ReactComponent}
* @nosideeffects
* @required
*/
render: SpecPolicy.DEFINE_ONCE,
// ==== Delegate methods ====
/**
* Invoked when the component is initially created and about to be mounted.
* This may have side effects, but any external subscriptions or data created
* by this method must be cleaned up in `componentWillUnmount`.
*
* @optional
*/
componentWillMount: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component has been mounted and has a DOM representation.
* However, there is no guarantee that the DOM node is in the document.
*
* Use this as an opportunity to operate on the DOM when the component has
* been mounted (initialized and rendered) for the first time.
*
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidMount: SpecPolicy.DEFINE_MANY,
/**
* Invoked before the component receives new props.
*
* Use this as an opportunity to react to a prop transition by updating the
* state using `this.setState`. Current props are accessed via `this.props`.
*
* componentWillReceiveProps: function(nextProps, nextContext) {
* this.setState({
* likesIncreasing: nextProps.likeCount > this.props.likeCount
* });
* }
*
* NOTE: There is no equivalent `componentWillReceiveState`. An incoming prop
* transition may cause a state change, but the opposite is not true. If you
* need it, you are probably looking for `componentWillUpdate`.
*
* @param {object} nextProps
* @optional
*/
componentWillReceiveProps: SpecPolicy.DEFINE_MANY,
/**
* Invoked while deciding if the component should be updated as a result of
* receiving new props, state and/or context.
*
* Use this as an opportunity to `return false` when you're certain that the
* transition to the new props/state/context will not require a component
* update.
*
* shouldComponentUpdate: function(nextProps, nextState, nextContext) {
* return !equal(nextProps, this.props) ||
* !equal(nextState, this.state) ||
* !equal(nextContext, this.context);
* }
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @return {boolean} True if the component should update.
* @optional
*/
shouldComponentUpdate: SpecPolicy.DEFINE_ONCE,
/**
* Invoked when the component is about to update due to a transition from
* `this.props`, `this.state` and `this.context` to `nextProps`, `nextState`
* and `nextContext`.
*
* Use this as an opportunity to perform preparation before an update occurs.
*
* NOTE: You **cannot** use `this.setState()` in this method.
*
* @param {object} nextProps
* @param {?object} nextState
* @param {?object} nextContext
* @param {ReactReconcileTransaction} transaction
* @optional
*/
componentWillUpdate: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component's DOM representation has been updated.
*
* Use this as an opportunity to operate on the DOM when the component has
* been updated.
*
* @param {object} prevProps
* @param {?object} prevState
* @param {?object} prevContext
* @param {DOMElement} rootNode DOM element representing the component.
* @optional
*/
componentDidUpdate: SpecPolicy.DEFINE_MANY,
/**
* Invoked when the component is about to be removed from its parent and have
* its DOM representation destroyed.
*
* Use this as an opportunity to deallocate any external resources.
*
* NOTE: There is no `componentDidUnmount` since your component will have been
* destroyed by that point.
*
* @optional
*/
componentWillUnmount: SpecPolicy.DEFINE_MANY,
// ==== Advanced methods ====
/**
* Updates the component's currently mounted DOM representation.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @internal
* @overridable
*/
updateComponent: SpecPolicy.OVERRIDE_BASE
};
/**
* Mapping from class specification keys to special processing functions.
*
* Although these are declared like instance properties in the specification
* when defining classes using `React.createClass`, they are actually static
* and are accessible on the constructor instead of the prototype. Despite
* being static, they must be defined outside of the "statics" key under
* which all other static methods are defined.
*/
var RESERVED_SPEC_KEYS = {
displayName: function (Constructor, displayName) {
Constructor.displayName = displayName;
},
mixins: function (Constructor, mixins) {
if (mixins) {
for (var i = 0; i < mixins.length; i++) {
mixSpecIntoComponent(Constructor, mixins[i]);
}
}
},
childContextTypes: function (Constructor, childContextTypes) {
if ("development" !== 'production') {
validateTypeDef(Constructor, childContextTypes, ReactPropTypeLocations.childContext);
}
Constructor.childContextTypes = assign({}, Constructor.childContextTypes, childContextTypes);
},
contextTypes: function (Constructor, contextTypes) {
if ("development" !== 'production') {
validateTypeDef(Constructor, contextTypes, ReactPropTypeLocations.context);
}
Constructor.contextTypes = assign({}, Constructor.contextTypes, contextTypes);
},
/**
* Special case getDefaultProps which should move into statics but requires
* automatic merging.
*/
getDefaultProps: function (Constructor, getDefaultProps) {
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps = createMergedResultFunction(Constructor.getDefaultProps, getDefaultProps);
} else {
Constructor.getDefaultProps = getDefaultProps;
}
},
propTypes: function (Constructor, propTypes) {
if ("development" !== 'production') {
validateTypeDef(Constructor, propTypes, ReactPropTypeLocations.prop);
}
Constructor.propTypes = assign({}, Constructor.propTypes, propTypes);
},
statics: function (Constructor, statics) {
mixStaticSpecIntoComponent(Constructor, statics);
},
autobind: function () {} };
// noop
function validateTypeDef(Constructor, typeDef, location) {
for (var propName in typeDef) {
if (typeDef.hasOwnProperty(propName)) {
// use a warning instead of an invariant so components
// don't show up in prod but not in __DEV__
"development" !== 'production' ? warning(typeof typeDef[propName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', Constructor.displayName || 'ReactClass', ReactPropTypeLocationNames[location], propName) : undefined;
}
}
}
function validateMethodOverride(proto, name) {
var specPolicy = ReactClassInterface.hasOwnProperty(name) ? ReactClassInterface[name] : null;
// Disallow overriding of base class methods unless explicitly allowed.
if (ReactClassMixin.hasOwnProperty(name)) {
!(specPolicy === SpecPolicy.OVERRIDE_BASE) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to override ' + '`%s` from your class specification. Ensure that your method names ' + 'do not overlap with React methods.', name) : invariant(false) : undefined;
}
// Disallow defining methods more than once unless explicitly allowed.
if (proto.hasOwnProperty(name)) {
!(specPolicy === SpecPolicy.DEFINE_MANY || specPolicy === SpecPolicy.DEFINE_MANY_MERGED) ? "development" !== 'production' ? invariant(false, 'ReactClassInterface: You are attempting to define ' + '`%s` on your component more than once. This conflict may be due ' + 'to a mixin.', name) : invariant(false) : undefined;
}
}
/**
* Mixin helper which handles policy validation and reserved
* specification keys when building React classses.
*/
function mixSpecIntoComponent(Constructor, spec) {
if (!spec) {
return;
}
!(typeof spec !== 'function') ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component class as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
!!ReactElement.isValidElement(spec) ? "development" !== 'production' ? invariant(false, 'ReactClass: You\'re attempting to ' + 'use a component as a mixin. Instead, just use a regular object.') : invariant(false) : undefined;
var proto = Constructor.prototype;
// By handling mixins before any other properties, we ensure the same
// chaining order is applied to methods with DEFINE_MANY policy, whether
// mixins are listed before or after these methods in the spec.
if (spec.hasOwnProperty(MIXINS_KEY)) {
RESERVED_SPEC_KEYS.mixins(Constructor, spec.mixins);
}
for (var name in spec) {
if (!spec.hasOwnProperty(name)) {
continue;
}
if (name === MIXINS_KEY) {
// We have already handled mixins in a special case above.
continue;
}
var property = spec[name];
validateMethodOverride(proto, name);
if (RESERVED_SPEC_KEYS.hasOwnProperty(name)) {
RESERVED_SPEC_KEYS[name](Constructor, property);
} else {
// Setup methods on prototype:
// The following member methods should not be automatically bound:
// 1. Expected ReactClass methods (in the "interface").
// 2. Overridden methods (that were mixed in).
var isReactClassMethod = ReactClassInterface.hasOwnProperty(name);
var isAlreadyDefined = proto.hasOwnProperty(name);
var isFunction = typeof property === 'function';
var shouldAutoBind = isFunction && !isReactClassMethod && !isAlreadyDefined && spec.autobind !== false;
if (shouldAutoBind) {
if (!proto.__reactAutoBindMap) {
proto.__reactAutoBindMap = {};
}
proto.__reactAutoBindMap[name] = property;
proto[name] = property;
} else {
if (isAlreadyDefined) {
var specPolicy = ReactClassInterface[name];
// These cases should already be caught by validateMethodOverride.
!(isReactClassMethod && (specPolicy === SpecPolicy.DEFINE_MANY_MERGED || specPolicy === SpecPolicy.DEFINE_MANY)) ? "development" !== 'production' ? invariant(false, 'ReactClass: Unexpected spec policy %s for key %s ' + 'when mixing in component specs.', specPolicy, name) : invariant(false) : undefined;
// For methods which are defined more than once, call the existing
// methods before calling the new property, merging if appropriate.
if (specPolicy === SpecPolicy.DEFINE_MANY_MERGED) {
proto[name] = createMergedResultFunction(proto[name], property);
} else if (specPolicy === SpecPolicy.DEFINE_MANY) {
proto[name] = createChainedFunction(proto[name], property);
}
} else {
proto[name] = property;
if ("development" !== 'production') {
// Add verbose displayName to the function, which helps when looking
// at profiling tools.
if (typeof property === 'function' && spec.displayName) {
proto[name].displayName = spec.displayName + '_' + name;
}
}
}
}
}
}
}
function mixStaticSpecIntoComponent(Constructor, statics) {
if (!statics) {
return;
}
for (var name in statics) {
var property = statics[name];
if (!statics.hasOwnProperty(name)) {
continue;
}
var isReserved = (name in RESERVED_SPEC_KEYS);
!!isReserved ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define a reserved ' + 'property, `%s`, that shouldn\'t be on the "statics" key. Define it ' + 'as an instance property instead; it will still be accessible on the ' + 'constructor.', name) : invariant(false) : undefined;
var isInherited = (name in Constructor);
!!isInherited ? "development" !== 'production' ? invariant(false, 'ReactClass: You are attempting to define ' + '`%s` on your component more than once. This conflict may be ' + 'due to a mixin.', name) : invariant(false) : undefined;
Constructor[name] = property;
}
}
/**
* Merge two objects, but throw if both contain the same key.
*
* @param {object} one The first object, which is mutated.
* @param {object} two The second object
* @return {object} one after it has been mutated to contain everything in two.
*/
function mergeIntoWithNoDuplicateKeys(one, two) {
!(one && two && typeof one === 'object' && typeof two === 'object') ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.') : invariant(false) : undefined;
for (var key in two) {
if (two.hasOwnProperty(key)) {
!(one[key] === undefined) ? "development" !== 'production' ? invariant(false, 'mergeIntoWithNoDuplicateKeys(): ' + 'Tried to merge two objects with the same key: `%s`. This conflict ' + 'may be due to a mixin; in particular, this may be caused by two ' + 'getInitialState() or getDefaultProps() methods returning objects ' + 'with clashing keys.', key) : invariant(false) : undefined;
one[key] = two[key];
}
}
return one;
}
/**
* Creates a function that invokes two functions and merges their return values.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createMergedResultFunction(one, two) {
return function mergedResult() {
var a = one.apply(this, arguments);
var b = two.apply(this, arguments);
if (a == null) {
return b;
} else if (b == null) {
return a;
}
var c = {};
mergeIntoWithNoDuplicateKeys(c, a);
mergeIntoWithNoDuplicateKeys(c, b);
return c;
};
}
/**
* Creates a function that invokes two functions and ignores their return vales.
*
* @param {function} one Function to invoke first.
* @param {function} two Function to invoke second.
* @return {function} Function that invokes the two argument functions.
* @private
*/
function createChainedFunction(one, two) {
return function chainedFunction() {
one.apply(this, arguments);
two.apply(this, arguments);
};
}
/**
* Binds a method to the component.
*
* @param {object} component Component whose method is going to be bound.
* @param {function} method Method to be bound.
* @return {function} The bound method.
*/
function bindAutoBindMethod(component, method) {
var boundMethod = method.bind(component);
if ("development" !== 'production') {
boundMethod.__reactBoundContext = component;
boundMethod.__reactBoundMethod = method;
boundMethod.__reactBoundArguments = null;
var componentName = component.constructor.displayName;
var _bind = boundMethod.bind;
/* eslint-disable block-scoped-var, no-undef */
boundMethod.bind = function (newThis) {
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
// User is trying to bind() an autobound method; we effectively will
// ignore the value of "this" that the user is trying to use, so
// let's warn.
if (newThis !== component && newThis !== null) {
"development" !== 'production' ? warning(false, 'bind(): React component methods may only be bound to the ' + 'component instance. See %s', componentName) : undefined;
} else if (!args.length) {
"development" !== 'production' ? warning(false, 'bind(): You are binding a component method to the component. ' + 'React does this for you automatically in a high-performance ' + 'way, so you can safely remove this call. See %s', componentName) : undefined;
return boundMethod;
}
var reboundMethod = _bind.apply(boundMethod, arguments);
reboundMethod.__reactBoundContext = component;
reboundMethod.__reactBoundMethod = method;
reboundMethod.__reactBoundArguments = args;
return reboundMethod;
/* eslint-enable */
};
}
return boundMethod;
}
/**
* Binds all auto-bound methods in a component.
*
* @param {object} component Component whose method is going to be bound.
*/
function bindAutoBindMethods(component) {
for (var autoBindKey in component.__reactAutoBindMap) {
if (component.__reactAutoBindMap.hasOwnProperty(autoBindKey)) {
var method = component.__reactAutoBindMap[autoBindKey];
component[autoBindKey] = bindAutoBindMethod(component, method);
}
}
}
/**
* Add more to the ReactClass base class. These are all legacy features and
* therefore not already part of the modern ReactComponent.
*/
var ReactClassMixin = {
/**
* TODO: This will be deprecated because state should always keep a consistent
* type signature and the only use case for this, is to avoid that.
*/
replaceState: function (newState, callback) {
this.updater.enqueueReplaceState(this, newState);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
},
/**
* Checks whether or not this composite component is mounted.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function () {
return this.updater.isMounted(this);
},
/**
* Sets a subset of the props.
*
* @param {object} partialProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
* @deprecated
*/
setProps: function (partialProps, callback) {
if ("development" !== 'production') {
warnSetProps();
}
this.updater.enqueueSetProps(this, partialProps);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
},
/**
* Replace all the props.
*
* @param {object} newProps Subset of the next props.
* @param {?function} callback Called after props are updated.
* @final
* @public
* @deprecated
*/
replaceProps: function (newProps, callback) {
if ("development" !== 'production') {
warnSetProps();
}
this.updater.enqueueReplaceProps(this, newProps);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
}
};
var ReactClassComponent = function () {};
assign(ReactClassComponent.prototype, ReactComponent.prototype, ReactClassMixin);
/**
* Module for creating composite components.
*
* @class ReactClass
*/
var ReactClass = {
/**
* Creates a composite component class given a class specification.
*
* @param {object} spec Class specification (which must define `render`).
* @return {function} Component constructor function.
* @public
*/
createClass: function (spec) {
var Constructor = function (props, context, updater) {
// This constructor is overridden by mocks. The argument is used
// by mocks to assert on what gets mounted.
if ("development" !== 'production') {
"development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: https://fb.me/react-legacyfactory') : undefined;
}
// Wire up auto-binding
if (this.__reactAutoBindMap) {
bindAutoBindMethods(this);
}
this.props = props;
this.context = context;
this.refs = emptyObject;
this.updater = updater || ReactNoopUpdateQueue;
this.state = null;
// ReactClasses doesn't have constructors. Instead, they use the
// getInitialState and componentWillMount methods for initialization.
var initialState = this.getInitialState ? this.getInitialState() : null;
if ("development" !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof initialState === 'undefined' && this.getInitialState._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
initialState = null;
}
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent') : invariant(false) : undefined;
this.state = initialState;
};
Constructor.prototype = new ReactClassComponent();
Constructor.prototype.constructor = Constructor;
injectedMixins.forEach(mixSpecIntoComponent.bind(null, Constructor));
mixSpecIntoComponent(Constructor, spec);
// Initialize the defaultProps property after all mixins have been merged.
if (Constructor.getDefaultProps) {
Constructor.defaultProps = Constructor.getDefaultProps();
}
if ("development" !== 'production') {
// This is a tag to indicate that the use of these method names is ok,
// since it's used with createClass. If it's not, then it's likely a
// mistake so we'll warn you to use the static property, property
// initializer or constructor respectively.
if (Constructor.getDefaultProps) {
Constructor.getDefaultProps.isReactClassApproved = {};
}
if (Constructor.prototype.getInitialState) {
Constructor.prototype.getInitialState.isReactClassApproved = {};
}
}
!Constructor.prototype.render ? "development" !== 'production' ? invariant(false, 'createClass(...): Class specification must implement a `render` method.') : invariant(false) : undefined;
if ("development" !== 'production') {
"development" !== 'production' ? warning(!Constructor.prototype.componentShouldUpdate, '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', spec.displayName || 'A component') : undefined;
"development" !== 'production' ? warning(!Constructor.prototype.componentWillRecieveProps, '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', spec.displayName || 'A component') : undefined;
}
// Reduce time spent doing lookups by setting these on the prototype.
for (var methodName in ReactClassInterface) {
if (!Constructor.prototype[methodName]) {
Constructor.prototype[methodName] = null;
}
}
return Constructor;
},
injection: {
injectMixin: function (mixin) {
injectedMixins.push(mixin);
}
}
};
module.exports = ReactClass;
},{"153":153,"160":160,"164":164,"165":165,"172":172,"24":24,"34":34,"57":57,"76":76,"80":80,"81":81}],34:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponent
*/
'use strict';
var ReactNoopUpdateQueue = _dereq_(76);
var emptyObject = _dereq_(153);
var invariant = _dereq_(160);
var warning = _dereq_(172);
/**
* Base class helpers for the updating state of a component.
*/
function ReactComponent(props, context, updater) {
this.props = props;
this.context = context;
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue;
}
ReactComponent.prototype.isReactComponent = {};
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* There is no guarantee that calls to `setState` will run synchronously,
* as they may eventually be batched together. You can provide an optional
* callback that will be executed when the call to setState is actually
* completed.
*
* When a function is provided to setState, it will be called at some point in
* the future (not synchronously). It will be called with the up to date
* component arguments (state, props, context). These values can be different
* from this.* because your function may be called after receiveProps but before
* shouldComponentUpdate, and this new state, props, and context will not yet be
* assigned to this.
*
* @param {object|function} partialState Next partial state or function to
* produce next partial state to be merged with current state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
ReactComponent.prototype.setState = function (partialState, callback) {
!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null) ? "development" !== 'production' ? invariant(false, 'setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.') : invariant(false) : undefined;
if ("development" !== 'production') {
"development" !== 'production' ? warning(partialState != null, 'setState(...): You passed an undefined or null state object; ' + 'instead, use forceUpdate().') : undefined;
}
this.updater.enqueueSetState(this, partialState);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
};
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {?function} callback Called after update is complete.
* @final
* @protected
*/
ReactComponent.prototype.forceUpdate = function (callback) {
this.updater.enqueueForceUpdate(this);
if (callback) {
this.updater.enqueueCallback(this, callback);
}
};
/**
* Deprecated APIs. These APIs used to exist on classic React classes but since
* we would like to deprecate them, we're not going to move them over to this
* modern base class. Instead, we define a getter that warns if it's accessed.
*/
if ("development" !== 'production') {
var deprecatedAPIs = {
getDOMNode: ['getDOMNode', 'Use ReactDOM.findDOMNode(component) instead.'],
isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
replaceProps: ['replaceProps', 'Instead, call render again at the top level.'],
replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'],
setProps: ['setProps', 'Instead, call render again at the top level.']
};
var defineDeprecationWarning = function (methodName, info) {
try {
Object.defineProperty(ReactComponent.prototype, methodName, {
get: function () {
"development" !== 'production' ? warning(false, '%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]) : undefined;
return undefined;
}
});
} catch (x) {
// IE will fail on defineProperty (es5-shim/sham too)
}
};
for (var fnName in deprecatedAPIs) {
if (deprecatedAPIs.hasOwnProperty(fnName)) {
defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
}
}
}
module.exports = ReactComponent;
},{"153":153,"160":160,"172":172,"76":76}],35:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponentBrowserEnvironment
*/
'use strict';
var ReactDOMIDOperations = _dereq_(45);
var ReactMount = _dereq_(72);
/**
* Abstracts away all functionality of the reconciler that requires knowledge of
* the browser context. TODO: These callers should be refactored to avoid the
* need for this injection.
*/
var ReactComponentBrowserEnvironment = {
processChildrenUpdates: ReactDOMIDOperations.dangerouslyProcessChildrenUpdates,
replaceNodeWithMarkupByID: ReactDOMIDOperations.dangerouslyReplaceNodeWithMarkupByID,
/**
* If a particular environment requires that some resources be cleaned up,
* specify this in the injected Mixin. In the DOM, we would likely want to
* purge any cached node ID lookups.
*
* @private
*/
unmountIDFromEnvironment: function (rootNodeID) {
ReactMount.purgeID(rootNodeID);
}
};
module.exports = ReactComponentBrowserEnvironment;
},{"45":45,"72":72}],36:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponentEnvironment
*/
'use strict';
var invariant = _dereq_(160);
var injected = false;
var ReactComponentEnvironment = {
/**
* Optionally injectable environment dependent cleanup hook. (server vs.
* browser etc). Example: A browser system caches DOM nodes based on component
* ID and must remove that cache entry when this instance is unmounted.
*/
unmountIDFromEnvironment: null,
/**
* Optionally injectable hook for swapping out mount images in the middle of
* the tree.
*/
replaceNodeWithMarkupByID: null,
/**
* Optionally injectable hook for processing a queue of child updates. Will
* later move into MultiChildComponents.
*/
processChildrenUpdates: null,
injection: {
injectEnvironment: function (environment) {
!!injected ? "development" !== 'production' ? invariant(false, 'ReactCompositeComponent: injectEnvironment() can only be called once.') : invariant(false) : undefined;
ReactComponentEnvironment.unmountIDFromEnvironment = environment.unmountIDFromEnvironment;
ReactComponentEnvironment.replaceNodeWithMarkupByID = environment.replaceNodeWithMarkupByID;
ReactComponentEnvironment.processChildrenUpdates = environment.processChildrenUpdates;
injected = true;
}
}
};
module.exports = ReactComponentEnvironment;
},{"160":160}],37:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactComponentWithPureRenderMixin
*/
'use strict';
var shallowCompare = _dereq_(139);
/**
* If your React component's render function is "pure", e.g. it will render the
* same result given the same props and state, provide this Mixin for a
* considerable performance boost.
*
* Most React components have pure render functions.
*
* Example:
*
* var ReactComponentWithPureRenderMixin =
* require('ReactComponentWithPureRenderMixin');
* React.createClass({
* mixins: [ReactComponentWithPureRenderMixin],
*
* render: function() {
* return <div className={this.props.className}>foo</div>;
* }
* });
*
* Note: This only checks shallow equality for props and state. If these contain
* complex data structures this mixin may have false-negatives for deeper
* differences. Only mixin to components which have simple props and state, or
* use `forceUpdate()` when you know deep data structures have changed.
*/
var ReactComponentWithPureRenderMixin = {
shouldComponentUpdate: function (nextProps, nextState) {
return shallowCompare(this, nextProps, nextState);
}
};
module.exports = ReactComponentWithPureRenderMixin;
},{"139":139}],38:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactCompositeComponent
*/
'use strict';
var ReactComponentEnvironment = _dereq_(36);
var ReactCurrentOwner = _dereq_(39);
var ReactElement = _dereq_(57);
var ReactInstanceMap = _dereq_(68);
var ReactPerf = _dereq_(78);
var ReactPropTypeLocations = _dereq_(81);
var ReactPropTypeLocationNames = _dereq_(80);
var ReactReconciler = _dereq_(84);
var ReactUpdateQueue = _dereq_(95);
var assign = _dereq_(24);
var emptyObject = _dereq_(153);
var invariant = _dereq_(160);
var shouldUpdateReactComponent = _dereq_(140);
var warning = _dereq_(172);
function getDeclarationErrorAddendum(component) {
var owner = component._currentElement._owner || null;
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
function StatelessComponent(Component) {}
StatelessComponent.prototype.render = function () {
var Component = ReactInstanceMap.get(this)._currentElement.type;
return Component(this.props, this.context, this.updater);
};
/**
* ------------------ The Life-Cycle of a Composite Component ------------------
*
* - constructor: Initialization of state. The instance is now retained.
* - componentWillMount
* - render
* - [children's constructors]
* - [children's componentWillMount and render]
* - [children's componentDidMount]
* - componentDidMount
*
* Update Phases:
* - componentWillReceiveProps (only called if parent updated)
* - shouldComponentUpdate
* - componentWillUpdate
* - render
* - [children's constructors or receive props phases]
* - componentDidUpdate
*
* - componentWillUnmount
* - [children's componentWillUnmount]
* - [children destroyed]
* - (destroyed): The instance is now blank, released by React and ready for GC.
*
* -----------------------------------------------------------------------------
*/
/**
* An incrementing ID assigned to each component when it is mounted. This is
* used to enforce the order in which `ReactUpdates` updates dirty components.
*
* @private
*/
var nextMountID = 1;
/**
* @lends {ReactCompositeComponent.prototype}
*/
var ReactCompositeComponentMixin = {
/**
* Base constructor for all composite component.
*
* @param {ReactElement} element
* @final
* @internal
*/
construct: function (element) {
this._currentElement = element;
this._rootNodeID = null;
this._instance = null;
// See ReactUpdateQueue
this._pendingElement = null;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._renderedComponent = null;
this._context = null;
this._mountOrder = 0;
this._topLevelWrapper = null;
// See ReactUpdates and ReactUpdateQueue.
this._pendingCallbacks = null;
},
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function (rootID, transaction, context) {
this._context = context;
this._mountOrder = nextMountID++;
this._rootNodeID = rootID;
var publicProps = this._processProps(this._currentElement.props);
var publicContext = this._processContext(context);
var Component = this._currentElement.type;
// Initialize the public class
var inst;
var renderedElement;
// This is a way to detect if Component is a stateless arrow function
// component, which is not newable. It might not be 100% reliable but is
// something we can do until we start detecting that Component extends
// React.Component. We already assume that typeof Component === 'function'.
var canInstantiate = ('prototype' in Component);
if (canInstantiate) {
if ("development" !== 'production') {
ReactCurrentOwner.current = this;
try {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
} finally {
ReactCurrentOwner.current = null;
}
} else {
inst = new Component(publicProps, publicContext, ReactUpdateQueue);
}
}
if (!canInstantiate || inst === null || inst === false || ReactElement.isValidElement(inst)) {
renderedElement = inst;
inst = new StatelessComponent(Component);
}
if ("development" !== 'production') {
// This will throw later in _renderValidatedComponent, but add an early
// warning now to help debugging
if (inst.render == null) {
"development" !== 'production' ? warning(false, '%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`, returned ' + 'null/false from a stateless component, or tried to render an ' + 'element whose type is a function that isn\'t a React component.', Component.displayName || Component.name || 'Component') : undefined;
} else {
// We support ES6 inheriting from React.Component, the module pattern,
// and stateless components, but not ES6 classes that don't extend
"development" !== 'production' ? warning(Component.prototype && Component.prototype.isReactComponent || !canInstantiate || !(inst instanceof Component), '%s(...): React component classes must extend React.Component.', Component.displayName || Component.name || 'Component') : undefined;
}
}
// These should be set up in the constructor, but as a convenience for
// simpler class abstractions, we set them up after the fact.
inst.props = publicProps;
inst.context = publicContext;
inst.refs = emptyObject;
inst.updater = ReactUpdateQueue;
this._instance = inst;
// Store a reference from the instance back to the internal representation
ReactInstanceMap.set(inst, this);
if ("development" !== 'production') {
// Since plain JS classes are defined without any special initialization
// logic, we can not catch common errors early. Therefore, we have to
// catch them here, at initialization time, instead.
"development" !== 'production' ? warning(!inst.getInitialState || inst.getInitialState.isReactClassApproved, 'getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', this.getName() || 'a component') : undefined;
"development" !== 'production' ? warning(!inst.getDefaultProps || inst.getDefaultProps.isReactClassApproved, 'getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', this.getName() || 'a component') : undefined;
"development" !== 'production' ? warning(!inst.propTypes, 'propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', this.getName() || 'a component') : undefined;
"development" !== 'production' ? warning(!inst.contextTypes, 'contextTypes was defined as an instance property on %s. Use a ' + 'static property to define contextTypes instead.', this.getName() || 'a component') : undefined;
"development" !== 'production' ? warning(typeof inst.componentShouldUpdate !== 'function', '%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', this.getName() || 'A component') : undefined;
"development" !== 'production' ? warning(typeof inst.componentDidUnmount !== 'function', '%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', this.getName() || 'A component') : undefined;
"development" !== 'production' ? warning(typeof inst.componentWillRecieveProps !== 'function', '%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', this.getName() || 'A component') : undefined;
}
var initialState = inst.state;
if (initialState === undefined) {
inst.state = initialState = null;
}
!(typeof initialState === 'object' && !Array.isArray(initialState)) ? "development" !== 'production' ? invariant(false, '%s.state: must be set to an object or null', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
if (inst.componentWillMount) {
inst.componentWillMount();
// When mounting, calls to `setState` by `componentWillMount` will set
// `this._pendingStateQueue` without triggering a re-render.
if (this._pendingStateQueue) {
inst.state = this._processPendingState(inst.props, inst.context);
}
}
// If not a stateless component, we now render
if (renderedElement === undefined) {
renderedElement = this._renderValidatedComponent();
}
this._renderedComponent = this._instantiateReactComponent(renderedElement);
var markup = ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, this._processChildContext(context));
if (inst.componentDidMount) {
transaction.getReactMountReady().enqueue(inst.componentDidMount, inst);
}
return markup;
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function () {
var inst = this._instance;
if (inst.componentWillUnmount) {
inst.componentWillUnmount();
}
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
this._instance = null;
// Reset pending fields
// Even if this component is scheduled for another update in ReactUpdates,
// it would still be ignored because these fields are reset.
this._pendingStateQueue = null;
this._pendingReplaceState = false;
this._pendingForceUpdate = false;
this._pendingCallbacks = null;
this._pendingElement = null;
// These fields do not really need to be reset since this object is no
// longer accessible.
this._context = null;
this._rootNodeID = null;
this._topLevelWrapper = null;
// Delete the reference from the instance to this internal representation
// which allow the internals to be properly cleaned up even if the user
// leaks a reference to the public instance.
ReactInstanceMap.remove(inst);
// Some existing components rely on inst.props even after they've been
// destroyed (in event handlers).
// TODO: inst.props = null;
// TODO: inst.state = null;
// TODO: inst.context = null;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`
*
* @param {object} context
* @return {?object}
* @private
*/
_maskContext: function (context) {
var maskedContext = null;
var Component = this._currentElement.type;
var contextTypes = Component.contextTypes;
if (!contextTypes) {
return emptyObject;
}
maskedContext = {};
for (var contextName in contextTypes) {
maskedContext[contextName] = context[contextName];
}
return maskedContext;
},
/**
* Filters the context object to only contain keys specified in
* `contextTypes`, and asserts that they are valid.
*
* @param {object} context
* @return {?object}
* @private
*/
_processContext: function (context) {
var maskedContext = this._maskContext(context);
if ("development" !== 'production') {
var Component = this._currentElement.type;
if (Component.contextTypes) {
this._checkPropTypes(Component.contextTypes, maskedContext, ReactPropTypeLocations.context);
}
}
return maskedContext;
},
/**
* @param {object} currentContext
* @return {object}
* @private
*/
_processChildContext: function (currentContext) {
var Component = this._currentElement.type;
var inst = this._instance;
var childContext = inst.getChildContext && inst.getChildContext();
if (childContext) {
!(typeof Component.childContextTypes === 'object') ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
if ("development" !== 'production') {
this._checkPropTypes(Component.childContextTypes, childContext, ReactPropTypeLocations.childContext);
}
for (var name in childContext) {
!(name in Component.childContextTypes) ? "development" !== 'production' ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', this.getName() || 'ReactCompositeComponent', name) : invariant(false) : undefined;
}
return assign({}, currentContext, childContext);
}
return currentContext;
},
/**
* Processes props by setting default values for unspecified props and
* asserting that the props are valid. Does not mutate its argument; returns
* a new props object with defaults merged in.
*
* @param {object} newProps
* @return {object}
* @private
*/
_processProps: function (newProps) {
if ("development" !== 'production') {
var Component = this._currentElement.type;
if (Component.propTypes) {
this._checkPropTypes(Component.propTypes, newProps, ReactPropTypeLocations.prop);
}
}
return newProps;
},
/**
* Assert that the props are valid
*
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
_checkPropTypes: function (propTypes, props, location) {
// TODO: Stop validating prop types here and only use the element
// validation.
var componentName = this.getName();
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
!(typeof propTypes[propName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually ' + 'from React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
if (error instanceof Error) {
// We may want to extend this logic for similar errors in
// top-level render calls, so I'm abstracting it away into
// a function to minimize refactoring in the future
var addendum = getDeclarationErrorAddendum(this);
if (location === ReactPropTypeLocations.prop) {
// Preface gives us something to blacklist in warning module
"development" !== 'production' ? warning(false, 'Failed Composite propType: %s%s', error.message, addendum) : undefined;
} else {
"development" !== 'production' ? warning(false, 'Failed Context Types: %s%s', error.message, addendum) : undefined;
}
}
}
}
},
receiveComponent: function (nextElement, transaction, nextContext) {
var prevElement = this._currentElement;
var prevContext = this._context;
this._pendingElement = null;
this.updateComponent(transaction, prevElement, nextElement, prevContext, nextContext);
},
/**
* If any of `_pendingElement`, `_pendingStateQueue`, or `_pendingForceUpdate`
* is set, update the component.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function (transaction) {
if (this._pendingElement != null) {
ReactReconciler.receiveComponent(this, this._pendingElement || this._currentElement, transaction, this._context);
}
if (this._pendingStateQueue !== null || this._pendingForceUpdate) {
this.updateComponent(transaction, this._currentElement, this._currentElement, this._context, this._context);
}
},
/**
* Perform an update to a mounted component. The componentWillReceiveProps and
* shouldComponentUpdate methods are called, then (assuming the update isn't
* skipped) the remaining update lifecycle methods are called and the DOM
* representation is updated.
*
* By default, this implements React's rendering and reconciliation algorithm.
* Sophisticated clients may wish to override this.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevParentElement
* @param {ReactElement} nextParentElement
* @internal
* @overridable
*/
updateComponent: function (transaction, prevParentElement, nextParentElement, prevUnmaskedContext, nextUnmaskedContext) {
var inst = this._instance;
var nextContext = this._context === nextUnmaskedContext ? inst.context : this._processContext(nextUnmaskedContext);
var nextProps;
// Distinguish between a props update versus a simple state update
if (prevParentElement === nextParentElement) {
// Skip checking prop types again -- we don't read inst.props to avoid
// warning for DOM component props in this upgrade
nextProps = nextParentElement.props;
} else {
nextProps = this._processProps(nextParentElement.props);
// An update here will schedule an update but immediately set
// _pendingStateQueue which will ensure that any state updates gets
// immediately reconciled instead of waiting for the next batch.
if (inst.componentWillReceiveProps) {
inst.componentWillReceiveProps(nextProps, nextContext);
}
}
var nextState = this._processPendingState(nextProps, nextContext);
var shouldUpdate = this._pendingForceUpdate || !inst.shouldComponentUpdate || inst.shouldComponentUpdate(nextProps, nextState, nextContext);
if ("development" !== 'production') {
"development" !== 'production' ? warning(typeof shouldUpdate !== 'undefined', '%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', this.getName() || 'ReactCompositeComponent') : undefined;
}
if (shouldUpdate) {
this._pendingForceUpdate = false;
// Will set `this.props`, `this.state` and `this.context`.
this._performComponentUpdate(nextParentElement, nextProps, nextState, nextContext, transaction, nextUnmaskedContext);
} else {
// If it's determined that a component should not update, we still want
// to set props and state but we shortcut the rest of the update.
this._currentElement = nextParentElement;
this._context = nextUnmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
}
},
_processPendingState: function (props, context) {
var inst = this._instance;
var queue = this._pendingStateQueue;
var replace = this._pendingReplaceState;
this._pendingReplaceState = false;
this._pendingStateQueue = null;
if (!queue) {
return inst.state;
}
if (replace && queue.length === 1) {
return queue[0];
}
var nextState = assign({}, replace ? queue[0] : inst.state);
for (var i = replace ? 1 : 0; i < queue.length; i++) {
var partial = queue[i];
assign(nextState, typeof partial === 'function' ? partial.call(inst, nextState, props, context) : partial);
}
return nextState;
},
/**
* Merges new props and state, notifies delegate methods of update and
* performs update.
*
* @param {ReactElement} nextElement Next element
* @param {object} nextProps Next public object to set as properties.
* @param {?object} nextState Next object to set as state.
* @param {?object} nextContext Next public object to set as context.
* @param {ReactReconcileTransaction} transaction
* @param {?object} unmaskedContext
* @private
*/
_performComponentUpdate: function (nextElement, nextProps, nextState, nextContext, transaction, unmaskedContext) {
var inst = this._instance;
var hasComponentDidUpdate = Boolean(inst.componentDidUpdate);
var prevProps;
var prevState;
var prevContext;
if (hasComponentDidUpdate) {
prevProps = inst.props;
prevState = inst.state;
prevContext = inst.context;
}
if (inst.componentWillUpdate) {
inst.componentWillUpdate(nextProps, nextState, nextContext);
}
this._currentElement = nextElement;
this._context = unmaskedContext;
inst.props = nextProps;
inst.state = nextState;
inst.context = nextContext;
this._updateRenderedComponent(transaction, unmaskedContext);
if (hasComponentDidUpdate) {
transaction.getReactMountReady().enqueue(inst.componentDidUpdate.bind(inst, prevProps, prevState, prevContext), inst);
}
},
/**
* Call the component's `render` method and update the DOM accordingly.
*
* @param {ReactReconcileTransaction} transaction
* @internal
*/
_updateRenderedComponent: function (transaction, context) {
var prevComponentInstance = this._renderedComponent;
var prevRenderedElement = prevComponentInstance._currentElement;
var nextRenderedElement = this._renderValidatedComponent();
if (shouldUpdateReactComponent(prevRenderedElement, nextRenderedElement)) {
ReactReconciler.receiveComponent(prevComponentInstance, nextRenderedElement, transaction, this._processChildContext(context));
} else {
// These two IDs are actually the same! But nothing should rely on that.
var thisID = this._rootNodeID;
var prevComponentID = prevComponentInstance._rootNodeID;
ReactReconciler.unmountComponent(prevComponentInstance);
this._renderedComponent = this._instantiateReactComponent(nextRenderedElement);
var nextMarkup = ReactReconciler.mountComponent(this._renderedComponent, thisID, transaction, this._processChildContext(context));
this._replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
}
},
/**
* @protected
*/
_replaceNodeWithMarkupByID: function (prevComponentID, nextMarkup) {
ReactComponentEnvironment.replaceNodeWithMarkupByID(prevComponentID, nextMarkup);
},
/**
* @protected
*/
_renderValidatedComponentWithoutOwnerOrContext: function () {
var inst = this._instance;
var renderedComponent = inst.render();
if ("development" !== 'production') {
// We allow auto-mocks to proceed as if they're returning null.
if (typeof renderedComponent === 'undefined' && inst.render._isMockFunction) {
// This is probably bad practice. Consider warning here and
// deprecating this convenience.
renderedComponent = null;
}
}
return renderedComponent;
},
/**
* @private
*/
_renderValidatedComponent: function () {
var renderedComponent;
ReactCurrentOwner.current = this;
try {
renderedComponent = this._renderValidatedComponentWithoutOwnerOrContext();
} finally {
ReactCurrentOwner.current = null;
}
!(
// TODO: An `isValidNode` function would probably be more appropriate
renderedComponent === null || renderedComponent === false || ReactElement.isValidElement(renderedComponent)) ? "development" !== 'production' ? invariant(false, '%s.render(): A valid ReactComponent must be returned. You may have ' + 'returned undefined, an array or some other invalid object.', this.getName() || 'ReactCompositeComponent') : invariant(false) : undefined;
return renderedComponent;
},
/**
* Lazily allocates the refs object and stores `component` as `ref`.
*
* @param {string} ref Reference name.
* @param {component} component Component to store as `ref`.
* @final
* @private
*/
attachRef: function (ref, component) {
var inst = this.getPublicInstance();
!(inst != null) ? "development" !== 'production' ? invariant(false, 'Stateless function components cannot have refs.') : invariant(false) : undefined;
var publicComponentInstance = component.getPublicInstance();
if ("development" !== 'production') {
var componentName = component && component.getName ? component.getName() : 'a component';
"development" !== 'production' ? warning(publicComponentInstance != null, 'Stateless function components cannot be given refs ' + '(See ref "%s" in %s created by %s). ' + 'Attempts to access this ref will fail.', ref, componentName, this.getName()) : undefined;
}
var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs;
refs[ref] = publicComponentInstance;
},
/**
* Detaches a reference name.
*
* @param {string} ref Name to dereference.
* @final
* @private
*/
detachRef: function (ref) {
var refs = this.getPublicInstance().refs;
delete refs[ref];
},
/**
* Get a text description of the component that can be used to identify it
* in error messages.
* @return {string} The name or null.
* @internal
*/
getName: function () {
var type = this._currentElement.type;
var constructor = this._instance && this._instance.constructor;
return type.displayName || constructor && constructor.displayName || type.name || constructor && constructor.name || null;
},
/**
* Get the publicly accessible representation of this component - i.e. what
* is exposed by refs and returned by render. Can be null for stateless
* components.
*
* @return {ReactComponent} the public component instance.
* @internal
*/
getPublicInstance: function () {
var inst = this._instance;
if (inst instanceof StatelessComponent) {
return null;
}
return inst;
},
// Stub
_instantiateReactComponent: null
};
ReactPerf.measureMethods(ReactCompositeComponentMixin, 'ReactCompositeComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent',
_renderValidatedComponent: '_renderValidatedComponent'
});
var ReactCompositeComponent = {
Mixin: ReactCompositeComponentMixin
};
module.exports = ReactCompositeComponent;
},{"140":140,"153":153,"160":160,"172":172,"24":24,"36":36,"39":39,"57":57,"68":68,"78":78,"80":80,"81":81,"84":84,"95":95}],39:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactCurrentOwner
*/
'use strict';
/**
* Keeps track of the current owner.
*
* The current owner is the component who should own any components that are
* currently being constructed.
*/
var ReactCurrentOwner = {
/**
* @internal
* @type {ReactComponent}
*/
current: null
};
module.exports = ReactCurrentOwner;
},{}],40:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOM
*/
/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__*/
'use strict';
var ReactCurrentOwner = _dereq_(39);
var ReactDOMTextComponent = _dereq_(51);
var ReactDefaultInjection = _dereq_(54);
var ReactInstanceHandles = _dereq_(67);
var ReactMount = _dereq_(72);
var ReactPerf = _dereq_(78);
var ReactReconciler = _dereq_(84);
var ReactUpdates = _dereq_(96);
var ReactVersion = _dereq_(97);
var findDOMNode = _dereq_(121);
var renderSubtreeIntoContainer = _dereq_(136);
var warning = _dereq_(172);
ReactDefaultInjection.inject();
var render = ReactPerf.measure('React', 'render', ReactMount.render);
var React = {
findDOMNode: findDOMNode,
render: render,
unmountComponentAtNode: ReactMount.unmountComponentAtNode,
version: ReactVersion,
/* eslint-disable camelcase */
unstable_batchedUpdates: ReactUpdates.batchedUpdates,
unstable_renderSubtreeIntoContainer: renderSubtreeIntoContainer
};
// Inject the runtime into a devtools global hook regardless of browser.
// Allows for debugging when the hook is injected on the page.
/* eslint-enable camelcase */
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
CurrentOwner: ReactCurrentOwner,
InstanceHandles: ReactInstanceHandles,
Mount: ReactMount,
Reconciler: ReactReconciler,
TextComponent: ReactDOMTextComponent
});
}
if ("development" !== 'production') {
var ExecutionEnvironment = _dereq_(146);
if (ExecutionEnvironment.canUseDOM && window.top === window.self) {
// First check if devtools is not installed
if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') {
// If we're in Chrome or Firefox, provide a download link if not installed.
if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) {
console.debug('Download the React DevTools for a better development experience: ' + 'https://fb.me/react-devtools');
}
}
// If we're in IE8, check to see if we are in compatibility mode and provide
// information on preventing compatibility mode
var ieCompatibilityMode = document.documentMode && document.documentMode < 8;
"development" !== 'production' ? warning(!ieCompatibilityMode, 'Internet Explorer is running in compatibility mode; please add the ' + 'following tag to your HTML to prevent this from happening: ' + '<meta http-equiv="X-UA-Compatible" content="IE=edge" />') : undefined;
var expectedFeatures = [
// shims
Array.isArray, Array.prototype.every, Array.prototype.forEach, Array.prototype.indexOf, Array.prototype.map, Date.now, Function.prototype.bind, Object.keys, String.prototype.split, String.prototype.trim,
// shams
Object.create, Object.freeze];
for (var i = 0; i < expectedFeatures.length; i++) {
if (!expectedFeatures[i]) {
console.error('One or more ES5 shim/shams expected by React are not available: ' + 'https://fb.me/react-warning-polyfills');
break;
}
}
}
}
module.exports = React;
},{"121":121,"136":136,"146":146,"172":172,"39":39,"51":51,"54":54,"67":67,"72":72,"78":78,"84":84,"96":96,"97":97}],41:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMButton
*/
'use strict';
var mouseListenerNames = {
onClick: true,
onDoubleClick: true,
onMouseDown: true,
onMouseMove: true,
onMouseUp: true,
onClickCapture: true,
onDoubleClickCapture: true,
onMouseDownCapture: true,
onMouseMoveCapture: true,
onMouseUpCapture: true
};
/**
* Implements a <button> native component that does not receive mouse events
* when `disabled` is set.
*/
var ReactDOMButton = {
getNativeProps: function (inst, props, context) {
if (!props.disabled) {
return props;
}
// Copy the props, except the mouse listeners
var nativeProps = {};
for (var key in props) {
if (props.hasOwnProperty(key) && !mouseListenerNames[key]) {
nativeProps[key] = props[key];
}
}
return nativeProps;
}
};
module.exports = ReactDOMButton;
},{}],42:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMComponent
* @typechecks static-only
*/
/* global hasOwnProperty:true */
'use strict';
var AutoFocusUtils = _dereq_(2);
var CSSPropertyOperations = _dereq_(5);
var DOMProperty = _dereq_(10);
var DOMPropertyOperations = _dereq_(11);
var EventConstants = _dereq_(15);
var ReactBrowserEventEmitter = _dereq_(28);
var ReactComponentBrowserEnvironment = _dereq_(35);
var ReactDOMButton = _dereq_(41);
var ReactDOMInput = _dereq_(46);
var ReactDOMOption = _dereq_(47);
var ReactDOMSelect = _dereq_(48);
var ReactDOMTextarea = _dereq_(52);
var ReactMount = _dereq_(72);
var ReactMultiChild = _dereq_(73);
var ReactPerf = _dereq_(78);
var ReactUpdateQueue = _dereq_(95);
var assign = _dereq_(24);
var escapeTextContentForBrowser = _dereq_(120);
var invariant = _dereq_(160);
var isEventSupported = _dereq_(132);
var keyOf = _dereq_(165);
var setInnerHTML = _dereq_(137);
var setTextContent = _dereq_(138);
var shallowEqual = _dereq_(170);
var validateDOMNesting = _dereq_(143);
var warning = _dereq_(172);
var deleteListener = ReactBrowserEventEmitter.deleteListener;
var listenTo = ReactBrowserEventEmitter.listenTo;
var registrationNameModules = ReactBrowserEventEmitter.registrationNameModules;
// For quickly matching children type, to test if can be treated as content.
var CONTENT_TYPES = { 'string': true, 'number': true };
var STYLE = keyOf({ style: null });
var ELEMENT_NODE_TYPE = 1;
var canDefineProperty = false;
try {
Object.defineProperty({}, 'test', { get: function () {} });
canDefineProperty = true;
} catch (e) {}
function getDeclarationErrorAddendum(internalInstance) {
if (internalInstance) {
var owner = internalInstance._currentElement._owner || null;
if (owner) {
var name = owner.getName();
if (name) {
return ' This DOM node was rendered by `' + name + '`.';
}
}
}
return '';
}
var legacyPropsDescriptor;
if ("development" !== 'production') {
legacyPropsDescriptor = {
props: {
enumerable: false,
get: function () {
var component = this._reactInternalComponent;
"development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .props of a DOM node; instead, ' + 'recreate the props as `render` did originally or read the DOM ' + 'properties/attributes directly from this node (e.g., ' + 'this.refs.box.className).%s', getDeclarationErrorAddendum(component)) : undefined;
return component._currentElement.props;
}
}
};
}
function legacyGetDOMNode() {
if ("development" !== 'production') {
var component = this._reactInternalComponent;
"development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .getDOMNode() of a DOM node; ' + 'instead, use the node directly.%s', getDeclarationErrorAddendum(component)) : undefined;
}
return this;
}
function legacyIsMounted() {
var component = this._reactInternalComponent;
if ("development" !== 'production') {
"development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .isMounted() of a DOM node.%s', getDeclarationErrorAddendum(component)) : undefined;
}
return !!component;
}
function legacySetStateEtc() {
if ("development" !== 'production') {
var component = this._reactInternalComponent;
"development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setState(), .replaceState(), or ' + '.forceUpdate() of a DOM node. This is a no-op.%s', getDeclarationErrorAddendum(component)) : undefined;
}
}
function legacySetProps(partialProps, callback) {
var component = this._reactInternalComponent;
if ("development" !== 'production') {
"development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .setProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
}
if (!component) {
return;
}
ReactUpdateQueue.enqueueSetPropsInternal(component, partialProps);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(component, callback);
}
}
function legacyReplaceProps(partialProps, callback) {
var component = this._reactInternalComponent;
if ("development" !== 'production') {
"development" !== 'production' ? warning(false, 'ReactDOMComponent: Do not access .replaceProps() of a DOM node. ' + 'Instead, call ReactDOM.render again at the top level.%s', getDeclarationErrorAddendum(component)) : undefined;
}
if (!component) {
return;
}
ReactUpdateQueue.enqueueReplacePropsInternal(component, partialProps);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(component, callback);
}
}
function friendlyStringify(obj) {
if (typeof obj === 'object') {
if (Array.isArray(obj)) {
return '[' + obj.map(friendlyStringify).join(', ') + ']';
} else {
var pairs = [];
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) {
var keyEscaped = /^[a-z$_][\w$_]*$/i.test(key) ? key : JSON.stringify(key);
pairs.push(keyEscaped + ': ' + friendlyStringify(obj[key]));
}
}
return '{' + pairs.join(', ') + '}';
}
} else if (typeof obj === 'string') {
return JSON.stringify(obj);
} else if (typeof obj === 'function') {
return '[function object]';
}
// Differs from JSON.stringify in that undefined becauses undefined and that
// inf and nan don't become null
return String(obj);
}
var styleMutationWarning = {};
function checkAndWarnForMutatedStyle(style1, style2, component) {
if (style1 == null || style2 == null) {
return;
}
if (shallowEqual(style1, style2)) {
return;
}
var componentName = component._tag;
var owner = component._currentElement._owner;
var ownerName;
if (owner) {
ownerName = owner.getName();
}
var hash = ownerName + '|' + componentName;
if (styleMutationWarning.hasOwnProperty(hash)) {
return;
}
styleMutationWarning[hash] = true;
"development" !== 'production' ? warning(false, '`%s` was passed a style object that has previously been mutated. ' + 'Mutating `style` is deprecated. Consider cloning it beforehand. Check ' + 'the `render` %s. Previous style: %s. Mutated style: %s.', componentName, owner ? 'of `' + ownerName + '`' : 'using <' + componentName + '>', friendlyStringify(style1), friendlyStringify(style2)) : undefined;
}
/**
* @param {object} component
* @param {?object} props
*/
function assertValidProps(component, props) {
if (!props) {
return;
}
// Note the use of `==` which checks for null or undefined.
if ("development" !== 'production') {
if (voidElementTags[component._tag]) {
"development" !== 'production' ? warning(props.children == null && props.dangerouslySetInnerHTML == null, '%s is a void element tag and must not have `children` or ' + 'use `props.dangerouslySetInnerHTML`.%s', component._tag, component._currentElement._owner ? ' Check the render method of ' + component._currentElement._owner.getName() + '.' : '') : undefined;
}
}
if (props.dangerouslySetInnerHTML != null) {
!(props.children == null) ? "development" !== 'production' ? invariant(false, 'Can only set one of `children` or `props.dangerouslySetInnerHTML`.') : invariant(false) : undefined;
!(typeof props.dangerouslySetInnerHTML === 'object' && '__html' in props.dangerouslySetInnerHTML) ? "development" !== 'production' ? invariant(false, '`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://fb.me/react-invariant-dangerously-set-inner-html ' + 'for more information.') : invariant(false) : undefined;
}
if ("development" !== 'production') {
"development" !== 'production' ? warning(props.innerHTML == null, 'Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.') : undefined;
"development" !== 'production' ? warning(!props.contentEditable || props.children == null, 'A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.') : undefined;
}
!(props.style == null || typeof props.style === 'object') ? "development" !== 'production' ? invariant(false, 'The `style` prop expects a mapping from style properties to values, ' + 'not a string. For example, style={{marginRight: spacing + \'em\'}} when ' + 'using JSX.%s', getDeclarationErrorAddendum(component)) : invariant(false) : undefined;
}
function enqueuePutListener(id, registrationName, listener, transaction) {
if ("development" !== 'production') {
// IE8 has no API for event capturing and the `onScroll` event doesn't
// bubble.
"development" !== 'production' ? warning(registrationName !== 'onScroll' || isEventSupported('scroll', true), 'This browser doesn\'t support the `onScroll` event') : undefined;
}
var container = ReactMount.findReactContainerForID(id);
if (container) {
var doc = container.nodeType === ELEMENT_NODE_TYPE ? container.ownerDocument : container;
listenTo(registrationName, doc);
}
transaction.getReactMountReady().enqueue(putListener, {
id: id,
registrationName: registrationName,
listener: listener
});
}
function putListener() {
var listenerToPut = this;
ReactBrowserEventEmitter.putListener(listenerToPut.id, listenerToPut.registrationName, listenerToPut.listener);
}
// There are so many media events, it makes sense to just
// maintain a list rather than create a `trapBubbledEvent` for each
var mediaEvents = {
topAbort: 'abort',
topCanPlay: 'canplay',
topCanPlayThrough: 'canplaythrough',
topDurationChange: 'durationchange',
topEmptied: 'emptied',
topEncrypted: 'encrypted',
topEnded: 'ended',
topError: 'error',
topLoadedData: 'loadeddata',
topLoadedMetadata: 'loadedmetadata',
topLoadStart: 'loadstart',
topPause: 'pause',
topPlay: 'play',
topPlaying: 'playing',
topProgress: 'progress',
topRateChange: 'ratechange',
topSeeked: 'seeked',
topSeeking: 'seeking',
topStalled: 'stalled',
topSuspend: 'suspend',
topTimeUpdate: 'timeupdate',
topVolumeChange: 'volumechange',
topWaiting: 'waiting'
};
function trapBubbledEventsLocal() {
var inst = this;
// If a component renders to null or if another component fatals and causes
// the state of the tree to be corrupted, `node` here can be null.
!inst._rootNodeID ? "development" !== 'production' ? invariant(false, 'Must be mounted to trap events') : invariant(false) : undefined;
var node = ReactMount.getNode(inst._rootNodeID);
!node ? "development" !== 'production' ? invariant(false, 'trapBubbledEvent(...): Requires node to be rendered.') : invariant(false) : undefined;
switch (inst._tag) {
case 'iframe':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
break;
case 'video':
case 'audio':
inst._wrapperState.listeners = [];
// create listener for each media event
for (var event in mediaEvents) {
if (mediaEvents.hasOwnProperty(event)) {
inst._wrapperState.listeners.push(ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes[event], mediaEvents[event], node));
}
}
break;
case 'img':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topError, 'error', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topLoad, 'load', node)];
break;
case 'form':
inst._wrapperState.listeners = [ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topReset, 'reset', node), ReactBrowserEventEmitter.trapBubbledEvent(EventConstants.topLevelTypes.topSubmit, 'submit', node)];
break;
}
}
function mountReadyInputWrapper() {
ReactDOMInput.mountReadyWrapper(this);
}
function postUpdateSelectWrapper() {
ReactDOMSelect.postUpdateWrapper(this);
}
// For HTML, certain tags should omit their close tag. We keep a whitelist for
// those special cased tags.
var omittedCloseTags = {
'area': true,
'base': true,
'br': true,
'col': true,
'embed': true,
'hr': true,
'img': true,
'input': true,
'keygen': true,
'link': true,
'meta': true,
'param': true,
'source': true,
'track': true,
'wbr': true
};
// NOTE: menuitem's close tag should be omitted, but that causes problems.
var newlineEatingTags = {
'listing': true,
'pre': true,
'textarea': true
};
// For HTML, certain tags cannot have children. This has the same purpose as
// `omittedCloseTags` except that `menuitem` should still have its closing tag.
var voidElementTags = assign({
'menuitem': true
}, omittedCloseTags);
// We accept any tag to be rendered but since this gets injected into arbitrary
// HTML, we want to make sure that it's a safe tag.
// http://www.w3.org/TR/REC-xml/#NT-Name
var VALID_TAG_REGEX = /^[a-zA-Z][a-zA-Z:_\.\-\d]*$/; // Simplified subset
var validatedTagCache = {};
var hasOwnProperty = ({}).hasOwnProperty;
function validateDangerousTag(tag) {
if (!hasOwnProperty.call(validatedTagCache, tag)) {
!VALID_TAG_REGEX.test(tag) ? "development" !== 'production' ? invariant(false, 'Invalid tag: %s', tag) : invariant(false) : undefined;
validatedTagCache[tag] = true;
}
}
function processChildContextDev(context, inst) {
// Pass down our tag name to child components for validation purposes
context = assign({}, context);
var info = context[validateDOMNesting.ancestorInfoContextKey];
context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(info, inst._tag, inst);
return context;
}
function isCustomComponent(tagName, props) {
return tagName.indexOf('-') >= 0 || props.is != null;
}
/**
* Creates a new React class that is idempotent and capable of containing other
* React components. It accepts event listeners and DOM properties that are
* valid according to `DOMProperty`.
*
* - Event listeners: `onClick`, `onMouseDown`, etc.
* - DOM properties: `className`, `name`, `title`, etc.
*
* The `style` property functions differently from the DOM API. It accepts an
* object mapping of style properties to values.
*
* @constructor ReactDOMComponent
* @extends ReactMultiChild
*/
function ReactDOMComponent(tag) {
validateDangerousTag(tag);
this._tag = tag.toLowerCase();
this._renderedChildren = null;
this._previousStyle = null;
this._previousStyleCopy = null;
this._rootNodeID = null;
this._wrapperState = null;
this._topLevelWrapper = null;
this._nodeWithLegacyProperties = null;
if ("development" !== 'production') {
this._unprocessedContextDev = null;
this._processedContextDev = null;
}
}
ReactDOMComponent.displayName = 'ReactDOMComponent';
ReactDOMComponent.Mixin = {
construct: function (element) {
this._currentElement = element;
},
/**
* Generates root tag markup then recurses. This method has side effects and
* is not idempotent.
*
* @internal
* @param {string} rootID The root DOM ID for this node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} context
* @return {string} The computed markup.
*/
mountComponent: function (rootID, transaction, context) {
this._rootNodeID = rootID;
var props = this._currentElement.props;
switch (this._tag) {
case 'iframe':
case 'img':
case 'form':
case 'video':
case 'audio':
this._wrapperState = {
listeners: null
};
transaction.getReactMountReady().enqueue(trapBubbledEventsLocal, this);
break;
case 'button':
props = ReactDOMButton.getNativeProps(this, props, context);
break;
case 'input':
ReactDOMInput.mountWrapper(this, props, context);
props = ReactDOMInput.getNativeProps(this, props, context);
break;
case 'option':
ReactDOMOption.mountWrapper(this, props, context);
props = ReactDOMOption.getNativeProps(this, props, context);
break;
case 'select':
ReactDOMSelect.mountWrapper(this, props, context);
props = ReactDOMSelect.getNativeProps(this, props, context);
context = ReactDOMSelect.processChildContext(this, props, context);
break;
case 'textarea':
ReactDOMTextarea.mountWrapper(this, props, context);
props = ReactDOMTextarea.getNativeProps(this, props, context);
break;
}
assertValidProps(this, props);
if ("development" !== 'production') {
if (context[validateDOMNesting.ancestorInfoContextKey]) {
validateDOMNesting(this._tag, this, context[validateDOMNesting.ancestorInfoContextKey]);
}
}
if ("development" !== 'production') {
this._unprocessedContextDev = context;
this._processedContextDev = processChildContextDev(context, this);
context = this._processedContextDev;
}
var mountImage;
if (transaction.useCreateElement) {
var ownerDocument = context[ReactMount.ownerDocumentContextKey];
var el = ownerDocument.createElement(this._currentElement.type);
DOMPropertyOperations.setAttributeForID(el, this._rootNodeID);
// Populate node cache
ReactMount.getID(el);
this._updateDOMProperties({}, props, transaction, el);
this._createInitialChildren(transaction, props, context, el);
mountImage = el;
} else {
var tagOpen = this._createOpenTagMarkupAndPutListeners(transaction, props);
var tagContent = this._createContentMarkup(transaction, props, context);
if (!tagContent && omittedCloseTags[this._tag]) {
mountImage = tagOpen + '/>';
} else {
mountImage = tagOpen + '>' + tagContent + '</' + this._currentElement.type + '>';
}
}
switch (this._tag) {
case 'input':
transaction.getReactMountReady().enqueue(mountReadyInputWrapper, this);
// falls through
case 'button':
case 'select':
case 'textarea':
if (props.autoFocus) {
transaction.getReactMountReady().enqueue(AutoFocusUtils.focusDOMComponent, this);
}
break;
}
return mountImage;
},
/**
* Creates markup for the open tag and all attributes.
*
* This method has side effects because events get registered.
*
* Iterating over object properties is faster than iterating over arrays.
* @see http://jsperf.com/obj-vs-arr-iteration
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} props
* @return {string} Markup of opening tag.
*/
_createOpenTagMarkupAndPutListeners: function (transaction, props) {
var ret = '<' + this._currentElement.type;
for (var propKey in props) {
if (!props.hasOwnProperty(propKey)) {
continue;
}
var propValue = props[propKey];
if (propValue == null) {
continue;
}
if (registrationNameModules.hasOwnProperty(propKey)) {
if (propValue) {
enqueuePutListener(this._rootNodeID, propKey, propValue, transaction);
}
} else {
if (propKey === STYLE) {
if (propValue) {
if ("development" !== 'production') {
// See `_updateDOMProperties`. style block
this._previousStyle = propValue;
}
propValue = this._previousStyleCopy = assign({}, props.style);
}
propValue = CSSPropertyOperations.createMarkupForStyles(propValue);
}
var markup = null;
if (this._tag != null && isCustomComponent(this._tag, props)) {
markup = DOMPropertyOperations.createMarkupForCustomAttribute(propKey, propValue);
} else {
markup = DOMPropertyOperations.createMarkupForProperty(propKey, propValue);
}
if (markup) {
ret += ' ' + markup;
}
}
}
// For static pages, no need to put React ID and checksum. Saves lots of
// bytes.
if (transaction.renderToStaticMarkup) {
return ret;
}
var markupForID = DOMPropertyOperations.createMarkupForID(this._rootNodeID);
return ret + ' ' + markupForID;
},
/**
* Creates markup for the content between the tags.
*
* @private
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} props
* @param {object} context
* @return {string} Content markup.
*/
_createContentMarkup: function (transaction, props, context) {
var ret = '';
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
ret = innerHTML.__html;
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
// TODO: Validate that text is allowed as a child of this node
ret = escapeTextContentForBrowser(contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, context);
ret = mountImages.join('');
}
}
if (newlineEatingTags[this._tag] && ret.charAt(0) === '\n') {
// text/html ignores the first character in these tags if it's a newline
// Prefer to break application/xml over text/html (for now) by adding
// a newline specifically to get eaten by the parser. (Alternately for
// textareas, replacing "^\n" with "\r\n" doesn't get eaten, and the first
// \r is normalized out by HTMLTextAreaElement#value.)
// See: <http://www.w3.org/TR/html-polyglot/#newlines-in-textarea-and-pre>
// See: <http://www.w3.org/TR/html5/syntax.html#element-restrictions>
// See: <http://www.w3.org/TR/html5/syntax.html#newlines>
// See: Parsing of "textarea" "listing" and "pre" elements
// from <http://www.w3.org/TR/html5/syntax.html#parsing-main-inbody>
return '\n' + ret;
} else {
return ret;
}
},
_createInitialChildren: function (transaction, props, context, el) {
// Intentional use of != to avoid catching zero/false.
var innerHTML = props.dangerouslySetInnerHTML;
if (innerHTML != null) {
if (innerHTML.__html != null) {
setInnerHTML(el, innerHTML.__html);
}
} else {
var contentToUse = CONTENT_TYPES[typeof props.children] ? props.children : null;
var childrenToUse = contentToUse != null ? null : props.children;
if (contentToUse != null) {
// TODO: Validate that text is allowed as a child of this node
setTextContent(el, contentToUse);
} else if (childrenToUse != null) {
var mountImages = this.mountChildren(childrenToUse, transaction, context);
for (var i = 0; i < mountImages.length; i++) {
el.appendChild(mountImages[i]);
}
}
}
},
/**
* Receives a next element and updates the component.
*
* @internal
* @param {ReactElement} nextElement
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @param {object} context
*/
receiveComponent: function (nextElement, transaction, context) {
var prevElement = this._currentElement;
this._currentElement = nextElement;
this.updateComponent(transaction, prevElement, nextElement, context);
},
/**
* Updates a native DOM component after it has already been allocated and
* attached to the DOM. Reconciles the root DOM node, then recurses.
*
* @param {ReactReconcileTransaction} transaction
* @param {ReactElement} prevElement
* @param {ReactElement} nextElement
* @internal
* @overridable
*/
updateComponent: function (transaction, prevElement, nextElement, context) {
var lastProps = prevElement.props;
var nextProps = this._currentElement.props;
switch (this._tag) {
case 'button':
lastProps = ReactDOMButton.getNativeProps(this, lastProps);
nextProps = ReactDOMButton.getNativeProps(this, nextProps);
break;
case 'input':
ReactDOMInput.updateWrapper(this);
lastProps = ReactDOMInput.getNativeProps(this, lastProps);
nextProps = ReactDOMInput.getNativeProps(this, nextProps);
break;
case 'option':
lastProps = ReactDOMOption.getNativeProps(this, lastProps);
nextProps = ReactDOMOption.getNativeProps(this, nextProps);
break;
case 'select':
lastProps = ReactDOMSelect.getNativeProps(this, lastProps);
nextProps = ReactDOMSelect.getNativeProps(this, nextProps);
break;
case 'textarea':
ReactDOMTextarea.updateWrapper(this);
lastProps = ReactDOMTextarea.getNativeProps(this, lastProps);
nextProps = ReactDOMTextarea.getNativeProps(this, nextProps);
break;
}
if ("development" !== 'production') {
// If the context is reference-equal to the old one, pass down the same
// processed object so the update bailout in ReactReconciler behaves
// correctly (and identically in dev and prod). See #5005.
if (this._unprocessedContextDev !== context) {
this._unprocessedContextDev = context;
this._processedContextDev = processChildContextDev(context, this);
}
context = this._processedContextDev;
}
assertValidProps(this, nextProps);
this._updateDOMProperties(lastProps, nextProps, transaction, null);
this._updateDOMChildren(lastProps, nextProps, transaction, context);
if (!canDefineProperty && this._nodeWithLegacyProperties) {
this._nodeWithLegacyProperties.props = nextProps;
}
if (this._tag === 'select') {
// <select> value update needs to occur after <option> children
// reconciliation
transaction.getReactMountReady().enqueue(postUpdateSelectWrapper, this);
}
},
/**
* Reconciles the properties by detecting differences in property values and
* updating the DOM as necessary. This function is probably the single most
* critical path for performance optimization.
*
* TODO: Benchmark whether checking for changed values in memory actually
* improves performance (especially statically positioned elements).
* TODO: Benchmark the effects of putting this at the top since 99% of props
* do not change for a given reconciliation.
* TODO: Benchmark areas that can be improved with caching.
*
* @private
* @param {object} lastProps
* @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
* @param {?DOMElement} node
*/
_updateDOMProperties: function (lastProps, nextProps, transaction, node) {
var propKey;
var styleName;
var styleUpdates;
for (propKey in lastProps) {
if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey)) {
continue;
}
if (propKey === STYLE) {
var lastStyle = this._previousStyleCopy;
for (styleName in lastStyle) {
if (lastStyle.hasOwnProperty(styleName)) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
this._previousStyleCopy = null;
} else if (registrationNameModules.hasOwnProperty(propKey)) {
if (lastProps[propKey]) {
// Only call deleteListener if there was a listener previously or
// else willDeleteListener gets called when there wasn't actually a
// listener (e.g., onClick={null})
deleteListener(this._rootNodeID, propKey);
}
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
for (propKey in nextProps) {
var nextProp = nextProps[propKey];
var lastProp = propKey === STYLE ? this._previousStyleCopy : lastProps[propKey];
if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp) {
continue;
}
if (propKey === STYLE) {
if (nextProp) {
if ("development" !== 'production') {
checkAndWarnForMutatedStyle(this._previousStyleCopy, this._previousStyle, this);
this._previousStyle = nextProp;
}
nextProp = this._previousStyleCopy = assign({}, nextProp);
} else {
this._previousStyleCopy = null;
}
if (lastProp) {
// Unset styles on `lastProp` but not on `nextProp`.
for (styleName in lastProp) {
if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = '';
}
}
// Update styles that changed since `lastProp`.
for (styleName in nextProp) {
if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) {
styleUpdates = styleUpdates || {};
styleUpdates[styleName] = nextProp[styleName];
}
}
} else {
// Relies on `updateStylesByID` not mutating `styleUpdates`.
styleUpdates = nextProp;
}
} else if (registrationNameModules.hasOwnProperty(propKey)) {
if (nextProp) {
enqueuePutListener(this._rootNodeID, propKey, nextProp, transaction);
} else if (lastProp) {
deleteListener(this._rootNodeID, propKey);
}
} else if (isCustomComponent(this._tag, nextProps)) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
DOMPropertyOperations.setValueForAttribute(node, propKey, nextProp);
} else if (DOMProperty.properties[propKey] || DOMProperty.isCustomAttribute(propKey)) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (nextProp != null) {
DOMPropertyOperations.setValueForProperty(node, propKey, nextProp);
} else {
DOMPropertyOperations.deleteValueForProperty(node, propKey);
}
}
}
if (styleUpdates) {
if (!node) {
node = ReactMount.getNode(this._rootNodeID);
}
CSSPropertyOperations.setValueForStyles(node, styleUpdates);
}
},
/**
* Reconciles the children with the various properties that affect the
* children content.
*
* @param {object} lastProps
* @param {object} nextProps
* @param {ReactReconcileTransaction} transaction
* @param {object} context
*/
_updateDOMChildren: function (lastProps, nextProps, transaction, context) {
var lastContent = CONTENT_TYPES[typeof lastProps.children] ? lastProps.children : null;
var nextContent = CONTENT_TYPES[typeof nextProps.children] ? nextProps.children : null;
var lastHtml = lastProps.dangerouslySetInnerHTML && lastProps.dangerouslySetInnerHTML.__html;
var nextHtml = nextProps.dangerouslySetInnerHTML && nextProps.dangerouslySetInnerHTML.__html;
// Note the use of `!=` which checks for null or undefined.
var lastChildren = lastContent != null ? null : lastProps.children;
var nextChildren = nextContent != null ? null : nextProps.children;
// If we're switching from children to content/html or vice versa, remove
// the old content
var lastHasContentOrHtml = lastContent != null || lastHtml != null;
var nextHasContentOrHtml = nextContent != null || nextHtml != null;
if (lastChildren != null && nextChildren == null) {
this.updateChildren(null, transaction, context);
} else if (lastHasContentOrHtml && !nextHasContentOrHtml) {
this.updateTextContent('');
}
if (nextContent != null) {
if (lastContent !== nextContent) {
this.updateTextContent('' + nextContent);
}
} else if (nextHtml != null) {
if (lastHtml !== nextHtml) {
this.updateMarkup('' + nextHtml);
}
} else if (nextChildren != null) {
this.updateChildren(nextChildren, transaction, context);
}
},
/**
* Destroys all event registrations for this instance. Does not remove from
* the DOM. That must be done by the parent.
*
* @internal
*/
unmountComponent: function () {
switch (this._tag) {
case 'iframe':
case 'img':
case 'form':
case 'video':
case 'audio':
var listeners = this._wrapperState.listeners;
if (listeners) {
for (var i = 0; i < listeners.length; i++) {
listeners[i].remove();
}
}
break;
case 'input':
ReactDOMInput.unmountWrapper(this);
break;
case 'html':
case 'head':
case 'body':
/**
* Components like <html> <head> and <body> can't be removed or added
* easily in a cross-browser way, however it's valuable to be able to
* take advantage of React's reconciliation for styling and <title>
* management. So we just document it and throw in dangerous cases.
*/
!false ? "development" !== 'production' ? invariant(false, '<%s> tried to unmount. Because of cross-browser quirks it is ' + 'impossible to unmount some top-level components (eg <html>, ' + '<head>, and <body>) reliably and efficiently. To fix this, have a ' + 'single top-level component that never unmounts render these ' + 'elements.', this._tag) : invariant(false) : undefined;
break;
}
this.unmountChildren();
ReactBrowserEventEmitter.deleteAllListeners(this._rootNodeID);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
this._wrapperState = null;
if (this._nodeWithLegacyProperties) {
var node = this._nodeWithLegacyProperties;
node._reactInternalComponent = null;
this._nodeWithLegacyProperties = null;
}
},
getPublicInstance: function () {
if (!this._nodeWithLegacyProperties) {
var node = ReactMount.getNode(this._rootNodeID);
node._reactInternalComponent = this;
node.getDOMNode = legacyGetDOMNode;
node.isMounted = legacyIsMounted;
node.setState = legacySetStateEtc;
node.replaceState = legacySetStateEtc;
node.forceUpdate = legacySetStateEtc;
node.setProps = legacySetProps;
node.replaceProps = legacyReplaceProps;
if ("development" !== 'production') {
if (canDefineProperty) {
Object.defineProperties(node, legacyPropsDescriptor);
} else {
// updateComponent will update this property on subsequent renders
node.props = this._currentElement.props;
}
} else {
// updateComponent will update this property on subsequent renders
node.props = this._currentElement.props;
}
this._nodeWithLegacyProperties = node;
}
return this._nodeWithLegacyProperties;
}
};
ReactPerf.measureMethods(ReactDOMComponent, 'ReactDOMComponent', {
mountComponent: 'mountComponent',
updateComponent: 'updateComponent'
});
assign(ReactDOMComponent.prototype, ReactDOMComponent.Mixin, ReactMultiChild.Mixin);
module.exports = ReactDOMComponent;
},{"10":10,"11":11,"120":120,"132":132,"137":137,"138":138,"143":143,"15":15,"160":160,"165":165,"170":170,"172":172,"2":2,"24":24,"28":28,"35":35,"41":41,"46":46,"47":47,"48":48,"5":5,"52":52,"72":72,"73":73,"78":78,"95":95}],43:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMFactories
* @typechecks static-only
*/
'use strict';
var ReactElement = _dereq_(57);
var ReactElementValidator = _dereq_(58);
var mapObject = _dereq_(166);
/**
* Create a factory that creates HTML tag elements.
*
* @param {string} tag Tag name (e.g. `div`).
* @private
*/
function createDOMFactory(tag) {
if ("development" !== 'production') {
return ReactElementValidator.createFactory(tag);
}
return ReactElement.createFactory(tag);
}
/**
* Creates a mapping from supported HTML tags to `ReactDOMComponent` classes.
* This is also accessible via `React.DOM`.
*
* @public
*/
var ReactDOMFactories = mapObject({
a: 'a',
abbr: 'abbr',
address: 'address',
area: 'area',
article: 'article',
aside: 'aside',
audio: 'audio',
b: 'b',
base: 'base',
bdi: 'bdi',
bdo: 'bdo',
big: 'big',
blockquote: 'blockquote',
body: 'body',
br: 'br',
button: 'button',
canvas: 'canvas',
caption: 'caption',
cite: 'cite',
code: 'code',
col: 'col',
colgroup: 'colgroup',
data: 'data',
datalist: 'datalist',
dd: 'dd',
del: 'del',
details: 'details',
dfn: 'dfn',
dialog: 'dialog',
div: 'div',
dl: 'dl',
dt: 'dt',
em: 'em',
embed: 'embed',
fieldset: 'fieldset',
figcaption: 'figcaption',
figure: 'figure',
footer: 'footer',
form: 'form',
h1: 'h1',
h2: 'h2',
h3: 'h3',
h4: 'h4',
h5: 'h5',
h6: 'h6',
head: 'head',
header: 'header',
hgroup: 'hgroup',
hr: 'hr',
html: 'html',
i: 'i',
iframe: 'iframe',
img: 'img',
input: 'input',
ins: 'ins',
kbd: 'kbd',
keygen: 'keygen',
label: 'label',
legend: 'legend',
li: 'li',
link: 'link',
main: 'main',
map: 'map',
mark: 'mark',
menu: 'menu',
menuitem: 'menuitem',
meta: 'meta',
meter: 'meter',
nav: 'nav',
noscript: 'noscript',
object: 'object',
ol: 'ol',
optgroup: 'optgroup',
option: 'option',
output: 'output',
p: 'p',
param: 'param',
picture: 'picture',
pre: 'pre',
progress: 'progress',
q: 'q',
rp: 'rp',
rt: 'rt',
ruby: 'ruby',
s: 's',
samp: 'samp',
script: 'script',
section: 'section',
select: 'select',
small: 'small',
source: 'source',
span: 'span',
strong: 'strong',
style: 'style',
sub: 'sub',
summary: 'summary',
sup: 'sup',
table: 'table',
tbody: 'tbody',
td: 'td',
textarea: 'textarea',
tfoot: 'tfoot',
th: 'th',
thead: 'thead',
time: 'time',
title: 'title',
tr: 'tr',
track: 'track',
u: 'u',
ul: 'ul',
'var': 'var',
video: 'video',
wbr: 'wbr',
// SVG
circle: 'circle',
clipPath: 'clipPath',
defs: 'defs',
ellipse: 'ellipse',
g: 'g',
image: 'image',
line: 'line',
linearGradient: 'linearGradient',
mask: 'mask',
path: 'path',
pattern: 'pattern',
polygon: 'polygon',
polyline: 'polyline',
radialGradient: 'radialGradient',
rect: 'rect',
stop: 'stop',
svg: 'svg',
text: 'text',
tspan: 'tspan'
}, createDOMFactory);
module.exports = ReactDOMFactories;
},{"166":166,"57":57,"58":58}],44:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMFeatureFlags
*/
'use strict';
var ReactDOMFeatureFlags = {
useCreateElement: false
};
module.exports = ReactDOMFeatureFlags;
},{}],45:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMIDOperations
* @typechecks static-only
*/
'use strict';
var DOMChildrenOperations = _dereq_(9);
var DOMPropertyOperations = _dereq_(11);
var ReactMount = _dereq_(72);
var ReactPerf = _dereq_(78);
var invariant = _dereq_(160);
/**
* Errors for properties that should not be updated with `updatePropertyByID()`.
*
* @type {object}
* @private
*/
var INVALID_PROPERTY_ERRORS = {
dangerouslySetInnerHTML: '`dangerouslySetInnerHTML` must be set using `updateInnerHTMLByID()`.',
style: '`style` must be set using `updateStylesByID()`.'
};
/**
* Operations used to process updates to DOM nodes.
*/
var ReactDOMIDOperations = {
/**
* Updates a DOM node with new property values. This should only be used to
* update DOM properties in `DOMProperty`.
*
* @param {string} id ID of the node to update.
* @param {string} name A valid property name, see `DOMProperty`.
* @param {*} value New value of the property.
* @internal
*/
updatePropertyByID: function (id, name, value) {
var node = ReactMount.getNode(id);
!!INVALID_PROPERTY_ERRORS.hasOwnProperty(name) ? "development" !== 'production' ? invariant(false, 'updatePropertyByID(...): %s', INVALID_PROPERTY_ERRORS[name]) : invariant(false) : undefined;
// If we're updating to null or undefined, we should remove the property
// from the DOM node instead of inadvertantly setting to a string. This
// brings us in line with the same behavior we have on initial render.
if (value != null) {
DOMPropertyOperations.setValueForProperty(node, name, value);
} else {
DOMPropertyOperations.deleteValueForProperty(node, name);
}
},
/**
* Replaces a DOM node that exists in the document with markup.
*
* @param {string} id ID of child to be replaced.
* @param {string} markup Dangerous markup to inject in place of child.
* @internal
* @see {Danger.dangerouslyReplaceNodeWithMarkup}
*/
dangerouslyReplaceNodeWithMarkupByID: function (id, markup) {
var node = ReactMount.getNode(id);
DOMChildrenOperations.dangerouslyReplaceNodeWithMarkup(node, markup);
},
/**
* Updates a component's children by processing a series of updates.
*
* @param {array<object>} updates List of update configurations.
* @param {array<string>} markup List of markup strings.
* @internal
*/
dangerouslyProcessChildrenUpdates: function (updates, markup) {
for (var i = 0; i < updates.length; i++) {
updates[i].parentNode = ReactMount.getNode(updates[i].parentID);
}
DOMChildrenOperations.processUpdates(updates, markup);
}
};
ReactPerf.measureMethods(ReactDOMIDOperations, 'ReactDOMIDOperations', {
dangerouslyReplaceNodeWithMarkupByID: 'dangerouslyReplaceNodeWithMarkupByID',
dangerouslyProcessChildrenUpdates: 'dangerouslyProcessChildrenUpdates'
});
module.exports = ReactDOMIDOperations;
},{"11":11,"160":160,"72":72,"78":78,"9":9}],46:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMInput
*/
'use strict';
var ReactDOMIDOperations = _dereq_(45);
var LinkedValueUtils = _dereq_(23);
var ReactMount = _dereq_(72);
var ReactUpdates = _dereq_(96);
var assign = _dereq_(24);
var invariant = _dereq_(160);
var instancesByReactID = {};
function forceUpdateIfMounted() {
if (this._rootNodeID) {
// DOM component is still mounted; update
ReactDOMInput.updateWrapper(this);
}
}
/**
* Implements an <input> native component that allows setting these optional
* props: `checked`, `value`, `defaultChecked`, and `defaultValue`.
*
* If `checked` or `value` are not supplied (or null/undefined), user actions
* that affect the checked state or value will trigger updates to the element.
*
* If they are supplied (and not null/undefined), the rendered element will not
* trigger updates to the element. Instead, the props must change in order for
* the rendered element to be updated.
*
* The rendered element will be initialized as unchecked (or `defaultChecked`)
* with an empty value (or `defaultValue`).
*
* @see http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html
*/
var ReactDOMInput = {
getNativeProps: function (inst, props, context) {
var value = LinkedValueUtils.getValue(props);
var checked = LinkedValueUtils.getChecked(props);
var nativeProps = assign({}, props, {
defaultChecked: undefined,
defaultValue: undefined,
value: value != null ? value : inst._wrapperState.initialValue,
checked: checked != null ? checked : inst._wrapperState.initialChecked,
onChange: inst._wrapperState.onChange
});
return nativeProps;
},
mountWrapper: function (inst, props) {
if ("development" !== 'production') {
LinkedValueUtils.checkPropTypes('input', props, inst._currentElement._owner);
}
var defaultValue = props.defaultValue;
inst._wrapperState = {
initialChecked: props.defaultChecked || false,
initialValue: defaultValue != null ? defaultValue : null,
onChange: _handleChange.bind(inst)
};
},
mountReadyWrapper: function (inst) {
// Can't be in mountWrapper or else server rendering leaks.
instancesByReactID[inst._rootNodeID] = inst;
},
unmountWrapper: function (inst) {
delete instancesByReactID[inst._rootNodeID];
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
// TODO: Shouldn't this be getChecked(props)?
var checked = props.checked;
if (checked != null) {
ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'checked', checked || false);
}
var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
// Here we use asap to wait until all updates have propagated, which
// is important when using controlled components within layers:
// https://github.com/facebook/react/issues/1698
ReactUpdates.asap(forceUpdateIfMounted, this);
var name = props.name;
if (props.type === 'radio' && name != null) {
var rootNode = ReactMount.getNode(this._rootNodeID);
var queryRoot = rootNode;
while (queryRoot.parentNode) {
queryRoot = queryRoot.parentNode;
}
// If `rootNode.form` was non-null, then we could try `form.elements`,
// but that sometimes behaves strangely in IE8. We could also try using
// `form.getElementsByName`, but that will only return direct children
// and won't include inputs that use the HTML5 `form=` attribute. Since
// the input might not even be in a form, let's just use the global
// `querySelectorAll` to ensure we don't miss anything.
var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]');
for (var i = 0; i < group.length; i++) {
var otherNode = group[i];
if (otherNode === rootNode || otherNode.form !== rootNode.form) {
continue;
}
// This will throw if radio buttons rendered by different copies of React
// and the same name are rendered into the same form (same as #1939).
// That's probably okay; we don't support it just as we don't support
// mixing React with non-React.
var otherID = ReactMount.getID(otherNode);
!otherID ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.') : invariant(false) : undefined;
var otherInstance = instancesByReactID[otherID];
!otherInstance ? "development" !== 'production' ? invariant(false, 'ReactDOMInput: Unknown radio button ID %s.', otherID) : invariant(false) : undefined;
// If this is a controlled radio button group, forcing the input that
// was previously checked to update will cause it to be come re-checked
// as appropriate.
ReactUpdates.asap(forceUpdateIfMounted, otherInstance);
}
}
return returnValue;
}
module.exports = ReactDOMInput;
},{"160":160,"23":23,"24":24,"45":45,"72":72,"96":96}],47:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMOption
*/
'use strict';
var ReactChildren = _dereq_(32);
var ReactDOMSelect = _dereq_(48);
var assign = _dereq_(24);
var warning = _dereq_(172);
var valueContextKey = ReactDOMSelect.valueContextKey;
/**
* Implements an <option> native component that warns when `selected` is set.
*/
var ReactDOMOption = {
mountWrapper: function (inst, props, context) {
// TODO (yungsters): Remove support for `selected` in <option>.
if ("development" !== 'production') {
"development" !== 'production' ? warning(props.selected == null, 'Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.') : undefined;
}
// Look up whether this option is 'selected' via context
var selectValue = context[valueContextKey];
// If context key is null (e.g., no specified value or after initial mount)
// or missing (e.g., for <datalist>), we don't change props.selected
var selected = null;
if (selectValue != null) {
selected = false;
if (Array.isArray(selectValue)) {
// multiple
for (var i = 0; i < selectValue.length; i++) {
if ('' + selectValue[i] === '' + props.value) {
selected = true;
break;
}
}
} else {
selected = '' + selectValue === '' + props.value;
}
}
inst._wrapperState = { selected: selected };
},
getNativeProps: function (inst, props, context) {
var nativeProps = assign({ selected: undefined, children: undefined }, props);
// Read state only from initial mount because <select> updates value
// manually; we need the initial state only for server rendering
if (inst._wrapperState.selected != null) {
nativeProps.selected = inst._wrapperState.selected;
}
var content = '';
// Flatten children and warn if they aren't strings or numbers;
// invalid types are ignored.
ReactChildren.forEach(props.children, function (child) {
if (child == null) {
return;
}
if (typeof child === 'string' || typeof child === 'number') {
content += child;
} else {
"development" !== 'production' ? warning(false, 'Only strings and numbers are supported as <option> children.') : undefined;
}
});
nativeProps.children = content;
return nativeProps;
}
};
module.exports = ReactDOMOption;
},{"172":172,"24":24,"32":32,"48":48}],48:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMSelect
*/
'use strict';
var LinkedValueUtils = _dereq_(23);
var ReactMount = _dereq_(72);
var ReactUpdates = _dereq_(96);
var assign = _dereq_(24);
var warning = _dereq_(172);
var valueContextKey = '__ReactDOMSelect_value$' + Math.random().toString(36).slice(2);
function updateOptionsIfPendingUpdateAndMounted() {
if (this._rootNodeID && this._wrapperState.pendingUpdate) {
this._wrapperState.pendingUpdate = false;
var props = this._currentElement.props;
var value = LinkedValueUtils.getValue(props);
if (value != null) {
updateOptions(this, props, value);
}
}
}
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
var valuePropNames = ['value', 'defaultValue'];
/**
* Validation function for `value` and `defaultValue`.
* @private
*/
function checkSelectPropTypes(inst, props) {
var owner = inst._currentElement._owner;
LinkedValueUtils.checkPropTypes('select', props, owner);
for (var i = 0; i < valuePropNames.length; i++) {
var propName = valuePropNames[i];
if (props[propName] == null) {
continue;
}
if (props.multiple) {
"development" !== 'production' ? warning(Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
} else {
"development" !== 'production' ? warning(!Array.isArray(props[propName]), 'The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum(owner)) : undefined;
}
}
}
/**
* @param {ReactDOMComponent} inst
* @param {boolean} multiple
* @param {*} propValue A stringable (with `multiple`, a list of stringables).
* @private
*/
function updateOptions(inst, multiple, propValue) {
var selectedValue, i;
var options = ReactMount.getNode(inst._rootNodeID).options;
if (multiple) {
selectedValue = {};
for (i = 0; i < propValue.length; i++) {
selectedValue['' + propValue[i]] = true;
}
for (i = 0; i < options.length; i++) {
var selected = selectedValue.hasOwnProperty(options[i].value);
if (options[i].selected !== selected) {
options[i].selected = selected;
}
}
} else {
// Do not set `select.value` as exact behavior isn't consistent across all
// browsers for all cases.
selectedValue = '' + propValue;
for (i = 0; i < options.length; i++) {
if (options[i].value === selectedValue) {
options[i].selected = true;
return;
}
}
if (options.length) {
options[0].selected = true;
}
}
}
/**
* Implements a <select> native component that allows optionally setting the
* props `value` and `defaultValue`. If `multiple` is false, the prop must be a
* stringable. If `multiple` is true, the prop must be an array of stringables.
*
* If `value` is not supplied (or null/undefined), user actions that change the
* selected option will trigger updates to the rendered options.
*
* If it is supplied (and not null/undefined), the rendered options will not
* update in response to user actions. Instead, the `value` prop must change in
* order for the rendered options to update.
*
* If `defaultValue` is provided, any options with the supplied values will be
* selected.
*/
var ReactDOMSelect = {
valueContextKey: valueContextKey,
getNativeProps: function (inst, props, context) {
return assign({}, props, {
onChange: inst._wrapperState.onChange,
value: undefined
});
},
mountWrapper: function (inst, props) {
if ("development" !== 'production') {
checkSelectPropTypes(inst, props);
}
var value = LinkedValueUtils.getValue(props);
inst._wrapperState = {
pendingUpdate: false,
initialValue: value != null ? value : props.defaultValue,
onChange: _handleChange.bind(inst),
wasMultiple: Boolean(props.multiple)
};
},
processChildContext: function (inst, props, context) {
// Pass down initial value so initial generated markup has correct
// `selected` attributes
var childContext = assign({}, context);
childContext[valueContextKey] = inst._wrapperState.initialValue;
return childContext;
},
postUpdateWrapper: function (inst) {
var props = inst._currentElement.props;
// After the initial mount, we control selected-ness manually so don't pass
// the context value down
inst._wrapperState.initialValue = undefined;
var wasMultiple = inst._wrapperState.wasMultiple;
inst._wrapperState.wasMultiple = Boolean(props.multiple);
var value = LinkedValueUtils.getValue(props);
if (value != null) {
inst._wrapperState.pendingUpdate = false;
updateOptions(inst, Boolean(props.multiple), value);
} else if (wasMultiple !== Boolean(props.multiple)) {
// For simplicity, reapply `defaultValue` if `multiple` is toggled.
if (props.defaultValue != null) {
updateOptions(inst, Boolean(props.multiple), props.defaultValue);
} else {
// Revert the select back to its default unselected state.
updateOptions(inst, Boolean(props.multiple), props.multiple ? [] : '');
}
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
this._wrapperState.pendingUpdate = true;
ReactUpdates.asap(updateOptionsIfPendingUpdateAndMounted, this);
return returnValue;
}
module.exports = ReactDOMSelect;
},{"172":172,"23":23,"24":24,"72":72,"96":96}],49:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMSelection
*/
'use strict';
var ExecutionEnvironment = _dereq_(146);
var getNodeForCharacterOffset = _dereq_(129);
var getTextContentAccessor = _dereq_(130);
/**
* While `isCollapsed` is available on the Selection object and `collapsed`
* is available on the Range object, IE11 sometimes gets them wrong.
* If the anchor/focus nodes and offsets are the same, the range is collapsed.
*/
function isCollapsed(anchorNode, anchorOffset, focusNode, focusOffset) {
return anchorNode === focusNode && anchorOffset === focusOffset;
}
/**
* Get the appropriate anchor and focus node/offset pairs for IE.
*
* The catch here is that IE's selection API doesn't provide information
* about whether the selection is forward or backward, so we have to
* behave as though it's always forward.
*
* IE text differs from modern selection in that it behaves as though
* block elements end with a new line. This means character offsets will
* differ between the two APIs.
*
* @param {DOMElement} node
* @return {object}
*/
function getIEOffsets(node) {
var selection = document.selection;
var selectedRange = selection.createRange();
var selectedLength = selectedRange.text.length;
// Duplicate selection so we can move range without breaking user selection.
var fromStart = selectedRange.duplicate();
fromStart.moveToElementText(node);
fromStart.setEndPoint('EndToStart', selectedRange);
var startOffset = fromStart.text.length;
var endOffset = startOffset + selectedLength;
return {
start: startOffset,
end: endOffset
};
}
/**
* @param {DOMElement} node
* @return {?object}
*/
function getModernOffsets(node) {
var selection = window.getSelection && window.getSelection();
if (!selection || selection.rangeCount === 0) {
return null;
}
var anchorNode = selection.anchorNode;
var anchorOffset = selection.anchorOffset;
var focusNode = selection.focusNode;
var focusOffset = selection.focusOffset;
var currentRange = selection.getRangeAt(0);
// In Firefox, range.startContainer and range.endContainer can be "anonymous
// divs", e.g. the up/down buttons on an <input type="number">. Anonymous
// divs do not seem to expose properties, triggering a "Permission denied
// error" if any of its properties are accessed. The only seemingly possible
// way to avoid erroring is to access a property that typically works for
// non-anonymous divs and catch any error that may otherwise arise. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=208427
try {
/* eslint-disable no-unused-expressions */
currentRange.startContainer.nodeType;
currentRange.endContainer.nodeType;
/* eslint-enable no-unused-expressions */
} catch (e) {
return null;
}
// If the node and offset values are the same, the selection is collapsed.
// `Selection.isCollapsed` is available natively, but IE sometimes gets
// this value wrong.
var isSelectionCollapsed = isCollapsed(selection.anchorNode, selection.anchorOffset, selection.focusNode, selection.focusOffset);
var rangeLength = isSelectionCollapsed ? 0 : currentRange.toString().length;
var tempRange = currentRange.cloneRange();
tempRange.selectNodeContents(node);
tempRange.setEnd(currentRange.startContainer, currentRange.startOffset);
var isTempRangeCollapsed = isCollapsed(tempRange.startContainer, tempRange.startOffset, tempRange.endContainer, tempRange.endOffset);
var start = isTempRangeCollapsed ? 0 : tempRange.toString().length;
var end = start + rangeLength;
// Detect whether the selection is backward.
var detectionRange = document.createRange();
detectionRange.setStart(anchorNode, anchorOffset);
detectionRange.setEnd(focusNode, focusOffset);
var isBackward = detectionRange.collapsed;
return {
start: isBackward ? end : start,
end: isBackward ? start : end
};
}
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setIEOffsets(node, offsets) {
var range = document.selection.createRange().duplicate();
var start, end;
if (typeof offsets.end === 'undefined') {
start = offsets.start;
end = start;
} else if (offsets.start > offsets.end) {
start = offsets.end;
end = offsets.start;
} else {
start = offsets.start;
end = offsets.end;
}
range.moveToElementText(node);
range.moveStart('character', start);
range.setEndPoint('EndToStart', range);
range.moveEnd('character', end - start);
range.select();
}
/**
* In modern non-IE browsers, we can support both forward and backward
* selections.
*
* Note: IE10+ supports the Selection object, but it does not support
* the `extend` method, which means that even in modern IE, it's not possible
* to programatically create a backward selection. Thus, for all IE
* versions, we use the old IE API to create our selections.
*
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
function setModernOffsets(node, offsets) {
if (!window.getSelection) {
return;
}
var selection = window.getSelection();
var length = node[getTextContentAccessor()].length;
var start = Math.min(offsets.start, length);
var end = typeof offsets.end === 'undefined' ? start : Math.min(offsets.end, length);
// IE 11 uses modern selection, but doesn't support the extend method.
// Flip backward selections, so we can set with a single range.
if (!selection.extend && start > end) {
var temp = end;
end = start;
start = temp;
}
var startMarker = getNodeForCharacterOffset(node, start);
var endMarker = getNodeForCharacterOffset(node, end);
if (startMarker && endMarker) {
var range = document.createRange();
range.setStart(startMarker.node, startMarker.offset);
selection.removeAllRanges();
if (start > end) {
selection.addRange(range);
selection.extend(endMarker.node, endMarker.offset);
} else {
range.setEnd(endMarker.node, endMarker.offset);
selection.addRange(range);
}
}
}
var useIEOffsets = ExecutionEnvironment.canUseDOM && 'selection' in document && !('getSelection' in window);
var ReactDOMSelection = {
/**
* @param {DOMElement} node
*/
getOffsets: useIEOffsets ? getIEOffsets : getModernOffsets,
/**
* @param {DOMElement|DOMTextNode} node
* @param {object} offsets
*/
setOffsets: useIEOffsets ? setIEOffsets : setModernOffsets
};
module.exports = ReactDOMSelection;
},{"129":129,"130":130,"146":146}],50:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMServer
*/
'use strict';
var ReactDefaultInjection = _dereq_(54);
var ReactServerRendering = _dereq_(88);
var ReactVersion = _dereq_(97);
ReactDefaultInjection.inject();
var ReactDOMServer = {
renderToString: ReactServerRendering.renderToString,
renderToStaticMarkup: ReactServerRendering.renderToStaticMarkup,
version: ReactVersion
};
module.exports = ReactDOMServer;
},{"54":54,"88":88,"97":97}],51:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMTextComponent
* @typechecks static-only
*/
'use strict';
var DOMChildrenOperations = _dereq_(9);
var DOMPropertyOperations = _dereq_(11);
var ReactComponentBrowserEnvironment = _dereq_(35);
var ReactMount = _dereq_(72);
var assign = _dereq_(24);
var escapeTextContentForBrowser = _dereq_(120);
var setTextContent = _dereq_(138);
var validateDOMNesting = _dereq_(143);
/**
* Text nodes violate a couple assumptions that React makes about components:
*
* - When mounting text into the DOM, adjacent text nodes are merged.
* - Text nodes cannot be assigned a React root ID.
*
* This component is used to wrap strings in elements so that they can undergo
* the same reconciliation that is applied to elements.
*
* TODO: Investigate representing React components in the DOM with text nodes.
*
* @class ReactDOMTextComponent
* @extends ReactComponent
* @internal
*/
var ReactDOMTextComponent = function (props) {
// This constructor and its argument is currently used by mocks.
};
assign(ReactDOMTextComponent.prototype, {
/**
* @param {ReactText} text
* @internal
*/
construct: function (text) {
// TODO: This is really a ReactText (ReactNode), not a ReactElement
this._currentElement = text;
this._stringText = '' + text;
// Properties
this._rootNodeID = null;
this._mountIndex = 0;
},
/**
* Creates the markup for this text node. This node is not intended to have
* any features besides containing text content.
*
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {string} Markup for this text node.
* @internal
*/
mountComponent: function (rootID, transaction, context) {
if ("development" !== 'production') {
if (context[validateDOMNesting.ancestorInfoContextKey]) {
validateDOMNesting('span', null, context[validateDOMNesting.ancestorInfoContextKey]);
}
}
this._rootNodeID = rootID;
if (transaction.useCreateElement) {
var ownerDocument = context[ReactMount.ownerDocumentContextKey];
var el = ownerDocument.createElement('span');
DOMPropertyOperations.setAttributeForID(el, rootID);
// Populate node cache
ReactMount.getID(el);
setTextContent(el, this._stringText);
return el;
} else {
var escapedText = escapeTextContentForBrowser(this._stringText);
if (transaction.renderToStaticMarkup) {
// Normally we'd wrap this in a `span` for the reasons stated above, but
// since this is a situation where React won't take over (static pages),
// we can simply return the text as it is.
return escapedText;
}
return '<span ' + DOMPropertyOperations.createMarkupForID(rootID) + '>' + escapedText + '</span>';
}
},
/**
* Updates this component by updating the text content.
*
* @param {ReactText} nextText The next text content
* @param {ReactReconcileTransaction} transaction
* @internal
*/
receiveComponent: function (nextText, transaction) {
if (nextText !== this._currentElement) {
this._currentElement = nextText;
var nextStringText = '' + nextText;
if (nextStringText !== this._stringText) {
// TODO: Save this as pending props and use performUpdateIfNecessary
// and/or updateComponent to do the actual update for consistency with
// other component types?
this._stringText = nextStringText;
var node = ReactMount.getNode(this._rootNodeID);
DOMChildrenOperations.updateTextContent(node, nextStringText);
}
}
},
unmountComponent: function () {
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
}
});
module.exports = ReactDOMTextComponent;
},{"11":11,"120":120,"138":138,"143":143,"24":24,"35":35,"72":72,"9":9}],52:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDOMTextarea
*/
'use strict';
var LinkedValueUtils = _dereq_(23);
var ReactDOMIDOperations = _dereq_(45);
var ReactUpdates = _dereq_(96);
var assign = _dereq_(24);
var invariant = _dereq_(160);
var warning = _dereq_(172);
function forceUpdateIfMounted() {
if (this._rootNodeID) {
// DOM component is still mounted; update
ReactDOMTextarea.updateWrapper(this);
}
}
/**
* Implements a <textarea> native component that allows setting `value`, and
* `defaultValue`. This differs from the traditional DOM API because value is
* usually set as PCDATA children.
*
* If `value` is not supplied (or null/undefined), user actions that affect the
* value will trigger updates to the element.
*
* If `value` is supplied (and not null/undefined), the rendered element will
* not trigger updates to the element. Instead, the `value` prop must change in
* order for the rendered element to be updated.
*
* The rendered element will be initialized with an empty value, the prop
* `defaultValue` if specified, or the children content (deprecated).
*/
var ReactDOMTextarea = {
getNativeProps: function (inst, props, context) {
!(props.dangerouslySetInnerHTML == null) ? "development" !== 'production' ? invariant(false, '`dangerouslySetInnerHTML` does not make sense on <textarea>.') : invariant(false) : undefined;
// Always set children to the same thing. In IE9, the selection range will
// get reset if `textContent` is mutated.
var nativeProps = assign({}, props, {
defaultValue: undefined,
value: undefined,
children: inst._wrapperState.initialValue,
onChange: inst._wrapperState.onChange
});
return nativeProps;
},
mountWrapper: function (inst, props) {
if ("development" !== 'production') {
LinkedValueUtils.checkPropTypes('textarea', props, inst._currentElement._owner);
}
var defaultValue = props.defaultValue;
// TODO (yungsters): Remove support for children content in <textarea>.
var children = props.children;
if (children != null) {
if ("development" !== 'production') {
"development" !== 'production' ? warning(false, 'Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.') : undefined;
}
!(defaultValue == null) ? "development" !== 'production' ? invariant(false, 'If you supply `defaultValue` on a <textarea>, do not pass children.') : invariant(false) : undefined;
if (Array.isArray(children)) {
!(children.length <= 1) ? "development" !== 'production' ? invariant(false, '<textarea> can only have at most one child.') : invariant(false) : undefined;
children = children[0];
}
defaultValue = '' + children;
}
if (defaultValue == null) {
defaultValue = '';
}
var value = LinkedValueUtils.getValue(props);
inst._wrapperState = {
// We save the initial value so that `ReactDOMComponent` doesn't update
// `textContent` (unnecessary since we update value).
// The initial value can be a boolean or object so that's why it's
// forced to be a string.
initialValue: '' + (value != null ? value : defaultValue),
onChange: _handleChange.bind(inst)
};
},
updateWrapper: function (inst) {
var props = inst._currentElement.props;
var value = LinkedValueUtils.getValue(props);
if (value != null) {
// Cast `value` to a string to ensure the value is set correctly. While
// browsers typically do this as necessary, jsdom doesn't.
ReactDOMIDOperations.updatePropertyByID(inst._rootNodeID, 'value', '' + value);
}
}
};
function _handleChange(event) {
var props = this._currentElement.props;
var returnValue = LinkedValueUtils.executeOnChange(props, event);
ReactUpdates.asap(forceUpdateIfMounted, this);
return returnValue;
}
module.exports = ReactDOMTextarea;
},{"160":160,"172":172,"23":23,"24":24,"45":45,"96":96}],53:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultBatchingStrategy
*/
'use strict';
var ReactUpdates = _dereq_(96);
var Transaction = _dereq_(113);
var assign = _dereq_(24);
var emptyFunction = _dereq_(152);
var RESET_BATCHED_UPDATES = {
initialize: emptyFunction,
close: function () {
ReactDefaultBatchingStrategy.isBatchingUpdates = false;
}
};
var FLUSH_BATCHED_UPDATES = {
initialize: emptyFunction,
close: ReactUpdates.flushBatchedUpdates.bind(ReactUpdates)
};
var TRANSACTION_WRAPPERS = [FLUSH_BATCHED_UPDATES, RESET_BATCHED_UPDATES];
function ReactDefaultBatchingStrategyTransaction() {
this.reinitializeTransaction();
}
assign(ReactDefaultBatchingStrategyTransaction.prototype, Transaction.Mixin, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
}
});
var transaction = new ReactDefaultBatchingStrategyTransaction();
var ReactDefaultBatchingStrategy = {
isBatchingUpdates: false,
/**
* Call the provided function in a context within which calls to `setState`
* and friends are batched such that components aren't updated unnecessarily.
*/
batchedUpdates: function (callback, a, b, c, d, e) {
var alreadyBatchingUpdates = ReactDefaultBatchingStrategy.isBatchingUpdates;
ReactDefaultBatchingStrategy.isBatchingUpdates = true;
// The code is written this way to avoid extra allocations
if (alreadyBatchingUpdates) {
callback(a, b, c, d, e);
} else {
transaction.perform(callback, null, a, b, c, d, e);
}
}
};
module.exports = ReactDefaultBatchingStrategy;
},{"113":113,"152":152,"24":24,"96":96}],54:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultInjection
*/
'use strict';
var BeforeInputEventPlugin = _dereq_(3);
var ChangeEventPlugin = _dereq_(7);
var ClientReactRootIndex = _dereq_(8);
var DefaultEventPluginOrder = _dereq_(13);
var EnterLeaveEventPlugin = _dereq_(14);
var ExecutionEnvironment = _dereq_(146);
var HTMLDOMPropertyConfig = _dereq_(21);
var ReactBrowserComponentMixin = _dereq_(27);
var ReactComponentBrowserEnvironment = _dereq_(35);
var ReactDefaultBatchingStrategy = _dereq_(53);
var ReactDOMComponent = _dereq_(42);
var ReactDOMTextComponent = _dereq_(51);
var ReactEventListener = _dereq_(63);
var ReactInjection = _dereq_(65);
var ReactInstanceHandles = _dereq_(67);
var ReactMount = _dereq_(72);
var ReactReconcileTransaction = _dereq_(83);
var SelectEventPlugin = _dereq_(99);
var ServerReactRootIndex = _dereq_(100);
var SimpleEventPlugin = _dereq_(101);
var SVGDOMPropertyConfig = _dereq_(98);
var alreadyInjected = false;
function inject() {
if (alreadyInjected) {
// TODO: This is currently true because these injections are shared between
// the client and the server package. They should be built independently
// and not share any injection state. Then this problem will be solved.
return;
}
alreadyInjected = true;
ReactInjection.EventEmitter.injectReactEventListener(ReactEventListener);
/**
* Inject modules for resolving DOM hierarchy and plugin ordering.
*/
ReactInjection.EventPluginHub.injectEventPluginOrder(DefaultEventPluginOrder);
ReactInjection.EventPluginHub.injectInstanceHandle(ReactInstanceHandles);
ReactInjection.EventPluginHub.injectMount(ReactMount);
/**
* Some important event plugins included by default (without having to require
* them).
*/
ReactInjection.EventPluginHub.injectEventPluginsByName({
SimpleEventPlugin: SimpleEventPlugin,
EnterLeaveEventPlugin: EnterLeaveEventPlugin,
ChangeEventPlugin: ChangeEventPlugin,
SelectEventPlugin: SelectEventPlugin,
BeforeInputEventPlugin: BeforeInputEventPlugin
});
ReactInjection.NativeComponent.injectGenericComponentClass(ReactDOMComponent);
ReactInjection.NativeComponent.injectTextComponentClass(ReactDOMTextComponent);
ReactInjection.Class.injectMixin(ReactBrowserComponentMixin);
ReactInjection.DOMProperty.injectDOMPropertyConfig(HTMLDOMPropertyConfig);
ReactInjection.DOMProperty.injectDOMPropertyConfig(SVGDOMPropertyConfig);
ReactInjection.EmptyComponent.injectEmptyComponent('noscript');
ReactInjection.Updates.injectReconcileTransaction(ReactReconcileTransaction);
ReactInjection.Updates.injectBatchingStrategy(ReactDefaultBatchingStrategy);
ReactInjection.RootIndex.injectCreateReactRootIndex(ExecutionEnvironment.canUseDOM ? ClientReactRootIndex.createReactRootIndex : ServerReactRootIndex.createReactRootIndex);
ReactInjection.Component.injectEnvironment(ReactComponentBrowserEnvironment);
if ("development" !== 'production') {
var url = ExecutionEnvironment.canUseDOM && window.location.href || '';
if (/[?&]react_perf\b/.test(url)) {
var ReactDefaultPerf = _dereq_(55);
ReactDefaultPerf.start();
}
}
}
module.exports = {
inject: inject
};
},{"100":100,"101":101,"13":13,"14":14,"146":146,"21":21,"27":27,"3":3,"35":35,"42":42,"51":51,"53":53,"55":55,"63":63,"65":65,"67":67,"7":7,"72":72,"8":8,"83":83,"98":98,"99":99}],55:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultPerf
* @typechecks static-only
*/
'use strict';
var DOMProperty = _dereq_(10);
var ReactDefaultPerfAnalysis = _dereq_(56);
var ReactMount = _dereq_(72);
var ReactPerf = _dereq_(78);
var performanceNow = _dereq_(169);
function roundFloat(val) {
return Math.floor(val * 100) / 100;
}
function addValue(obj, key, val) {
obj[key] = (obj[key] || 0) + val;
}
var ReactDefaultPerf = {
_allMeasurements: [], // last item in the list is the current one
_mountStack: [0],
_injected: false,
start: function () {
if (!ReactDefaultPerf._injected) {
ReactPerf.injection.injectMeasure(ReactDefaultPerf.measure);
}
ReactDefaultPerf._allMeasurements.length = 0;
ReactPerf.enableMeasure = true;
},
stop: function () {
ReactPerf.enableMeasure = false;
},
getLastMeasurements: function () {
return ReactDefaultPerf._allMeasurements;
},
printExclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getExclusiveSummary(measurements);
console.table(summary.map(function (item) {
return {
'Component class name': item.componentName,
'Total inclusive time (ms)': roundFloat(item.inclusive),
'Exclusive mount time (ms)': roundFloat(item.exclusive),
'Exclusive render time (ms)': roundFloat(item.render),
'Mount time per instance (ms)': roundFloat(item.exclusive / item.count),
'Render time per instance (ms)': roundFloat(item.render / item.count),
'Instances': item.count
};
}));
// TODO: ReactDefaultPerfAnalysis.getTotalTime() does not return the correct
// number.
},
printInclusive: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements);
console.table(summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Inclusive time (ms)': roundFloat(item.time),
'Instances': item.count
};
}));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
getMeasurementsSummaryMap: function (measurements) {
var summary = ReactDefaultPerfAnalysis.getInclusiveSummary(measurements, true);
return summary.map(function (item) {
return {
'Owner > component': item.componentName,
'Wasted time (ms)': item.time,
'Instances': item.count
};
});
},
printWasted: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
console.table(ReactDefaultPerf.getMeasurementsSummaryMap(measurements));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
printDOM: function (measurements) {
measurements = measurements || ReactDefaultPerf._allMeasurements;
var summary = ReactDefaultPerfAnalysis.getDOMSummary(measurements);
console.table(summary.map(function (item) {
var result = {};
result[DOMProperty.ID_ATTRIBUTE_NAME] = item.id;
result.type = item.type;
result.args = JSON.stringify(item.args);
return result;
}));
console.log('Total time:', ReactDefaultPerfAnalysis.getTotalTime(measurements).toFixed(2) + ' ms');
},
_recordWrite: function (id, fnName, totalTime, args) {
// TODO: totalTime isn't that useful since it doesn't count paints/reflows
var writes = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].writes;
writes[id] = writes[id] || [];
writes[id].push({
type: fnName,
time: totalTime,
args: args
});
},
measure: function (moduleName, fnName, func) {
return function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var totalTime;
var rv;
var start;
if (fnName === '_renderNewRootComponent' || fnName === 'flushBatchedUpdates') {
// A "measurement" is a set of metrics recorded for each flush. We want
// to group the metrics for a given flush together so we can look at the
// components that rendered and the DOM operations that actually
// happened to determine the amount of "wasted work" performed.
ReactDefaultPerf._allMeasurements.push({
exclusive: {},
inclusive: {},
render: {},
counts: {},
writes: {},
displayNames: {},
totalTime: 0,
created: {}
});
start = performanceNow();
rv = func.apply(this, args);
ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1].totalTime = performanceNow() - start;
return rv;
} else if (fnName === '_mountImageIntoNode' || moduleName === 'ReactBrowserEventEmitter' || moduleName === 'ReactDOMIDOperations' || moduleName === 'CSSPropertyOperations' || moduleName === 'DOMChildrenOperations' || moduleName === 'DOMPropertyOperations') {
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (fnName === '_mountImageIntoNode') {
var mountID = ReactMount.getID(args[1]);
ReactDefaultPerf._recordWrite(mountID, fnName, totalTime, args[0]);
} else if (fnName === 'dangerouslyProcessChildrenUpdates') {
// special format
args[0].forEach(function (update) {
var writeArgs = {};
if (update.fromIndex !== null) {
writeArgs.fromIndex = update.fromIndex;
}
if (update.toIndex !== null) {
writeArgs.toIndex = update.toIndex;
}
if (update.textContent !== null) {
writeArgs.textContent = update.textContent;
}
if (update.markupIndex !== null) {
writeArgs.markup = args[1][update.markupIndex];
}
ReactDefaultPerf._recordWrite(update.parentID, update.type, totalTime, writeArgs);
});
} else {
// basic format
var id = args[0];
if (typeof id === 'object') {
id = ReactMount.getID(args[0]);
}
ReactDefaultPerf._recordWrite(id, fnName, totalTime, Array.prototype.slice.call(args, 1));
}
return rv;
} else if (moduleName === 'ReactCompositeComponent' && (fnName === 'mountComponent' || fnName === 'updateComponent' || // TODO: receiveComponent()?
fnName === '_renderValidatedComponent')) {
if (this._currentElement.type === ReactMount.TopLevelWrapper) {
return func.apply(this, args);
}
var rootNodeID = fnName === 'mountComponent' ? args[0] : this._rootNodeID;
var isRender = fnName === '_renderValidatedComponent';
var isMount = fnName === 'mountComponent';
var mountStack = ReactDefaultPerf._mountStack;
var entry = ReactDefaultPerf._allMeasurements[ReactDefaultPerf._allMeasurements.length - 1];
if (isRender) {
addValue(entry.counts, rootNodeID, 1);
} else if (isMount) {
entry.created[rootNodeID] = true;
mountStack.push(0);
}
start = performanceNow();
rv = func.apply(this, args);
totalTime = performanceNow() - start;
if (isRender) {
addValue(entry.render, rootNodeID, totalTime);
} else if (isMount) {
var subMountTime = mountStack.pop();
mountStack[mountStack.length - 1] += totalTime;
addValue(entry.exclusive, rootNodeID, totalTime - subMountTime);
addValue(entry.inclusive, rootNodeID, totalTime);
} else {
addValue(entry.inclusive, rootNodeID, totalTime);
}
entry.displayNames[rootNodeID] = {
current: this.getName(),
owner: this._currentElement._owner ? this._currentElement._owner.getName() : '<root>'
};
return rv;
} else {
return func.apply(this, args);
}
};
}
};
module.exports = ReactDefaultPerf;
},{"10":10,"169":169,"56":56,"72":72,"78":78}],56:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactDefaultPerfAnalysis
*/
'use strict';
var assign = _dereq_(24);
// Don't try to save users less than 1.2ms (a number I made up)
var DONT_CARE_THRESHOLD = 1.2;
var DOM_OPERATION_TYPES = {
'_mountImageIntoNode': 'set innerHTML',
INSERT_MARKUP: 'set innerHTML',
MOVE_EXISTING: 'move',
REMOVE_NODE: 'remove',
SET_MARKUP: 'set innerHTML',
TEXT_CONTENT: 'set textContent',
'setValueForProperty': 'update attribute',
'setValueForAttribute': 'update attribute',
'deleteValueForProperty': 'remove attribute',
'dangerouslyReplaceNodeWithMarkupByID': 'replace'
};
function getTotalTime(measurements) {
// TODO: return number of DOM ops? could be misleading.
// TODO: measure dropped frames after reconcile?
// TODO: log total time of each reconcile and the top-level component
// class that triggered it.
var totalTime = 0;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
totalTime += measurement.totalTime;
}
return totalTime;
}
function getDOMSummary(measurements) {
var items = [];
measurements.forEach(function (measurement) {
Object.keys(measurement.writes).forEach(function (id) {
measurement.writes[id].forEach(function (write) {
items.push({
id: id,
type: DOM_OPERATION_TYPES[write.type] || write.type,
args: write.args
});
});
});
});
return items;
}
function getExclusiveSummary(measurements) {
var candidates = {};
var displayName;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
displayName = measurement.displayNames[id].current;
candidates[displayName] = candidates[displayName] || {
componentName: displayName,
inclusive: 0,
exclusive: 0,
render: 0,
count: 0
};
if (measurement.render[id]) {
candidates[displayName].render += measurement.render[id];
}
if (measurement.exclusive[id]) {
candidates[displayName].exclusive += measurement.exclusive[id];
}
if (measurement.inclusive[id]) {
candidates[displayName].inclusive += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[displayName].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (displayName in candidates) {
if (candidates[displayName].exclusive >= DONT_CARE_THRESHOLD) {
arr.push(candidates[displayName]);
}
}
arr.sort(function (a, b) {
return b.exclusive - a.exclusive;
});
return arr;
}
function getInclusiveSummary(measurements, onlyClean) {
var candidates = {};
var inclusiveKey;
for (var i = 0; i < measurements.length; i++) {
var measurement = measurements[i];
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
var cleanComponents;
if (onlyClean) {
cleanComponents = getUnchangedComponents(measurement);
}
for (var id in allIDs) {
if (onlyClean && !cleanComponents[id]) {
continue;
}
var displayName = measurement.displayNames[id];
// Inclusive time is not useful for many components without knowing where
// they are instantiated. So we aggregate inclusive time with both the
// owner and current displayName as the key.
inclusiveKey = displayName.owner + ' > ' + displayName.current;
candidates[inclusiveKey] = candidates[inclusiveKey] || {
componentName: inclusiveKey,
time: 0,
count: 0
};
if (measurement.inclusive[id]) {
candidates[inclusiveKey].time += measurement.inclusive[id];
}
if (measurement.counts[id]) {
candidates[inclusiveKey].count += measurement.counts[id];
}
}
}
// Now make a sorted array with the results.
var arr = [];
for (inclusiveKey in candidates) {
if (candidates[inclusiveKey].time >= DONT_CARE_THRESHOLD) {
arr.push(candidates[inclusiveKey]);
}
}
arr.sort(function (a, b) {
return b.time - a.time;
});
return arr;
}
function getUnchangedComponents(measurement) {
// For a given reconcile, look at which components did not actually
// render anything to the DOM and return a mapping of their ID to
// the amount of time it took to render the entire subtree.
var cleanComponents = {};
var dirtyLeafIDs = Object.keys(measurement.writes);
var allIDs = assign({}, measurement.exclusive, measurement.inclusive);
for (var id in allIDs) {
var isDirty = false;
// For each component that rendered, see if a component that triggered
// a DOM op is in its subtree.
for (var i = 0; i < dirtyLeafIDs.length; i++) {
if (dirtyLeafIDs[i].indexOf(id) === 0) {
isDirty = true;
break;
}
}
// check if component newly created
if (measurement.created[id]) {
isDirty = true;
}
if (!isDirty && measurement.counts[id] > 0) {
cleanComponents[id] = true;
}
}
return cleanComponents;
}
var ReactDefaultPerfAnalysis = {
getExclusiveSummary: getExclusiveSummary,
getInclusiveSummary: getInclusiveSummary,
getDOMSummary: getDOMSummary,
getTotalTime: getTotalTime
};
module.exports = ReactDefaultPerfAnalysis;
},{"24":24}],57:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactElement
*/
'use strict';
var ReactCurrentOwner = _dereq_(39);
var assign = _dereq_(24);
// The Symbol used to tag the ReactElement type. If there is no native Symbol
// nor polyfill, then a plain number is used for performance.
var REACT_ELEMENT_TYPE = typeof Symbol === 'function' && Symbol['for'] && Symbol['for']('react.element') || 0xeac7;
var RESERVED_PROPS = {
key: true,
ref: true,
__self: true,
__source: true
};
var canDefineProperty = false;
if ("development" !== 'production') {
try {
Object.defineProperty({}, 'x', {});
canDefineProperty = true;
} catch (x) {
// IE will fail on defineProperty
}
}
/**
* Base constructor for all React elements. This is only used to make this
* work with a dynamic instanceof check. Nothing should live on this prototype.
*
* @param {*} type
* @param {*} key
* @param {string|object} ref
* @param {*} self A *temporary* helper to detect places where `this` is
* different from the `owner` when React.createElement is called, so that we
* can warn. We want to get rid of owner and replace string `ref`s with arrow
* functions, and as long as `this` and owner are the same, there will be no
* change in behavior.
* @param {*} source An annotation object (added by a transpiler or otherwise)
* indicating filename, line number, and/or other information.
* @param {*} owner
* @param {*} props
* @internal
*/
var ReactElement = function (type, key, ref, self, source, owner, props) {
var element = {
// This tag allow us to uniquely identify this as a React Element
$$typeof: REACT_ELEMENT_TYPE,
// Built-in properties that belong on the element
type: type,
key: key,
ref: ref,
props: props,
// Record the component responsible for creating this element.
_owner: owner
};
if ("development" !== 'production') {
// The validation flag is currently mutative. We put it on
// an external backing store so that we can freeze the whole object.
// This can be replaced with a WeakMap once they are implemented in
// commonly used development environments.
element._store = {};
// To make comparing ReactElements easier for testing purposes, we make
// the validation flag non-enumerable (where possible, which should
// include every environment we run tests in), so the test framework
// ignores it.
if (canDefineProperty) {
Object.defineProperty(element._store, 'validated', {
configurable: false,
enumerable: false,
writable: true,
value: false
});
// self and source are DEV only properties.
Object.defineProperty(element, '_self', {
configurable: false,
enumerable: false,
writable: false,
value: self
});
// Two elements created in two different places should be considered
// equal for testing purposes and therefore we hide it from enumeration.
Object.defineProperty(element, '_source', {
configurable: false,
enumerable: false,
writable: false,
value: source
});
} else {
element._store.validated = false;
element._self = self;
element._source = source;
}
Object.freeze(element.props);
Object.freeze(element);
}
return element;
};
ReactElement.createElement = function (type, config, children) {
var propName;
// Reserved names are extracted
var props = {};
var key = null;
var ref = null;
var self = null;
var source = null;
if (config != null) {
ref = config.ref === undefined ? null : config.ref;
key = config.key === undefined ? null : '' + config.key;
self = config.__self === undefined ? null : config.__self;
source = config.__source === undefined ? null : config.__source;
// Remaining properties are added to a new props object
for (propName in config) {
if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
// Resolve default props
if (type && type.defaultProps) {
var defaultProps = type.defaultProps;
for (propName in defaultProps) {
if (typeof props[propName] === 'undefined') {
props[propName] = defaultProps[propName];
}
}
}
return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
};
ReactElement.createFactory = function (type) {
var factory = ReactElement.createElement.bind(null, type);
// Expose the type on the factory and the prototype so that it can be
// easily accessed on elements. E.g. `<Foo />.type === Foo`.
// This should not be named `constructor` since this may not be the function
// that created the element, and it may not even be a constructor.
// Legacy hook TODO: Warn if this is accessed
factory.type = type;
return factory;
};
ReactElement.cloneAndReplaceKey = function (oldElement, newKey) {
var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
return newElement;
};
ReactElement.cloneAndReplaceProps = function (oldElement, newProps) {
var newElement = ReactElement(oldElement.type, oldElement.key, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, newProps);
if ("development" !== 'production') {
// If the key on the original is valid, then the clone is valid
newElement._store.validated = oldElement._store.validated;
}
return newElement;
};
ReactElement.cloneElement = function (element, config, children) {
var propName;
// Original props are copied
var props = assign({}, element.props);
// Reserved names are extracted
var key = element.key;
var ref = element.ref;
// Self is preserved since the owner is preserved.
var self = element._self;
// Source is preserved since cloneElement is unlikely to be targeted by a
// transpiler, and the original source is probably a better indicator of the
// true owner.
var source = element._source;
// Owner will be preserved, unless ref is overridden
var owner = element._owner;
if (config != null) {
if (config.ref !== undefined) {
// Silently steal the ref from the parent.
ref = config.ref;
owner = ReactCurrentOwner.current;
}
if (config.key !== undefined) {
key = '' + config.key;
}
// Remaining properties override existing props
for (propName in config) {
if (config.hasOwnProperty(propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
props[propName] = config[propName];
}
}
}
// Children can be more than one argument, and those are transferred onto
// the newly allocated props object.
var childrenLength = arguments.length - 2;
if (childrenLength === 1) {
props.children = children;
} else if (childrenLength > 1) {
var childArray = Array(childrenLength);
for (var i = 0; i < childrenLength; i++) {
childArray[i] = arguments[i + 2];
}
props.children = childArray;
}
return ReactElement(element.type, key, ref, self, source, owner, props);
};
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid component.
* @final
*/
ReactElement.isValidElement = function (object) {
return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
};
module.exports = ReactElement;
},{"24":24,"39":39}],58:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactElementValidator
*/
/**
* ReactElementValidator provides a wrapper around a element factory
* which validates the props passed to the element. This is intended to be
* used only in DEV and could be replaced by a static type checker for languages
* that support it.
*/
'use strict';
var ReactElement = _dereq_(57);
var ReactPropTypeLocations = _dereq_(81);
var ReactPropTypeLocationNames = _dereq_(80);
var ReactCurrentOwner = _dereq_(39);
var getIteratorFn = _dereq_(128);
var invariant = _dereq_(160);
var warning = _dereq_(172);
function getDeclarationErrorAddendum() {
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Warn if there's no key explicitly set on dynamic arrays of children or
* object keys are not valid. This allows us to keep track of children between
* updates.
*/
var ownerHasKeyUseWarning = {};
var loggedTypeFailures = {};
/**
* Warn if the element doesn't have an explicit key assigned to it.
* This element is in an array. The array could grow and shrink or be
* reordered. All children that haven't already been validated are required to
* have a "key" property assigned to it.
*
* @internal
* @param {ReactElement} element Element that requires a key.
* @param {*} parentType element's parent's type.
*/
function validateExplicitKey(element, parentType) {
if (!element._store || element._store.validated || element.key != null) {
return;
}
element._store.validated = true;
var addenda = getAddendaForKeyUse('uniqueKey', element, parentType);
if (addenda === null) {
// we already showed the warning
return;
}
"development" !== 'production' ? warning(false, 'Each child in an array or iterator should have a unique "key" prop.' + '%s%s%s', addenda.parentOrOwner || '', addenda.childOwner || '', addenda.url || '') : undefined;
}
/**
* Shared warning and monitoring code for the key warnings.
*
* @internal
* @param {string} messageType A key used for de-duping warnings.
* @param {ReactElement} element Component that requires a key.
* @param {*} parentType element's parent's type.
* @returns {?object} A set of addenda to use in the warning message, or null
* if the warning has already been shown before (and shouldn't be shown again).
*/
function getAddendaForKeyUse(messageType, element, parentType) {
var addendum = getDeclarationErrorAddendum();
if (!addendum) {
var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
if (parentName) {
addendum = ' Check the top-level render call using <' + parentName + '>.';
}
}
var memoizer = ownerHasKeyUseWarning[messageType] || (ownerHasKeyUseWarning[messageType] = {});
if (memoizer[addendum]) {
return null;
}
memoizer[addendum] = true;
var addenda = {
parentOrOwner: addendum,
url: ' See https://fb.me/react-warning-keys for more information.',
childOwner: null
};
// Usually the current owner is the offender, but if it accepts children as a
// property, it may be the creator of the child that's responsible for
// assigning it a key.
if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
// Give the component that originally created this child.
addenda.childOwner = ' It was passed a child from ' + element._owner.getName() + '.';
}
return addenda;
}
/**
* Ensure that every element either is passed in a static location, in an
* array with an explicit keys property defined, or in an object literal
* with valid key property.
*
* @internal
* @param {ReactNode} node Statically passed child of any type.
* @param {*} parentType node's parent's type.
*/
function validateChildKeys(node, parentType) {
if (typeof node !== 'object') {
return;
}
if (Array.isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];
if (ReactElement.isValidElement(child)) {
validateExplicitKey(child, parentType);
}
}
} else if (ReactElement.isValidElement(node)) {
// This element was passed in a valid location.
if (node._store) {
node._store.validated = true;
}
} else if (node) {
var iteratorFn = getIteratorFn(node);
// Entry iterators provide implicit keys.
if (iteratorFn) {
if (iteratorFn !== node.entries) {
var iterator = iteratorFn.call(node);
var step;
while (!(step = iterator.next()).done) {
if (ReactElement.isValidElement(step.value)) {
validateExplicitKey(step.value, parentType);
}
}
}
}
}
}
/**
* Assert that the props are valid
*
* @param {string} componentName Name of the component for error messages.
* @param {object} propTypes Map of prop name to a ReactPropType
* @param {object} props
* @param {string} location e.g. "prop", "context", "child context"
* @private
*/
function checkPropTypes(componentName, propTypes, props, location) {
for (var propName in propTypes) {
if (propTypes.hasOwnProperty(propName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
!(typeof propTypes[propName] === 'function') ? "development" !== 'production' ? invariant(false, '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', ReactPropTypeLocationNames[location], propName) : invariant(false) : undefined;
error = propTypes[propName](props, propName, componentName, location);
} catch (ex) {
error = ex;
}
"development" !== 'production' ? warning(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', ReactPropTypeLocationNames[location], propName, typeof error) : undefined;
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var addendum = getDeclarationErrorAddendum();
"development" !== 'production' ? warning(false, 'Failed propType: %s%s', error.message, addendum) : undefined;
}
}
}
}
/**
* Given an element, validate that its props follow the propTypes definition,
* provided by the type.
*
* @param {ReactElement} element
*/
function validatePropTypes(element) {
var componentClass = element.type;
if (typeof componentClass !== 'function') {
return;
}
var name = componentClass.displayName || componentClass.name;
if (componentClass.propTypes) {
checkPropTypes(name, componentClass.propTypes, element.props, ReactPropTypeLocations.prop);
}
if (typeof componentClass.getDefaultProps === 'function') {
"development" !== 'production' ? warning(componentClass.getDefaultProps.isReactClassApproved, 'getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.') : undefined;
}
}
var ReactElementValidator = {
createElement: function (type, props, children) {
var validType = typeof type === 'string' || typeof type === 'function';
// We warn in this case but don't throw. We expect the element creation to
// succeed and there will likely be errors in render.
"development" !== 'production' ? warning(validType, 'React.createElement: type should not be null, undefined, boolean, or ' + 'number. It should be a string (for DOM elements) or a ReactClass ' + '(for composite components).%s', getDeclarationErrorAddendum()) : undefined;
var element = ReactElement.createElement.apply(this, arguments);
// The result can be nullish if a mock or a custom function is used.
// TODO: Drop this when these are no longer allowed as the type argument.
if (element == null) {
return element;
}
// Skip key warning if the type isn't valid since our key validation logic
// doesn't expect a non-string/function type and can throw confusing errors.
// We don't want exception behavior to differ between dev and prod.
// (Rendering will throw with a helpful message and as soon as the type is
// fixed, the key warnings will appear.)
if (validType) {
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], type);
}
}
validatePropTypes(element);
return element;
},
createFactory: function (type) {
var validatedFactory = ReactElementValidator.createElement.bind(null, type);
// Legacy hook TODO: Warn if this is accessed
validatedFactory.type = type;
if ("development" !== 'production') {
try {
Object.defineProperty(validatedFactory, 'type', {
enumerable: false,
get: function () {
"development" !== 'production' ? warning(false, 'Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.') : undefined;
Object.defineProperty(this, 'type', {
value: type
});
return type;
}
});
} catch (x) {
// IE will fail on defineProperty (es5-shim/sham too)
}
}
return validatedFactory;
},
cloneElement: function (element, props, children) {
var newElement = ReactElement.cloneElement.apply(this, arguments);
for (var i = 2; i < arguments.length; i++) {
validateChildKeys(arguments[i], newElement.type);
}
validatePropTypes(newElement);
return newElement;
}
};
module.exports = ReactElementValidator;
},{"128":128,"160":160,"172":172,"39":39,"57":57,"80":80,"81":81}],59:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEmptyComponent
*/
'use strict';
var ReactElement = _dereq_(57);
var ReactEmptyComponentRegistry = _dereq_(60);
var ReactReconciler = _dereq_(84);
var assign = _dereq_(24);
var placeholderElement;
var ReactEmptyComponentInjection = {
injectEmptyComponent: function (component) {
placeholderElement = ReactElement.createElement(component);
}
};
var ReactEmptyComponent = function (instantiate) {
this._currentElement = null;
this._rootNodeID = null;
this._renderedComponent = instantiate(placeholderElement);
};
assign(ReactEmptyComponent.prototype, {
construct: function (element) {},
mountComponent: function (rootID, transaction, context) {
ReactEmptyComponentRegistry.registerNullComponentID(rootID);
this._rootNodeID = rootID;
return ReactReconciler.mountComponent(this._renderedComponent, rootID, transaction, context);
},
receiveComponent: function () {},
unmountComponent: function (rootID, transaction, context) {
ReactReconciler.unmountComponent(this._renderedComponent);
ReactEmptyComponentRegistry.deregisterNullComponentID(this._rootNodeID);
this._rootNodeID = null;
this._renderedComponent = null;
}
});
ReactEmptyComponent.injection = ReactEmptyComponentInjection;
module.exports = ReactEmptyComponent;
},{"24":24,"57":57,"60":60,"84":84}],60:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEmptyComponentRegistry
*/
'use strict';
// This registry keeps track of the React IDs of the components that rendered to
// `null` (in reality a placeholder such as `noscript`)
var nullComponentIDsRegistry = {};
/**
* @param {string} id Component's `_rootNodeID`.
* @return {boolean} True if the component is rendered to null.
*/
function isNullComponentID(id) {
return !!nullComponentIDsRegistry[id];
}
/**
* Mark the component as having rendered to null.
* @param {string} id Component's `_rootNodeID`.
*/
function registerNullComponentID(id) {
nullComponentIDsRegistry[id] = true;
}
/**
* Unmark the component as having rendered to null: it renders to something now.
* @param {string} id Component's `_rootNodeID`.
*/
function deregisterNullComponentID(id) {
delete nullComponentIDsRegistry[id];
}
var ReactEmptyComponentRegistry = {
isNullComponentID: isNullComponentID,
registerNullComponentID: registerNullComponentID,
deregisterNullComponentID: deregisterNullComponentID
};
module.exports = ReactEmptyComponentRegistry;
},{}],61:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactErrorUtils
* @typechecks
*/
'use strict';
var caughtError = null;
/**
* Call a function while guarding against errors that happens within it.
*
* @param {?String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {*} a First argument
* @param {*} b Second argument
*/
function invokeGuardedCallback(name, func, a, b) {
try {
return func(a, b);
} catch (x) {
if (caughtError === null) {
caughtError = x;
}
return undefined;
}
}
var ReactErrorUtils = {
invokeGuardedCallback: invokeGuardedCallback,
/**
* Invoked by ReactTestUtils.Simulate so that any errors thrown by the event
* handler are sure to be rethrown by rethrowCaughtError.
*/
invokeGuardedCallbackWithCatch: invokeGuardedCallback,
/**
* During execution of guarded functions we will capture the first error which
* we will rethrow to be handled by the top level error handler.
*/
rethrowCaughtError: function () {
if (caughtError) {
var error = caughtError;
caughtError = null;
throw error;
}
}
};
if ("development" !== 'production') {
/**
* To help development we can get better devtools integration by simulating a
* real browser event.
*/
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof Event === 'function') {
var fakeNode = document.createElement('react');
ReactErrorUtils.invokeGuardedCallback = function (name, func, a, b) {
var boundFunc = func.bind(null, a, b);
fakeNode.addEventListener(name, boundFunc, false);
fakeNode.dispatchEvent(new Event(name));
fakeNode.removeEventListener(name, boundFunc, false);
};
}
}
module.exports = ReactErrorUtils;
},{}],62:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEventEmitterMixin
*/
'use strict';
var EventPluginHub = _dereq_(16);
function runEventQueueInBatch(events) {
EventPluginHub.enqueueEvents(events);
EventPluginHub.processEventQueue(false);
}
var ReactEventEmitterMixin = {
/**
* Streams a fired top-level event to `EventPluginHub` where plugins have the
* opportunity to create `ReactEvent`s to be dispatched.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {object} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native environment event.
*/
handleTopLevel: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var events = EventPluginHub.extractEvents(topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget);
runEventQueueInBatch(events);
}
};
module.exports = ReactEventEmitterMixin;
},{"16":16}],63:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactEventListener
* @typechecks static-only
*/
'use strict';
var EventListener = _dereq_(145);
var ExecutionEnvironment = _dereq_(146);
var PooledClass = _dereq_(25);
var ReactInstanceHandles = _dereq_(67);
var ReactMount = _dereq_(72);
var ReactUpdates = _dereq_(96);
var assign = _dereq_(24);
var getEventTarget = _dereq_(127);
var getUnboundedScrollPosition = _dereq_(157);
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
/**
* Finds the parent React component of `node`.
*
* @param {*} node
* @return {?DOMEventTarget} Parent container, or `null` if the specified node
* is not nested.
*/
function findParent(node) {
// TODO: It may be a good idea to cache this to prevent unnecessary DOM
// traversal, but caching is difficult to do correctly without using a
// mutation observer to listen for all DOM changes.
var nodeID = ReactMount.getID(node);
var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
var container = ReactMount.findReactContainerForID(rootID);
var parent = ReactMount.getFirstReactDOM(container);
return parent;
}
// Used to store ancestor hierarchy in top level callback
function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
this.topLevelType = topLevelType;
this.nativeEvent = nativeEvent;
this.ancestors = [];
}
assign(TopLevelCallbackBookKeeping.prototype, {
destructor: function () {
this.topLevelType = null;
this.nativeEvent = null;
this.ancestors.length = 0;
}
});
PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
function handleTopLevelImpl(bookKeeping) {
// TODO: Re-enable event.path handling
//
// if (bookKeeping.nativeEvent.path && bookKeeping.nativeEvent.path.length > 1) {
// // New browsers have a path attribute on native events
// handleTopLevelWithPath(bookKeeping);
// } else {
// // Legacy browsers don't have a path attribute on native events
// handleTopLevelWithoutPath(bookKeeping);
// }
void handleTopLevelWithPath; // temporarily unused
handleTopLevelWithoutPath(bookKeeping);
}
// Legacy browsers don't have a path attribute on native events
function handleTopLevelWithoutPath(bookKeeping) {
var topLevelTarget = ReactMount.getFirstReactDOM(getEventTarget(bookKeeping.nativeEvent)) || window;
// Loop through the hierarchy, in case there's any nested components.
// It's important that we build the array of ancestors before calling any
// event handlers, because event handlers can modify the DOM, leading to
// inconsistencies with ReactMount's node cache. See #1105.
var ancestor = topLevelTarget;
while (ancestor) {
bookKeeping.ancestors.push(ancestor);
ancestor = findParent(ancestor);
}
for (var i = 0; i < bookKeeping.ancestors.length; i++) {
topLevelTarget = bookKeeping.ancestors[i];
var topLevelTargetID = ReactMount.getID(topLevelTarget) || '';
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, topLevelTarget, topLevelTargetID, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
// New browsers have a path attribute on native events
function handleTopLevelWithPath(bookKeeping) {
var path = bookKeeping.nativeEvent.path;
var currentNativeTarget = path[0];
var eventsFired = 0;
for (var i = 0; i < path.length; i++) {
var currentPathElement = path[i];
if (currentPathElement.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE) {
currentNativeTarget = path[i + 1];
}
// TODO: slow
var reactParent = ReactMount.getFirstReactDOM(currentPathElement);
if (reactParent === currentPathElement) {
var currentPathElementID = ReactMount.getID(currentPathElement);
var newRootID = ReactInstanceHandles.getReactRootIDFromNodeID(currentPathElementID);
bookKeeping.ancestors.push(currentPathElement);
var topLevelTargetID = ReactMount.getID(currentPathElement) || '';
eventsFired++;
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, currentPathElement, topLevelTargetID, bookKeeping.nativeEvent, currentNativeTarget);
// Jump to the root of this React render tree
while (currentPathElementID !== newRootID) {
i++;
currentPathElement = path[i];
currentPathElementID = ReactMount.getID(currentPathElement);
}
}
}
if (eventsFired === 0) {
ReactEventListener._handleTopLevel(bookKeeping.topLevelType, window, '', bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
}
}
function scrollValueMonitor(cb) {
var scrollPosition = getUnboundedScrollPosition(window);
cb(scrollPosition);
}
var ReactEventListener = {
_enabled: true,
_handleTopLevel: null,
WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
setHandleTopLevel: function (handleTopLevel) {
ReactEventListener._handleTopLevel = handleTopLevel;
},
setEnabled: function (enabled) {
ReactEventListener._enabled = !!enabled;
},
isEnabled: function () {
return ReactEventListener._enabled;
},
/**
* Traps top-level events by using event bubbling.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapBubbledEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
/**
* Traps a top-level event by using event capturing.
*
* @param {string} topLevelType Record from `EventConstants`.
* @param {string} handlerBaseName Event name (e.g. "click").
* @param {object} handle Element on which to attach listener.
* @return {?object} An object with a remove function which will forcefully
* remove the listener.
* @internal
*/
trapCapturedEvent: function (topLevelType, handlerBaseName, handle) {
var element = handle;
if (!element) {
return null;
}
return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
},
monitorScrollValue: function (refresh) {
var callback = scrollValueMonitor.bind(null, refresh);
EventListener.listen(window, 'scroll', callback);
},
dispatchEvent: function (topLevelType, nativeEvent) {
if (!ReactEventListener._enabled) {
return;
}
var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
try {
// Event queue being processed in the same cycle allows
// `preventDefault`.
ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
} finally {
TopLevelCallbackBookKeeping.release(bookKeeping);
}
}
};
module.exports = ReactEventListener;
},{"127":127,"145":145,"146":146,"157":157,"24":24,"25":25,"67":67,"72":72,"96":96}],64:[function(_dereq_,module,exports){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactFragment
*/
'use strict';
var ReactChildren = _dereq_(32);
var ReactElement = _dereq_(57);
var emptyFunction = _dereq_(152);
var invariant = _dereq_(160);
var warning = _dereq_(172);
/**
* We used to allow keyed objects to serve as a collection of ReactElements,
* or nested sets. This allowed us a way to explicitly key a set a fragment of
* components. This is now being replaced with an opaque data structure.
* The upgrade path is to call React.addons.createFragment({ key: value }) to
* create a keyed fragment. The resulting data structure is an array.
*/
var numericPropertyRegex = /^\d+$/;
var warnedAboutNumeric = false;
var ReactFragment = {
// Wrap a keyed object in an opaque proxy that warns you if you access any
// of its properties.
create: function (object) {
if (typeof object !== 'object' || !object || Array.isArray(object)) {
"development" !== 'production' ? warning(false, 'React.addons.createFragment only accepts a single object. Got: %s', object) : undefined;
return object;
}
if (ReactElement.isValidElement(object)) {
"development" !== 'production' ? warning(false, 'React.addons.createFragment does not accept a ReactElement ' + 'without a wrapper object.') : undefined;
return object;
}
!(object.nodeType !== 1) ? "development" !== 'production' ? invariant(false, 'React.addons.createFragment(...): Encountered an invalid child; DOM ' + 'elements are not valid children of React components.') : invariant(false) : undefined;
var result = [];
for (var key in object) {
if ("development" !== 'production') {
if (!warnedAboutNumeric && numericPropertyRegex.test(key)) {
"development" !== 'production' ? warning(false, 'React.addons.createFragment(...): Child objects should have ' + 'non-numeric keys so ordering is preserved.') : undefined;
warnedAboutNumeric = true;
}
}
ReactChildren.mapIntoWithKeyPrefixInternal(object[key], result, key, emptyFunction.thatReturnsArgument);
}
return result;
}
};
module.exports = ReactFragment;
},{"152":152,"160":160,"172":172,"32":32,"57":57}],65:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInjection
*/
'use strict';
var DOMProperty = _dereq_(10);
var EventPluginHub = _dereq_(16);
var ReactComponentEnvironment = _dereq_(36);
var ReactClass = _dereq_(33);
var ReactEmptyComponent = _dereq_(59);
var ReactBrowserEventEmitter = _dereq_(28);
var ReactNativeComponent = _dereq_(75);
var ReactPerf = _dereq_(78);
var ReactRootIndex = _dereq_(86);
var ReactUpdates = _dereq_(96);
var ReactInjection = {
Component: ReactComponentEnvironment.injection,
Class: ReactClass.injection,
DOMProperty: DOMProperty.injection,
EmptyComponent: ReactEmptyComponent.injection,
EventPluginHub: EventPluginHub.injection,
EventEmitter: ReactBrowserEventEmitter.injection,
NativeComponent: ReactNativeComponent.injection,
Perf: ReactPerf.injection,
RootIndex: ReactRootIndex.injection,
Updates: ReactUpdates.injection
};
module.exports = ReactInjection;
},{"10":10,"16":16,"28":28,"33":33,"36":36,"59":59,"75":75,"78":78,"86":86,"96":96}],66:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInputSelection
*/
'use strict';
var ReactDOMSelection = _dereq_(49);
var containsNode = _dereq_(149);
var focusNode = _dereq_(154);
var getActiveElement = _dereq_(155);
function isInDocument(node) {
return containsNode(document.documentElement, node);
}
/**
* @ReactInputSelection: React input selection module. Based on Selection.js,
* but modified to be suitable for react and has a couple of bug fixes (doesn't
* assume buttons have range selections allowed).
* Input selection module for React.
*/
var ReactInputSelection = {
hasSelectionCapabilities: function (elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');
},
getSelectionInformation: function () {
var focusedElem = getActiveElement();
return {
focusedElem: focusedElem,
selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null
};
},
/**
* @restoreSelection: If any selection information was potentially lost,
* restore it. This is useful when performing operations that could remove dom
* nodes and place them back in, resulting in focus being lost.
*/
restoreSelection: function (priorSelectionInformation) {
var curFocusedElem = getActiveElement();
var priorFocusedElem = priorSelectionInformation.focusedElem;
var priorSelectionRange = priorSelectionInformation.selectionRange;
if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {
if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {
ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);
}
focusNode(priorFocusedElem);
}
},
/**
* @getSelection: Gets the selection bounds of a focused textarea, input or
* contentEditable node.
* -@input: Look up selection bounds of this input
* -@return {start: selectionStart, end: selectionEnd}
*/
getSelection: function (input) {
var selection;
if ('selectionStart' in input) {
// Modern browser with input or textarea.
selection = {
start: input.selectionStart,
end: input.selectionEnd
};
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
// IE8 input.
var range = document.selection.createRange();
// There can only be one selection per document in IE, so it must
// be in our element.
if (range.parentElement() === input) {
selection = {
start: -range.moveStart('character', -input.value.length),
end: -range.moveEnd('character', -input.value.length)
};
}
} else {
// Content editable or old IE textarea.
selection = ReactDOMSelection.getOffsets(input);
}
return selection || { start: 0, end: 0 };
},
/**
* @setSelection: Sets the selection bounds of a textarea or input and focuses
* the input.
* -@input Set selection bounds of this input or textarea
* -@offsets Object of same form that is returned from get*
*/
setSelection: function (input, offsets) {
var start = offsets.start;
var end = offsets.end;
if (typeof end === 'undefined') {
end = start;
}
if ('selectionStart' in input) {
input.selectionStart = start;
input.selectionEnd = Math.min(end, input.value.length);
} else if (document.selection && (input.nodeName && input.nodeName.toLowerCase() === 'input')) {
var range = input.createTextRange();
range.collapse(true);
range.moveStart('character', start);
range.moveEnd('character', end - start);
range.select();
} else {
ReactDOMSelection.setOffsets(input, offsets);
}
}
};
module.exports = ReactInputSelection;
},{"149":149,"154":154,"155":155,"49":49}],67:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInstanceHandles
* @typechecks static-only
*/
'use strict';
var ReactRootIndex = _dereq_(86);
var invariant = _dereq_(160);
var SEPARATOR = '.';
var SEPARATOR_LENGTH = SEPARATOR.length;
/**
* Maximum depth of traversals before we consider the possibility of a bad ID.
*/
var MAX_TREE_DEPTH = 10000;
/**
* Creates a DOM ID prefix to use when mounting React components.
*
* @param {number} index A unique integer
* @return {string} React root ID.
* @internal
*/
function getReactRootIDString(index) {
return SEPARATOR + index.toString(36);
}
/**
* Checks if a character in the supplied ID is a separator or the end.
*
* @param {string} id A React DOM ID.
* @param {number} index Index of the character to check.
* @return {boolean} True if the character is a separator or end of the ID.
* @private
*/
function isBoundary(id, index) {
return id.charAt(index) === SEPARATOR || index === id.length;
}
/**
* Checks if the supplied string is a valid React DOM ID.
*
* @param {string} id A React DOM ID, maybe.
* @return {boolean} True if the string is a valid React DOM ID.
* @private
*/
function isValidID(id) {
return id === '' || id.charAt(0) === SEPARATOR && id.charAt(id.length - 1) !== SEPARATOR;
}
/**
* Checks if the first ID is an ancestor of or equal to the second ID.
*
* @param {string} ancestorID
* @param {string} descendantID
* @return {boolean} True if `ancestorID` is an ancestor of `descendantID`.
* @internal
*/
function isAncestorIDOf(ancestorID, descendantID) {
return descendantID.indexOf(ancestorID) === 0 && isBoundary(descendantID, ancestorID.length);
}
/**
* Gets the parent ID of the supplied React DOM ID, `id`.
*
* @param {string} id ID of a component.
* @return {string} ID of the parent, or an empty string.
* @private
*/
function getParentID(id) {
return id ? id.substr(0, id.lastIndexOf(SEPARATOR)) : '';
}
/**
* Gets the next DOM ID on the tree path from the supplied `ancestorID` to the
* supplied `destinationID`. If they are equal, the ID is returned.
*
* @param {string} ancestorID ID of an ancestor node of `destinationID`.
* @param {string} destinationID ID of the destination node.
* @return {string} Next ID on the path from `ancestorID` to `destinationID`.
* @private
*/
function getNextDescendantID(ancestorID, destinationID) {
!(isValidID(ancestorID) && isValidID(destinationID)) ? "development" !== 'production' ? invariant(false, 'getNextDescendantID(%s, %s): Received an invalid React DOM ID.', ancestorID, destinationID) : invariant(false) : undefined;
!isAncestorIDOf(ancestorID, destinationID) ? "development" !== 'production' ? invariant(false, 'getNextDescendantID(...): React has made an invalid assumption about ' + 'the DOM hierarchy. Expected `%s` to be an ancestor of `%s`.', ancestorID, destinationID) : invariant(false) : undefined;
if (ancestorID === destinationID) {
return ancestorID;
}
// Skip over the ancestor and the immediate separator. Traverse until we hit
// another separator or we reach the end of `destinationID`.
var start = ancestorID.length + SEPARATOR_LENGTH;
var i;
for (i = start; i < destinationID.length; i++) {
if (isBoundary(destinationID, i)) {
break;
}
}
return destinationID.substr(0, i);
}
/**
* Gets the nearest common ancestor ID of two IDs.
*
* Using this ID scheme, the nearest common ancestor ID is the longest common
* prefix of the two IDs that immediately preceded a "marker" in both strings.
*
* @param {string} oneID
* @param {string} twoID
* @return {string} Nearest common ancestor ID, or the empty string if none.
* @private
*/
function getFirstCommonAncestorID(oneID, twoID) {
var minLength = Math.min(oneID.length, twoID.length);
if (minLength === 0) {
return '';
}
var lastCommonMarkerIndex = 0;
// Use `<=` to traverse until the "EOL" of the shorter string.
for (var i = 0; i <= minLength; i++) {
if (isBoundary(oneID, i) && isBoundary(twoID, i)) {
lastCommonMarkerIndex = i;
} else if (oneID.charAt(i) !== twoID.charAt(i)) {
break;
}
}
var longestCommonID = oneID.substr(0, lastCommonMarkerIndex);
!isValidID(longestCommonID) ? "development" !== 'production' ? invariant(false, 'getFirstCommonAncestorID(%s, %s): Expected a valid React DOM ID: %s', oneID, twoID, longestCommonID) : invariant(false) : undefined;
return longestCommonID;
}
/**
* Traverses the parent path between two IDs (either up or down). The IDs must
* not be the same, and there must exist a parent path between them. If the
* callback returns `false`, traversal is stopped.
*
* @param {?string} start ID at which to start traversal.
* @param {?string} stop ID at which to end traversal.
* @param {function} cb Callback to invoke each ID with.
* @param {*} arg Argument to invoke the callback with.
* @param {?boolean} skipFirst Whether or not to skip the first node.
* @param {?boolean} skipLast Whether or not to skip the last node.
* @private
*/
function traverseParentPath(start, stop, cb, arg, skipFirst, skipLast) {
start = start || '';
stop = stop || '';
!(start !== stop) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(...): Cannot traverse from and to the same ID, `%s`.', start) : invariant(false) : undefined;
var traverseUp = isAncestorIDOf(stop, start);
!(traverseUp || isAncestorIDOf(start, stop)) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Cannot traverse from two IDs that do ' + 'not have a parent path.', start, stop) : invariant(false) : undefined;
// Traverse from `start` to `stop` one depth at a time.
var depth = 0;
var traverse = traverseUp ? getParentID : getNextDescendantID;
for (var id = start;; /* until break */id = traverse(id, stop)) {
var ret;
if ((!skipFirst || id !== start) && (!skipLast || id !== stop)) {
ret = cb(id, traverseUp, arg);
}
if (ret === false || id === stop) {
// Only break //after// visiting `stop`.
break;
}
!(depth++ < MAX_TREE_DEPTH) ? "development" !== 'production' ? invariant(false, 'traverseParentPath(%s, %s, ...): Detected an infinite loop while ' + 'traversing the React DOM ID tree. This may be due to malformed IDs: %s', start, stop, id) : invariant(false) : undefined;
}
}
/**
* Manages the IDs assigned to DOM representations of React components. This
* uses a specific scheme in order to traverse the DOM efficiently (e.g. in
* order to simulate events).
*
* @internal
*/
var ReactInstanceHandles = {
/**
* Constructs a React root ID
* @return {string} A React root ID.
*/
createReactRootID: function () {
return getReactRootIDString(ReactRootIndex.createReactRootIndex());
},
/**
* Constructs a React ID by joining a root ID with a name.
*
* @param {string} rootID Root ID of a parent component.
* @param {string} name A component's name (as flattened children).
* @return {string} A React ID.
* @internal
*/
createReactID: function (rootID, name) {
return rootID + name;
},
/**
* Gets the DOM ID of the React component that is the root of the tree that
* contains the React component with the supplied DOM ID.
*
* @param {string} id DOM ID of a React component.
* @return {?string} DOM ID of the React component that is the root.
* @internal
*/
getReactRootIDFromNodeID: function (id) {
if (id && id.charAt(0) === SEPARATOR && id.length > 1) {
var index = id.indexOf(SEPARATOR, 1);
return index > -1 ? id.substr(0, index) : id;
}
return null;
},
/**
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
* should would receive a `mouseEnter` or `mouseLeave` event.
*
* NOTE: Does not invoke the callback on the nearest common ancestor because
* nothing "entered" or "left" that element.
*
* @param {string} leaveID ID being left.
* @param {string} enterID ID being entered.
* @param {function} cb Callback to invoke on each entered/left ID.
* @param {*} upArg Argument to invoke the callback with on left IDs.
* @param {*} downArg Argument to invoke the callback with on entered IDs.
* @internal
*/
traverseEnterLeave: function (leaveID, enterID, cb, upArg, downArg) {
var ancestorID = getFirstCommonAncestorID(leaveID, enterID);
if (ancestorID !== leaveID) {
traverseParentPath(leaveID, ancestorID, cb, upArg, false, true);
}
if (ancestorID !== enterID) {
traverseParentPath(ancestorID, enterID, cb, downArg, true, false);
}
},
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseTwoPhase: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, false);
traverseParentPath(targetID, '', cb, arg, false, true);
}
},
/**
* Same as `traverseTwoPhase` but skips the `targetID`.
*/
traverseTwoPhaseSkipTarget: function (targetID, cb, arg) {
if (targetID) {
traverseParentPath('', targetID, cb, arg, true, true);
traverseParentPath(targetID, '', cb, arg, true, true);
}
},
/**
* Traverse a node ID, calling the supplied `cb` for each ancestor ID. For
* example, passing `.0.$row-0.1` would result in `cb` getting called
* with `.0`, `.0.$row-0`, and `.0.$row-0.1`.
*
* NOTE: This traversal happens on IDs without touching the DOM.
*
* @param {string} targetID ID of the target node.
* @param {function} cb Callback to invoke.
* @param {*} arg Argument to invoke the callback with.
* @internal
*/
traverseAncestors: function (targetID, cb, arg) {
traverseParentPath('', targetID, cb, arg, true, false);
},
getFirstCommonAncestorID: getFirstCommonAncestorID,
/**
* Exposed for unit testing.
* @private
*/
_getNextDescendantID: getNextDescendantID,
isAncestorIDOf: isAncestorIDOf,
SEPARATOR: SEPARATOR
};
module.exports = ReactInstanceHandles;
},{"160":160,"86":86}],68:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactInstanceMap
*/
'use strict';
/**
* `ReactInstanceMap` maintains a mapping from a public facing stateful
* instance (key) and the internal representation (value). This allows public
* methods to accept the user facing instance as an argument and map them back
* to internal methods.
*/
// TODO: Replace this with ES6: var ReactInstanceMap = new Map();
var ReactInstanceMap = {
/**
* This API should be called `delete` but we'd have to make sure to always
* transform these to strings for IE support. When this transform is fully
* supported we can rename it.
*/
remove: function (key) {
key._reactInternalInstance = undefined;
},
get: function (key) {
return key._reactInternalInstance;
},
has: function (key) {
return key._reactInternalInstance !== undefined;
},
set: function (key, value) {
key._reactInternalInstance = value;
}
};
module.exports = ReactInstanceMap;
},{}],69:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactIsomorphic
*/
'use strict';
var ReactChildren = _dereq_(32);
var ReactComponent = _dereq_(34);
var ReactClass = _dereq_(33);
var ReactDOMFactories = _dereq_(43);
var ReactElement = _dereq_(57);
var ReactElementValidator = _dereq_(58);
var ReactPropTypes = _dereq_(82);
var ReactVersion = _dereq_(97);
var assign = _dereq_(24);
var onlyChild = _dereq_(134);
var createElement = ReactElement.createElement;
var createFactory = ReactElement.createFactory;
var cloneElement = ReactElement.cloneElement;
if ("development" !== 'production') {
createElement = ReactElementValidator.createElement;
createFactory = ReactElementValidator.createFactory;
cloneElement = ReactElementValidator.cloneElement;
}
var React = {
// Modern
Children: {
map: ReactChildren.map,
forEach: ReactChildren.forEach,
count: ReactChildren.count,
toArray: ReactChildren.toArray,
only: onlyChild
},
Component: ReactComponent,
createElement: createElement,
cloneElement: cloneElement,
isValidElement: ReactElement.isValidElement,
// Classic
PropTypes: ReactPropTypes,
createClass: ReactClass.createClass,
createFactory: createFactory,
createMixin: function (mixin) {
// Currently a noop. Will be used to validate and trace mixins.
return mixin;
},
// This looks DOM specific but these are actually isomorphic helpers
// since they are just generating DOM strings.
DOM: ReactDOMFactories,
version: ReactVersion,
// Hook for JSX spread, don't use this for anything else.
__spread: assign
};
module.exports = React;
},{"134":134,"24":24,"32":32,"33":33,"34":34,"43":43,"57":57,"58":58,"82":82,"97":97}],70:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactLink
* @typechecks static-only
*/
'use strict';
/**
* ReactLink encapsulates a common pattern in which a component wants to modify
* a prop received from its parent. ReactLink allows the parent to pass down a
* value coupled with a callback that, when invoked, expresses an intent to
* modify that value. For example:
*
* React.createClass({
* getInitialState: function() {
* return {value: ''};
* },
* render: function() {
* var valueLink = new ReactLink(this.state.value, this._handleValueChange);
* return <input valueLink={valueLink} />;
* },
* _handleValueChange: function(newValue) {
* this.setState({value: newValue});
* }
* });
*
* We have provided some sugary mixins to make the creation and
* consumption of ReactLink easier; see LinkedValueUtils and LinkedStateMixin.
*/
var React = _dereq_(26);
/**
* @param {*} value current value of the link
* @param {function} requestChange callback to request a change
*/
function ReactLink(value, requestChange) {
this.value = value;
this.requestChange = requestChange;
}
/**
* Creates a PropType that enforces the ReactLink API and optionally checks the
* type of the value being passed inside the link. Example:
*
* MyComponent.propTypes = {
* tabIndexLink: ReactLink.PropTypes.link(React.PropTypes.number)
* }
*/
function createLinkTypeChecker(linkType) {
var shapes = {
value: typeof linkType === 'undefined' ? React.PropTypes.any.isRequired : linkType.isRequired,
requestChange: React.PropTypes.func.isRequired
};
return React.PropTypes.shape(shapes);
}
ReactLink.PropTypes = {
link: createLinkTypeChecker
};
module.exports = ReactLink;
},{"26":26}],71:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMarkupChecksum
*/
'use strict';
var adler32 = _dereq_(116);
var TAG_END = /\/?>/;
var ReactMarkupChecksum = {
CHECKSUM_ATTR_NAME: 'data-react-checksum',
/**
* @param {string} markup Markup string
* @return {string} Markup string with checksum attribute attached
*/
addChecksumToMarkup: function (markup) {
var checksum = adler32(markup);
// Add checksum (handle both parent tags and self-closing tags)
return markup.replace(TAG_END, ' ' + ReactMarkupChecksum.CHECKSUM_ATTR_NAME + '="' + checksum + '"$&');
},
/**
* @param {string} markup to use
* @param {DOMElement} element root React element
* @returns {boolean} whether or not the markup is the same
*/
canReuseMarkup: function (markup, element) {
var existingChecksum = element.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
existingChecksum = existingChecksum && parseInt(existingChecksum, 10);
var markupChecksum = adler32(markup);
return markupChecksum === existingChecksum;
}
};
module.exports = ReactMarkupChecksum;
},{"116":116}],72:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMount
*/
'use strict';
var DOMProperty = _dereq_(10);
var ReactBrowserEventEmitter = _dereq_(28);
var ReactCurrentOwner = _dereq_(39);
var ReactDOMFeatureFlags = _dereq_(44);
var ReactElement = _dereq_(57);
var ReactEmptyComponentRegistry = _dereq_(60);
var ReactInstanceHandles = _dereq_(67);
var ReactInstanceMap = _dereq_(68);
var ReactMarkupChecksum = _dereq_(71);
var ReactPerf = _dereq_(78);
var ReactReconciler = _dereq_(84);
var ReactUpdateQueue = _dereq_(95);
var ReactUpdates = _dereq_(96);
var assign = _dereq_(24);
var emptyObject = _dereq_(153);
var containsNode = _dereq_(149);
var instantiateReactComponent = _dereq_(131);
var invariant = _dereq_(160);
var setInnerHTML = _dereq_(137);
var shouldUpdateReactComponent = _dereq_(140);
var validateDOMNesting = _dereq_(143);
var warning = _dereq_(172);
var ATTR_NAME = DOMProperty.ID_ATTRIBUTE_NAME;
var nodeCache = {};
var ELEMENT_NODE_TYPE = 1;
var DOC_NODE_TYPE = 9;
var DOCUMENT_FRAGMENT_NODE_TYPE = 11;
var ownerDocumentContextKey = '__ReactMount_ownerDocument$' + Math.random().toString(36).slice(2);
/** Mapping from reactRootID to React component instance. */
var instancesByReactRootID = {};
/** Mapping from reactRootID to `container` nodes. */
var containersByReactRootID = {};
if ("development" !== 'production') {
/** __DEV__-only mapping from reactRootID to root elements. */
var rootElementsByReactRootID = {};
}
// Used to store breadth-first search state in findComponentRoot.
var findComponentRootReusableArray = [];
/**
* Finds the index of the first character
* that's not common between the two given strings.
*
* @return {number} the index of the character where the strings diverge
*/
function firstDifferenceIndex(string1, string2) {
var minLen = Math.min(string1.length, string2.length);
for (var i = 0; i < minLen; i++) {
if (string1.charAt(i) !== string2.charAt(i)) {
return i;
}
}
return string1.length === string2.length ? -1 : minLen;
}
/**
* @param {DOMElement|DOMDocument} container DOM element that may contain
* a React component
* @return {?*} DOM element that may have the reactRoot ID, or null.
*/
function getReactRootElementInContainer(container) {
if (!container) {
return null;
}
if (container.nodeType === DOC_NODE_TYPE) {
return container.documentElement;
} else {
return container.firstChild;
}
}
/**
* @param {DOMElement} container DOM element that may contain a React component.
* @return {?string} A "reactRoot" ID, if a React component is rendered.
*/
function getReactRootID(container) {
var rootElement = getReactRootElementInContainer(container);
return rootElement && ReactMount.getID(rootElement);
}
/**
* Accessing node[ATTR_NAME] or calling getAttribute(ATTR_NAME) on a form
* element can return its control whose name or ID equals ATTR_NAME. All
* DOM nodes support `getAttributeNode` but this can also get called on
* other objects so just return '' if we're given something other than a
* DOM node (such as window).
*
* @param {?DOMElement|DOMWindow|DOMDocument|DOMTextNode} node DOM node.
* @return {string} ID of the supplied `domNode`.
*/
function getID(node) {
var id = internalGetID(node);
if (id) {
if (nodeCache.hasOwnProperty(id)) {
var cached = nodeCache[id];
if (cached !== node) {
!!isValid(cached, id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Two valid but unequal nodes with the same `%s`: %s', ATTR_NAME, id) : invariant(false) : undefined;
nodeCache[id] = node;
}
} else {
nodeCache[id] = node;
}
}
return id;
}
function internalGetID(node) {
// If node is something like a window, document, or text node, none of
// which support attributes or a .getAttribute method, gracefully return
// the empty string, as if the attribute were missing.
return node && node.getAttribute && node.getAttribute(ATTR_NAME) || '';
}
/**
* Sets the React-specific ID of the given node.
*
* @param {DOMElement} node The DOM node whose ID will be set.
* @param {string} id The value of the ID attribute.
*/
function setID(node, id) {
var oldID = internalGetID(node);
if (oldID !== id) {
delete nodeCache[oldID];
}
node.setAttribute(ATTR_NAME, id);
nodeCache[id] = node;
}
/**
* Finds the node with the supplied React-generated DOM ID.
*
* @param {string} id A React-generated DOM ID.
* @return {DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNode(id) {
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* Finds the node with the supplied public React instance.
*
* @param {*} instance A public React instance.
* @return {?DOMElement} DOM node with the suppled `id`.
* @internal
*/
function getNodeFromInstance(instance) {
var id = ReactInstanceMap.get(instance)._rootNodeID;
if (ReactEmptyComponentRegistry.isNullComponentID(id)) {
return null;
}
if (!nodeCache.hasOwnProperty(id) || !isValid(nodeCache[id], id)) {
nodeCache[id] = ReactMount.findReactNodeByID(id);
}
return nodeCache[id];
}
/**
* A node is "valid" if it is contained by a currently mounted container.
*
* This means that the node does not have to be contained by a document in
* order to be considered valid.
*
* @param {?DOMElement} node The candidate DOM node.
* @param {string} id The expected ID of the node.
* @return {boolean} Whether the node is contained by a mounted container.
*/
function isValid(node, id) {
if (node) {
!(internalGetID(node) === id) ? "development" !== 'production' ? invariant(false, 'ReactMount: Unexpected modification of `%s`', ATTR_NAME) : invariant(false) : undefined;
var container = ReactMount.findReactContainerForID(id);
if (container && containsNode(container, node)) {
return true;
}
}
return false;
}
/**
* Causes the cache to forget about one React-specific ID.
*
* @param {string} id The ID to forget.
*/
function purgeID(id) {
delete nodeCache[id];
}
var deepestNodeSoFar = null;
function findDeepestCachedAncestorImpl(ancestorID) {
var ancestor = nodeCache[ancestorID];
if (ancestor && isValid(ancestor, ancestorID)) {
deepestNodeSoFar = ancestor;
} else {
// This node isn't populated in the cache, so presumably none of its
// descendants are. Break out of the loop.
return false;
}
}
/**
* Return the deepest cached node whose ID is a prefix of `targetID`.
*/
function findDeepestCachedAncestor(targetID) {
deepestNodeSoFar = null;
ReactInstanceHandles.traverseAncestors(targetID, findDeepestCachedAncestorImpl);
var foundNode = deepestNodeSoFar;
deepestNodeSoFar = null;
return foundNode;
}
/**
* Mounts this component and inserts it into the DOM.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {ReactReconcileTransaction} transaction
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function mountComponentIntoNode(componentInstance, rootID, container, transaction, shouldReuseMarkup, context) {
if (ReactDOMFeatureFlags.useCreateElement) {
context = assign({}, context);
if (container.nodeType === DOC_NODE_TYPE) {
context[ownerDocumentContextKey] = container;
} else {
context[ownerDocumentContextKey] = container.ownerDocument;
}
}
if ("development" !== 'production') {
if (context === emptyObject) {
context = {};
}
var tag = container.nodeName.toLowerCase();
context[validateDOMNesting.ancestorInfoContextKey] = validateDOMNesting.updatedAncestorInfo(null, tag, null);
}
var markup = ReactReconciler.mountComponent(componentInstance, rootID, transaction, context);
componentInstance._renderedComponent._topLevelWrapper = componentInstance;
ReactMount._mountImageIntoNode(markup, container, shouldReuseMarkup, transaction);
}
/**
* Batched mount.
*
* @param {ReactComponent} componentInstance The instance to mount.
* @param {string} rootID DOM ID of the root node.
* @param {DOMElement} container DOM element to mount into.
* @param {boolean} shouldReuseMarkup If true, do not insert markup
*/
function batchedMountComponentIntoNode(componentInstance, rootID, container, shouldReuseMarkup, context) {
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(
/* forceHTML */shouldReuseMarkup);
transaction.perform(mountComponentIntoNode, null, componentInstance, rootID, container, transaction, shouldReuseMarkup, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
}
/**
* Unmounts a component and removes it from the DOM.
*
* @param {ReactComponent} instance React component instance.
* @param {DOMElement} container DOM element to unmount from.
* @final
* @internal
* @see {ReactMount.unmountComponentAtNode}
*/
function unmountComponentFromNode(instance, container) {
ReactReconciler.unmountComponent(instance);
if (container.nodeType === DOC_NODE_TYPE) {
container = container.documentElement;
}
// http://jsperf.com/emptying-a-node
while (container.lastChild) {
container.removeChild(container.lastChild);
}
}
/**
* True if the supplied DOM node has a direct React-rendered child that is
* not a React root element. Useful for warning in `render`,
* `unmountComponentAtNode`, etc.
*
* @param {?DOMElement} node The candidate DOM node.
* @return {boolean} True if the DOM element contains a direct child that was
* rendered by React but is not a root element.
* @internal
*/
function hasNonRootReactChild(node) {
var reactRootID = getReactRootID(node);
return reactRootID ? reactRootID !== ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID) : false;
}
/**
* Returns the first (deepest) ancestor of a node which is rendered by this copy
* of React.
*/
function findFirstReactDOMImpl(node) {
// This node might be from another React instance, so we make sure not to
// examine the node cache here
for (; node && node.parentNode !== node; node = node.parentNode) {
if (node.nodeType !== 1) {
// Not a DOMElement, therefore not a React component
continue;
}
var nodeID = internalGetID(node);
if (!nodeID) {
continue;
}
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
// If containersByReactRootID contains the container we find by crawling up
// the tree, we know that this instance of React rendered the node.
// nb. isValid's strategy (with containsNode) does not work because render
// trees may be nested and we don't want a false positive in that case.
var current = node;
var lastID;
do {
lastID = internalGetID(current);
current = current.parentNode;
if (current == null) {
// The passed-in node has been detached from the container it was
// originally rendered into.
return null;
}
} while (lastID !== reactRootID);
if (current === containersByReactRootID[reactRootID]) {
return node;
}
}
return null;
}
/**
* Temporary (?) hack so that we can store all top-level pending updates on
* composites instead of having to worry about different types of components
* here.
*/
var TopLevelWrapper = function () {};
TopLevelWrapper.prototype.isReactComponent = {};
if ("development" !== 'production') {
TopLevelWrapper.displayName = 'TopLevelWrapper';
}
TopLevelWrapper.prototype.render = function () {
// this.props is actually a ReactElement
return this.props;
};
/**
* Mounting is the process of initializing a React component by creating its
* representative DOM elements and inserting them into a supplied `container`.
* Any prior content inside `container` is destroyed in the process.
*
* ReactMount.render(
* component,
* document.getElementById('container')
* );
*
* <div id="container"> <-- Supplied `container`.
* <div data-reactid=".3"> <-- Rendered reactRoot of React
* // ... component.
* </div>
* </div>
*
* Inside of `container`, the first element rendered is the "reactRoot".
*/
var ReactMount = {
TopLevelWrapper: TopLevelWrapper,
/** Exposed for debugging purposes **/
_instancesByReactRootID: instancesByReactRootID,
/**
* This is a hook provided to support rendering React components while
* ensuring that the apparent scroll position of its `container` does not
* change.
*
* @param {DOMElement} container The `container` being rendered into.
* @param {function} renderCallback This must be called once to do the render.
*/
scrollMonitor: function (container, renderCallback) {
renderCallback();
},
/**
* Take a component that's already mounted into the DOM and replace its props
* @param {ReactComponent} prevComponent component instance already in the DOM
* @param {ReactElement} nextElement component instance to render
* @param {DOMElement} container container to render into
* @param {?function} callback function triggered on completion
*/
_updateRootComponent: function (prevComponent, nextElement, container, callback) {
ReactMount.scrollMonitor(container, function () {
ReactUpdateQueue.enqueueElementInternal(prevComponent, nextElement);
if (callback) {
ReactUpdateQueue.enqueueCallbackInternal(prevComponent, callback);
}
});
if ("development" !== 'production') {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[getReactRootID(container)] = getReactRootElementInContainer(container);
}
return prevComponent;
},
/**
* Register a component into the instance map and starts scroll value
* monitoring
* @param {ReactComponent} nextComponent component instance to render
* @param {DOMElement} container container to render into
* @return {string} reactRoot ID prefix
*/
_registerComponent: function (nextComponent, container) {
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, '_registerComponent(...): Target container is not a DOM element.') : invariant(false) : undefined;
ReactBrowserEventEmitter.ensureScrollValueMonitoring();
var reactRootID = ReactMount.registerContainer(container);
instancesByReactRootID[reactRootID] = nextComponent;
return reactRootID;
},
/**
* Render a new component into the DOM.
* @param {ReactElement} nextElement element to render
* @param {DOMElement} container container to render into
* @param {boolean} shouldReuseMarkup if we should skip the markup insertion
* @return {ReactComponent} nextComponent
*/
_renderNewRootComponent: function (nextElement, container, shouldReuseMarkup, context) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case.
"development" !== 'production' ? warning(ReactCurrentOwner.current == null, '_renderNewRootComponent(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from ' + 'render is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
var componentInstance = instantiateReactComponent(nextElement, null);
var reactRootID = ReactMount._registerComponent(componentInstance, container);
// The initial render is synchronous but any updates that happen during
// rendering, in componentWillMount or componentDidMount, will be batched
// according to the current batching strategy.
ReactUpdates.batchedUpdates(batchedMountComponentIntoNode, componentInstance, reactRootID, container, shouldReuseMarkup, context);
if ("development" !== 'production') {
// Record the root element in case it later gets transplanted.
rootElementsByReactRootID[reactRootID] = getReactRootElementInContainer(container);
}
return componentInstance;
},
/**
* Renders a React component into the DOM in the supplied `container`.
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {ReactComponent} parentComponent The conceptual parent of this render tree.
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
!(parentComponent != null && parentComponent._reactInternalInstance != null) ? "development" !== 'production' ? invariant(false, 'parentComponent must be a valid React Component') : invariant(false) : undefined;
return ReactMount._renderSubtreeIntoContainer(parentComponent, nextElement, container, callback);
},
_renderSubtreeIntoContainer: function (parentComponent, nextElement, container, callback) {
!ReactElement.isValidElement(nextElement) ? "development" !== 'production' ? invariant(false, 'ReactDOM.render(): Invalid component element.%s', typeof nextElement === 'string' ? ' Instead of passing an element string, make sure to instantiate ' + 'it by passing it to React.createElement.' : typeof nextElement === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' :
// Check if it quacks like an element
nextElement != null && nextElement.props !== undefined ? ' This may be caused by unintentionally loading two independent ' + 'copies of React.' : '') : invariant(false) : undefined;
"development" !== 'production' ? warning(!container || !container.tagName || container.tagName.toUpperCase() !== 'BODY', 'render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.') : undefined;
var nextWrappedElement = new ReactElement(TopLevelWrapper, null, null, null, null, null, nextElement);
var prevComponent = instancesByReactRootID[getReactRootID(container)];
if (prevComponent) {
var prevWrappedElement = prevComponent._currentElement;
var prevElement = prevWrappedElement.props;
if (shouldUpdateReactComponent(prevElement, nextElement)) {
return ReactMount._updateRootComponent(prevComponent, nextWrappedElement, container, callback)._renderedComponent.getPublicInstance();
} else {
ReactMount.unmountComponentAtNode(container);
}
}
var reactRootElement = getReactRootElementInContainer(container);
var containerHasReactMarkup = reactRootElement && !!internalGetID(reactRootElement);
var containerHasNonRootReactChild = hasNonRootReactChild(container);
if ("development" !== 'production') {
"development" !== 'production' ? warning(!containerHasNonRootReactChild, 'render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.') : undefined;
if (!containerHasReactMarkup || reactRootElement.nextSibling) {
var rootElementSibling = reactRootElement;
while (rootElementSibling) {
if (internalGetID(rootElementSibling)) {
"development" !== 'production' ? warning(false, 'render(): Target node has markup rendered by React, but there ' + 'are unrelated nodes as well. This is most commonly caused by ' + 'white-space inserted around server-rendered markup.') : undefined;
break;
}
rootElementSibling = rootElementSibling.nextSibling;
}
}
}
var shouldReuseMarkup = containerHasReactMarkup && !prevComponent && !containerHasNonRootReactChild;
var component = ReactMount._renderNewRootComponent(nextWrappedElement, container, shouldReuseMarkup, parentComponent != null ? parentComponent._reactInternalInstance._processChildContext(parentComponent._reactInternalInstance._context) : emptyObject)._renderedComponent.getPublicInstance();
if (callback) {
callback.call(component);
}
return component;
},
/**
* Renders a React component into the DOM in the supplied `container`.
*
* If the React component was previously rendered into `container`, this will
* perform an update on it and only mutate the DOM as necessary to reflect the
* latest React component.
*
* @param {ReactElement} nextElement Component element to render.
* @param {DOMElement} container DOM element to render into.
* @param {?function} callback function triggered on completion
* @return {ReactComponent} Component instance rendered in `container`.
*/
render: function (nextElement, container, callback) {
return ReactMount._renderSubtreeIntoContainer(null, nextElement, container, callback);
},
/**
* Registers a container node into which React components will be rendered.
* This also creates the "reactRoot" ID that will be assigned to the element
* rendered within.
*
* @param {DOMElement} container DOM element to register as a container.
* @return {string} The "reactRoot" ID of elements rendered within.
*/
registerContainer: function (container) {
var reactRootID = getReactRootID(container);
if (reactRootID) {
// If one exists, make sure it is a valid "reactRoot" ID.
reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(reactRootID);
}
if (!reactRootID) {
// No valid "reactRoot" ID found, create one.
reactRootID = ReactInstanceHandles.createReactRootID();
}
containersByReactRootID[reactRootID] = container;
return reactRootID;
},
/**
* Unmounts and destroys the React component rendered in the `container`.
*
* @param {DOMElement} container DOM element containing a React component.
* @return {boolean} True if a component was found in and unmounted from
* `container`
*/
unmountComponentAtNode: function (container) {
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (Strictly speaking, unmounting won't cause a
// render but we still don't expect to be in a render call here.)
"development" !== 'production' ? warning(ReactCurrentOwner.current == null, 'unmountComponentAtNode(): Render methods should be a pure function ' + 'of props and state; triggering nested component updates from render ' + 'is not allowed. If necessary, trigger nested updates in ' + 'componentDidUpdate. Check the render method of %s.', ReactCurrentOwner.current && ReactCurrentOwner.current.getName() || 'ReactCompositeComponent') : undefined;
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, 'unmountComponentAtNode(...): Target container is not a DOM element.') : invariant(false) : undefined;
var reactRootID = getReactRootID(container);
var component = instancesByReactRootID[reactRootID];
if (!component) {
// Check if the node being unmounted was rendered by React, but isn't a
// root node.
var containerHasNonRootReactChild = hasNonRootReactChild(container);
// Check if the container itself is a React root node.
var containerID = internalGetID(container);
var isContainerReactRoot = containerID && containerID === ReactInstanceHandles.getReactRootIDFromNodeID(containerID);
if ("development" !== 'production') {
"development" !== 'production' ? warning(!containerHasNonRootReactChild, 'unmountComponentAtNode(): The node you\'re attempting to unmount ' + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.') : undefined;
}
return false;
}
ReactUpdates.batchedUpdates(unmountComponentFromNode, component, container);
delete instancesByReactRootID[reactRootID];
delete containersByReactRootID[reactRootID];
if ("development" !== 'production') {
delete rootElementsByReactRootID[reactRootID];
}
return true;
},
/**
* Finds the container DOM element that contains React component to which the
* supplied DOM `id` belongs.
*
* @param {string} id The ID of an element rendered by a React component.
* @return {?DOMElement} DOM element that contains the `id`.
*/
findReactContainerForID: function (id) {
var reactRootID = ReactInstanceHandles.getReactRootIDFromNodeID(id);
var container = containersByReactRootID[reactRootID];
if ("development" !== 'production') {
var rootElement = rootElementsByReactRootID[reactRootID];
if (rootElement && rootElement.parentNode !== container) {
"development" !== 'production' ? warning(
// Call internalGetID here because getID calls isValid which calls
// findReactContainerForID (this function).
internalGetID(rootElement) === reactRootID, 'ReactMount: Root element ID differed from reactRootID.') : undefined;
var containerChild = container.firstChild;
if (containerChild && reactRootID === internalGetID(containerChild)) {
// If the container has a new child with the same ID as the old
// root element, then rootElementsByReactRootID[reactRootID] is
// just stale and needs to be updated. The case that deserves a
// warning is when the container is empty.
rootElementsByReactRootID[reactRootID] = containerChild;
} else {
"development" !== 'production' ? warning(false, 'ReactMount: Root element has been removed from its original ' + 'container. New container: %s', rootElement.parentNode) : undefined;
}
}
}
return container;
},
/**
* Finds an element rendered by React with the supplied ID.
*
* @param {string} id ID of a DOM node in the React component.
* @return {DOMElement} Root DOM node of the React component.
*/
findReactNodeByID: function (id) {
var reactRoot = ReactMount.findReactContainerForID(id);
return ReactMount.findComponentRoot(reactRoot, id);
},
/**
* Traverses up the ancestors of the supplied node to find a node that is a
* DOM representation of a React component rendered by this copy of React.
*
* @param {*} node
* @return {?DOMEventTarget}
* @internal
*/
getFirstReactDOM: function (node) {
return findFirstReactDOMImpl(node);
},
/**
* Finds a node with the supplied `targetID` inside of the supplied
* `ancestorNode`. Exploits the ID naming scheme to perform the search
* quickly.
*
* @param {DOMEventTarget} ancestorNode Search from this root.
* @pararm {string} targetID ID of the DOM representation of the component.
* @return {DOMEventTarget} DOM node with the supplied `targetID`.
* @internal
*/
findComponentRoot: function (ancestorNode, targetID) {
var firstChildren = findComponentRootReusableArray;
var childIndex = 0;
var deepestAncestor = findDeepestCachedAncestor(targetID) || ancestorNode;
if ("development" !== 'production') {
// This will throw on the next line; give an early warning
"development" !== 'production' ? warning(deepestAncestor != null, 'React can\'t find the root component node for data-reactid value ' + '`%s`. If you\'re seeing this message, it probably means that ' + 'you\'ve loaded two copies of React on the page. At this time, only ' + 'a single copy of React can be loaded at a time.', targetID) : undefined;
}
firstChildren[0] = deepestAncestor.firstChild;
firstChildren.length = 1;
while (childIndex < firstChildren.length) {
var child = firstChildren[childIndex++];
var targetChild;
while (child) {
var childID = ReactMount.getID(child);
if (childID) {
// Even if we find the node we're looking for, we finish looping
// through its siblings to ensure they're cached so that we don't have
// to revisit this node again. Otherwise, we make n^2 calls to getID
// when visiting the many children of a single node in order.
if (targetID === childID) {
targetChild = child;
} else if (ReactInstanceHandles.isAncestorIDOf(childID, targetID)) {
// If we find a child whose ID is an ancestor of the given ID,
// then we can be sure that we only want to search the subtree
// rooted at this child, so we can throw out the rest of the
// search state.
firstChildren.length = childIndex = 0;
firstChildren.push(child.firstChild);
}
} else {
// If this child had no ID, then there's a chance that it was
// injected automatically by the browser, as when a `<table>`
// element sprouts an extra `<tbody>` child as a side effect of
// `.innerHTML` parsing. Optimistically continue down this
// branch, but not before examining the other siblings.
firstChildren.push(child.firstChild);
}
child = child.nextSibling;
}
if (targetChild) {
// Emptying firstChildren/findComponentRootReusableArray is
// not necessary for correctness, but it helps the GC reclaim
// any nodes that were left at the end of the search.
firstChildren.length = 0;
return targetChild;
}
}
firstChildren.length = 0;
!false ? "development" !== 'production' ? invariant(false, 'findComponentRoot(..., %s): Unable to find element. This probably ' + 'means the DOM was unexpectedly mutated (e.g., by the browser), ' + 'usually due to forgetting a <tbody> when using tables, nesting tags ' + 'like <form>, <p>, or <a>, or using non-SVG elements in an <svg> ' + 'parent. ' + 'Try inspecting the child nodes of the element with React ID `%s`.', targetID, ReactMount.getID(ancestorNode)) : invariant(false) : undefined;
},
_mountImageIntoNode: function (markup, container, shouldReuseMarkup, transaction) {
!(container && (container.nodeType === ELEMENT_NODE_TYPE || container.nodeType === DOC_NODE_TYPE || container.nodeType === DOCUMENT_FRAGMENT_NODE_TYPE)) ? "development" !== 'production' ? invariant(false, 'mountComponentIntoNode(...): Target container is not valid.') : invariant(false) : undefined;
if (shouldReuseMarkup) {
var rootElement = getReactRootElementInContainer(container);
if (ReactMarkupChecksum.canReuseMarkup(markup, rootElement)) {
return;
} else {
var checksum = rootElement.getAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
rootElement.removeAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME);
var rootMarkup = rootElement.outerHTML;
rootElement.setAttribute(ReactMarkupChecksum.CHECKSUM_ATTR_NAME, checksum);
var normalizedMarkup = markup;
if ("development" !== 'production') {
// because rootMarkup is retrieved from the DOM, various normalizations
// will have occurred which will not be present in `markup`. Here,
// insert markup into a <div> or <iframe> depending on the container
// type to perform the same normalizations before comparing.
var normalizer;
if (container.nodeType === ELEMENT_NODE_TYPE) {
normalizer = document.createElement('div');
normalizer.innerHTML = markup;
normalizedMarkup = normalizer.innerHTML;
} else {
normalizer = document.createElement('iframe');
document.body.appendChild(normalizer);
normalizer.contentDocument.write(markup);
normalizedMarkup = normalizer.contentDocument.documentElement.outerHTML;
document.body.removeChild(normalizer);
}
}
var diffIndex = firstDifferenceIndex(normalizedMarkup, rootMarkup);
var difference = ' (client) ' + normalizedMarkup.substring(diffIndex - 20, diffIndex + 20) + '\n (server) ' + rootMarkup.substring(diffIndex - 20, diffIndex + 20);
!(container.nodeType !== DOC_NODE_TYPE) ? "development" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document using ' + 'server rendering but the checksum was invalid. This usually ' + 'means you rendered a different component type or props on ' + 'the client from the one on the server, or your render() ' + 'methods are impure. React cannot handle this case due to ' + 'cross-browser quirks by rendering at the document root. You ' + 'should look for environment dependent code in your components ' + 'and ensure the props are the same client and server side:\n%s', difference) : invariant(false) : undefined;
if ("development" !== 'production') {
"development" !== 'production' ? warning(false, 'React attempted to reuse markup in a container but the ' + 'checksum was invalid. This generally means that you are ' + 'using server rendering and the markup generated on the ' + 'server was not what the client was expecting. React injected ' + 'new markup to compensate which works but you have lost many ' + 'of the benefits of server rendering. Instead, figure out ' + 'why the markup being generated is different on the client ' + 'or server:\n%s', difference) : undefined;
}
}
}
!(container.nodeType !== DOC_NODE_TYPE) ? "development" !== 'production' ? invariant(false, 'You\'re trying to render a component to the document but ' + 'you didn\'t use server rendering. We can\'t do this ' + 'without using server rendering due to cross-browser quirks. ' + 'See ReactDOMServer.renderToString() for server rendering.') : invariant(false) : undefined;
if (transaction.useCreateElement) {
while (container.lastChild) {
container.removeChild(container.lastChild);
}
container.appendChild(markup);
} else {
setInnerHTML(container, markup);
}
},
ownerDocumentContextKey: ownerDocumentContextKey,
/**
* React ID utilities.
*/
getReactRootID: getReactRootID,
getID: getID,
setID: setID,
getNode: getNode,
getNodeFromInstance: getNodeFromInstance,
isValid: isValid,
purgeID: purgeID
};
ReactPerf.measureMethods(ReactMount, 'ReactMount', {
_renderNewRootComponent: '_renderNewRootComponent',
_mountImageIntoNode: '_mountImageIntoNode'
});
module.exports = ReactMount;
},{"10":10,"131":131,"137":137,"140":140,"143":143,"149":149,"153":153,"160":160,"172":172,"24":24,"28":28,"39":39,"44":44,"57":57,"60":60,"67":67,"68":68,"71":71,"78":78,"84":84,"95":95,"96":96}],73:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMultiChild
* @typechecks static-only
*/
'use strict';
var ReactComponentEnvironment = _dereq_(36);
var ReactMultiChildUpdateTypes = _dereq_(74);
var ReactCurrentOwner = _dereq_(39);
var ReactReconciler = _dereq_(84);
var ReactChildReconciler = _dereq_(31);
var flattenChildren = _dereq_(122);
/**
* Updating children of a component may trigger recursive updates. The depth is
* used to batch recursive updates to render markup more efficiently.
*
* @type {number}
* @private
*/
var updateDepth = 0;
/**
* Queue of update configuration objects.
*
* Each object has a `type` property that is in `ReactMultiChildUpdateTypes`.
*
* @type {array<object>}
* @private
*/
var updateQueue = [];
/**
* Queue of markup to be rendered.
*
* @type {array<string>}
* @private
*/
var markupQueue = [];
/**
* Enqueues markup to be rendered and inserted at a supplied index.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @param {number} toIndex Destination index.
* @private
*/
function enqueueInsertMarkup(parentID, markup, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.INSERT_MARKUP,
markupIndex: markupQueue.push(markup) - 1,
content: null,
fromIndex: null,
toIndex: toIndex
});
}
/**
* Enqueues moving an existing element to another index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Source index of the existing element.
* @param {number} toIndex Destination index of the element.
* @private
*/
function enqueueMove(parentID, fromIndex, toIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.MOVE_EXISTING,
markupIndex: null,
content: null,
fromIndex: fromIndex,
toIndex: toIndex
});
}
/**
* Enqueues removing an element at an index.
*
* @param {string} parentID ID of the parent component.
* @param {number} fromIndex Index of the element to remove.
* @private
*/
function enqueueRemove(parentID, fromIndex) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.REMOVE_NODE,
markupIndex: null,
content: null,
fromIndex: fromIndex,
toIndex: null
});
}
/**
* Enqueues setting the markup of a node.
*
* @param {string} parentID ID of the parent component.
* @param {string} markup Markup that renders into an element.
* @private
*/
function enqueueSetMarkup(parentID, markup) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.SET_MARKUP,
markupIndex: null,
content: markup,
fromIndex: null,
toIndex: null
});
}
/**
* Enqueues setting the text content.
*
* @param {string} parentID ID of the parent component.
* @param {string} textContent Text content to set.
* @private
*/
function enqueueTextContent(parentID, textContent) {
// NOTE: Null values reduce hidden classes.
updateQueue.push({
parentID: parentID,
parentNode: null,
type: ReactMultiChildUpdateTypes.TEXT_CONTENT,
markupIndex: null,
content: textContent,
fromIndex: null,
toIndex: null
});
}
/**
* Processes any enqueued updates.
*
* @private
*/
function processQueue() {
if (updateQueue.length) {
ReactComponentEnvironment.processChildrenUpdates(updateQueue, markupQueue);
clearQueue();
}
}
/**
* Clears any enqueued updates.
*
* @private
*/
function clearQueue() {
updateQueue.length = 0;
markupQueue.length = 0;
}
/**
* ReactMultiChild are capable of reconciling multiple children.
*
* @class ReactMultiChild
* @internal
*/
var ReactMultiChild = {
/**
* Provides common functionality for components that must reconcile multiple
* children. This is used by `ReactDOMComponent` to mount, update, and
* unmount child components.
*
* @lends {ReactMultiChild.prototype}
*/
Mixin: {
_reconcilerInstantiateChildren: function (nestedChildren, transaction, context) {
if ("development" !== 'production') {
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
} finally {
ReactCurrentOwner.current = null;
}
}
}
return ReactChildReconciler.instantiateChildren(nestedChildren, transaction, context);
},
_reconcilerUpdateChildren: function (prevChildren, nextNestedChildrenElements, transaction, context) {
var nextChildren;
if ("development" !== 'production') {
if (this._currentElement) {
try {
ReactCurrentOwner.current = this._currentElement._owner;
nextChildren = flattenChildren(nextNestedChildrenElements);
} finally {
ReactCurrentOwner.current = null;
}
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
}
}
nextChildren = flattenChildren(nextNestedChildrenElements);
return ReactChildReconciler.updateChildren(prevChildren, nextChildren, transaction, context);
},
/**
* Generates a "mount image" for each of the supplied children. In the case
* of `ReactDOMComponent`, a mount image is a string of markup.
*
* @param {?object} nestedChildren Nested child maps.
* @return {array} An array of mounted representations.
* @internal
*/
mountChildren: function (nestedChildren, transaction, context) {
var children = this._reconcilerInstantiateChildren(nestedChildren, transaction, context);
this._renderedChildren = children;
var mountImages = [];
var index = 0;
for (var name in children) {
if (children.hasOwnProperty(name)) {
var child = children[name];
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index++;
mountImages.push(mountImage);
}
}
return mountImages;
},
/**
* Replaces any rendered children with a text content string.
*
* @param {string} nextContent String of content.
* @internal
*/
updateTextContent: function (nextContent) {
updateDepth++;
var errorThrown = true;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren);
// TODO: The setTextContent operation should be enough
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChild(prevChildren[name]);
}
}
// Set new text content.
this.setTextContent(nextContent);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Replaces any rendered children with a markup string.
*
* @param {string} nextMarkup String of markup.
* @internal
*/
updateMarkup: function (nextMarkup) {
updateDepth++;
var errorThrown = true;
try {
var prevChildren = this._renderedChildren;
// Remove any rendered children.
ReactChildReconciler.unmountChildren(prevChildren);
for (var name in prevChildren) {
if (prevChildren.hasOwnProperty(name)) {
this._unmountChildByName(prevChildren[name], name);
}
}
this.setMarkup(nextMarkup);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Updates the rendered children with new children.
*
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @internal
*/
updateChildren: function (nextNestedChildrenElements, transaction, context) {
updateDepth++;
var errorThrown = true;
try {
this._updateChildren(nextNestedChildrenElements, transaction, context);
errorThrown = false;
} finally {
updateDepth--;
if (!updateDepth) {
if (errorThrown) {
clearQueue();
} else {
processQueue();
}
}
}
},
/**
* Improve performance by isolating this hot code path from the try/catch
* block in `updateChildren`.
*
* @param {?object} nextNestedChildrenElements Nested child element maps.
* @param {ReactReconcileTransaction} transaction
* @final
* @protected
*/
_updateChildren: function (nextNestedChildrenElements, transaction, context) {
var prevChildren = this._renderedChildren;
var nextChildren = this._reconcilerUpdateChildren(prevChildren, nextNestedChildrenElements, transaction, context);
this._renderedChildren = nextChildren;
if (!nextChildren && !prevChildren) {
return;
}
var name;
// `nextIndex` will increment for each child in `nextChildren`, but
// `lastIndex` will be the last index visited in `prevChildren`.
var lastIndex = 0;
var nextIndex = 0;
for (name in nextChildren) {
if (!nextChildren.hasOwnProperty(name)) {
continue;
}
var prevChild = prevChildren && prevChildren[name];
var nextChild = nextChildren[name];
if (prevChild === nextChild) {
this.moveChild(prevChild, nextIndex, lastIndex);
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
prevChild._mountIndex = nextIndex;
} else {
if (prevChild) {
// Update `lastIndex` before `_mountIndex` gets unset by unmounting.
lastIndex = Math.max(prevChild._mountIndex, lastIndex);
this._unmountChild(prevChild);
}
// The child must be instantiated before it's mounted.
this._mountChildByNameAtIndex(nextChild, name, nextIndex, transaction, context);
}
nextIndex++;
}
// Remove children that are no longer present.
for (name in prevChildren) {
if (prevChildren.hasOwnProperty(name) && !(nextChildren && nextChildren.hasOwnProperty(name))) {
this._unmountChild(prevChildren[name]);
}
}
},
/**
* Unmounts all rendered children. This should be used to clean up children
* when this component is unmounted.
*
* @internal
*/
unmountChildren: function () {
var renderedChildren = this._renderedChildren;
ReactChildReconciler.unmountChildren(renderedChildren);
this._renderedChildren = null;
},
/**
* Moves a child component to the supplied index.
*
* @param {ReactComponent} child Component to move.
* @param {number} toIndex Destination index of the element.
* @param {number} lastIndex Last index visited of the siblings of `child`.
* @protected
*/
moveChild: function (child, toIndex, lastIndex) {
// If the index of `child` is less than `lastIndex`, then it needs to
// be moved. Otherwise, we do not need to move it because a child will be
// inserted or moved before `child`.
if (child._mountIndex < lastIndex) {
enqueueMove(this._rootNodeID, child._mountIndex, toIndex);
}
},
/**
* Creates a child component.
*
* @param {ReactComponent} child Component to create.
* @param {string} mountImage Markup to insert.
* @protected
*/
createChild: function (child, mountImage) {
enqueueInsertMarkup(this._rootNodeID, mountImage, child._mountIndex);
},
/**
* Removes a child component.
*
* @param {ReactComponent} child Child to remove.
* @protected
*/
removeChild: function (child) {
enqueueRemove(this._rootNodeID, child._mountIndex);
},
/**
* Sets this text content string.
*
* @param {string} textContent Text content to set.
* @protected
*/
setTextContent: function (textContent) {
enqueueTextContent(this._rootNodeID, textContent);
},
/**
* Sets this markup string.
*
* @param {string} markup Markup to set.
* @protected
*/
setMarkup: function (markup) {
enqueueSetMarkup(this._rootNodeID, markup);
},
/**
* Mounts a child with the supplied name.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to mount.
* @param {string} name Name of the child.
* @param {number} index Index at which to insert the child.
* @param {ReactReconcileTransaction} transaction
* @private
*/
_mountChildByNameAtIndex: function (child, name, index, transaction, context) {
// Inlined for performance, see `ReactInstanceHandles.createReactID`.
var rootID = this._rootNodeID + name;
var mountImage = ReactReconciler.mountComponent(child, rootID, transaction, context);
child._mountIndex = index;
this.createChild(child, mountImage);
},
/**
* Unmounts a rendered child.
*
* NOTE: This is part of `updateChildren` and is here for readability.
*
* @param {ReactComponent} child Component to unmount.
* @private
*/
_unmountChild: function (child) {
this.removeChild(child);
child._mountIndex = null;
}
}
};
module.exports = ReactMultiChild;
},{"122":122,"31":31,"36":36,"39":39,"74":74,"84":84}],74:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactMultiChildUpdateTypes
*/
'use strict';
var keyMirror = _dereq_(164);
/**
* When a component's children are updated, a series of update configuration
* objects are created in order to batch and serialize the required changes.
*
* Enumerates all the possible types of update configurations.
*
* @internal
*/
var ReactMultiChildUpdateTypes = keyMirror({
INSERT_MARKUP: null,
MOVE_EXISTING: null,
REMOVE_NODE: null,
SET_MARKUP: null,
TEXT_CONTENT: null
});
module.exports = ReactMultiChildUpdateTypes;
},{"164":164}],75:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactNativeComponent
*/
'use strict';
var assign = _dereq_(24);
var invariant = _dereq_(160);
var autoGenerateWrapperClass = null;
var genericComponentClass = null;
// This registry keeps track of wrapper classes around native tags.
var tagToComponentClass = {};
var textComponentClass = null;
var ReactNativeComponentInjection = {
// This accepts a class that receives the tag string. This is a catch all
// that can render any kind of tag.
injectGenericComponentClass: function (componentClass) {
genericComponentClass = componentClass;
},
// This accepts a text component class that takes the text string to be
// rendered as props.
injectTextComponentClass: function (componentClass) {
textComponentClass = componentClass;
},
// This accepts a keyed object with classes as values. Each key represents a
// tag. That particular tag will use this class instead of the generic one.
injectComponentClasses: function (componentClasses) {
assign(tagToComponentClass, componentClasses);
}
};
/**
* Get a composite component wrapper class for a specific tag.
*
* @param {ReactElement} element The tag for which to get the class.
* @return {function} The React class constructor function.
*/
function getComponentClassForElement(element) {
if (typeof element.type === 'function') {
return element.type;
}
var tag = element.type;
var componentClass = tagToComponentClass[tag];
if (componentClass == null) {
tagToComponentClass[tag] = componentClass = autoGenerateWrapperClass(tag);
}
return componentClass;
}
/**
* Get a native internal component class for a specific tag.
*
* @param {ReactElement} element The element to create.
* @return {function} The internal class constructor function.
*/
function createInternalComponent(element) {
!genericComponentClass ? "development" !== 'production' ? invariant(false, 'There is no registered component for the tag %s', element.type) : invariant(false) : undefined;
return new genericComponentClass(element.type, element.props);
}
/**
* @param {ReactText} text
* @return {ReactComponent}
*/
function createInstanceForText(text) {
return new textComponentClass(text);
}
/**
* @param {ReactComponent} component
* @return {boolean}
*/
function isTextComponent(component) {
return component instanceof textComponentClass;
}
var ReactNativeComponent = {
getComponentClassForElement: getComponentClassForElement,
createInternalComponent: createInternalComponent,
createInstanceForText: createInstanceForText,
isTextComponent: isTextComponent,
injection: ReactNativeComponentInjection
};
module.exports = ReactNativeComponent;
},{"160":160,"24":24}],76:[function(_dereq_,module,exports){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactNoopUpdateQueue
*/
'use strict';
var warning = _dereq_(172);
function warnTDZ(publicInstance, callerName) {
if ("development" !== 'production') {
"development" !== 'production' ? warning(false, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor && publicInstance.constructor.displayName || '') : undefined;
}
}
/**
* This is the abstract API for an update queue.
*/
var ReactNoopUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
return false;
},
/**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
* @internal
*/
enqueueCallback: function (publicInstance, callback) {},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
enqueueForceUpdate: function (publicInstance) {
warnTDZ(publicInstance, 'forceUpdate');
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState) {
warnTDZ(publicInstance, 'replaceState');
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
enqueueSetState: function (publicInstance, partialState) {
warnTDZ(publicInstance, 'setState');
},
/**
* Sets a subset of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialProps Subset of the next props.
* @internal
*/
enqueueSetProps: function (publicInstance, partialProps) {
warnTDZ(publicInstance, 'setProps');
},
/**
* Replaces all of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} props New props.
* @internal
*/
enqueueReplaceProps: function (publicInstance, props) {
warnTDZ(publicInstance, 'replaceProps');
}
};
module.exports = ReactNoopUpdateQueue;
},{"172":172}],77:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactOwner
*/
'use strict';
var invariant = _dereq_(160);
/**
* ReactOwners are capable of storing references to owned components.
*
* All components are capable of //being// referenced by owner components, but
* only ReactOwner components are capable of //referencing// owned components.
* The named reference is known as a "ref".
*
* Refs are available when mounted and updated during reconciliation.
*
* var MyComponent = React.createClass({
* render: function() {
* return (
* <div onClick={this.handleClick}>
* <CustomComponent ref="custom" />
* </div>
* );
* },
* handleClick: function() {
* this.refs.custom.handleClick();
* },
* componentDidMount: function() {
* this.refs.custom.initialize();
* }
* });
*
* Refs should rarely be used. When refs are used, they should only be done to
* control data that is not handled by React's data flow.
*
* @class ReactOwner
*/
var ReactOwner = {
/**
* @param {?object} object
* @return {boolean} True if `object` is a valid owner.
* @final
*/
isValidOwner: function (object) {
return !!(object && typeof object.attachRef === 'function' && typeof object.detachRef === 'function');
},
/**
* Adds a component by ref to an owner component.
*
* @param {ReactComponent} component Component to reference.
* @param {string} ref Name by which to refer to the component.
* @param {ReactOwner} owner Component on which to record the ref.
* @final
* @internal
*/
addComponentAsRefTo: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? "development" !== 'production' ? invariant(false, 'addComponentAsRefTo(...): Only a ReactOwner can have refs. You might ' + 'be adding a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
owner.attachRef(ref, component);
},
/**
* Removes a component by ref from an owner component.
*
* @param {ReactComponent} component Component to dereference.
* @param {string} ref Name of the ref to remove.
* @param {ReactOwner} owner Component on which the ref is recorded.
* @final
* @internal
*/
removeComponentAsRefFrom: function (component, ref, owner) {
!ReactOwner.isValidOwner(owner) ? "development" !== 'production' ? invariant(false, 'removeComponentAsRefFrom(...): Only a ReactOwner can have refs. You might ' + 'be removing a ref to a component that was not created inside a component\'s ' + '`render` method, or you have multiple copies of React loaded ' + '(details: https://fb.me/react-refs-must-have-owner).') : invariant(false) : undefined;
// Check that `component` is still the current ref because we do not want to
// detach the ref if another component stole it.
if (owner.getPublicInstance().refs[ref] === component.getPublicInstance()) {
owner.detachRef(ref);
}
}
};
module.exports = ReactOwner;
},{"160":160}],78:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPerf
* @typechecks static-only
*/
'use strict';
/**
* ReactPerf is a general AOP system designed to measure performance. This
* module only has the hooks: see ReactDefaultPerf for the analysis tool.
*/
var ReactPerf = {
/**
* Boolean to enable/disable measurement. Set to false by default to prevent
* accidental logging and perf loss.
*/
enableMeasure: false,
/**
* Holds onto the measure function in use. By default, don't measure
* anything, but we'll override this if we inject a measure function.
*/
storedMeasure: _noMeasure,
/**
* @param {object} object
* @param {string} objectName
* @param {object<string>} methodNames
*/
measureMethods: function (object, objectName, methodNames) {
if ("development" !== 'production') {
for (var key in methodNames) {
if (!methodNames.hasOwnProperty(key)) {
continue;
}
object[key] = ReactPerf.measure(objectName, methodNames[key], object[key]);
}
}
},
/**
* Use this to wrap methods you want to measure. Zero overhead in production.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
measure: function (objName, fnName, func) {
if ("development" !== 'production') {
var measuredFunc = null;
var wrapper = function () {
if (ReactPerf.enableMeasure) {
if (!measuredFunc) {
measuredFunc = ReactPerf.storedMeasure(objName, fnName, func);
}
return measuredFunc.apply(this, arguments);
}
return func.apply(this, arguments);
};
wrapper.displayName = objName + '_' + fnName;
return wrapper;
}
return func;
},
injection: {
/**
* @param {function} measure
*/
injectMeasure: function (measure) {
ReactPerf.storedMeasure = measure;
}
}
};
/**
* Simply passes through the measured function, without measuring it.
*
* @param {string} objName
* @param {string} fnName
* @param {function} func
* @return {function}
*/
function _noMeasure(objName, fnName, func) {
return func;
}
module.exports = ReactPerf;
},{}],79:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTransferer
*/
'use strict';
var assign = _dereq_(24);
var emptyFunction = _dereq_(152);
var joinClasses = _dereq_(163);
/**
* Creates a transfer strategy that will merge prop values using the supplied
* `mergeStrategy`. If a prop was previously unset, this just sets it.
*
* @param {function} mergeStrategy
* @return {function}
*/
function createTransferStrategy(mergeStrategy) {
return function (props, key, value) {
if (!props.hasOwnProperty(key)) {
props[key] = value;
} else {
props[key] = mergeStrategy(props[key], value);
}
};
}
var transferStrategyMerge = createTransferStrategy(function (a, b) {
// `merge` overrides the first object's (`props[key]` above) keys using the
// second object's (`value`) keys. An object's style's existing `propA` would
// get overridden. Flip the order here.
return assign({}, b, a);
});
/**
* Transfer strategies dictate how props are transferred by `transferPropsTo`.
* NOTE: if you add any more exceptions to this list you should be sure to
* update `cloneWithProps()` accordingly.
*/
var TransferStrategies = {
/**
* Never transfer `children`.
*/
children: emptyFunction,
/**
* Transfer the `className` prop by merging them.
*/
className: createTransferStrategy(joinClasses),
/**
* Transfer the `style` prop (which is an object) by merging them.
*/
style: transferStrategyMerge
};
/**
* Mutates the first argument by transferring the properties from the second
* argument.
*
* @param {object} props
* @param {object} newProps
* @return {object}
*/
function transferInto(props, newProps) {
for (var thisKey in newProps) {
if (!newProps.hasOwnProperty(thisKey)) {
continue;
}
var transferStrategy = TransferStrategies[thisKey];
if (transferStrategy && TransferStrategies.hasOwnProperty(thisKey)) {
transferStrategy(props, thisKey, newProps[thisKey]);
} else if (!props.hasOwnProperty(thisKey)) {
props[thisKey] = newProps[thisKey];
}
}
return props;
}
/**
* ReactPropTransferer are capable of transferring props to another component
* using a `transferPropsTo` method.
*
* @class ReactPropTransferer
*/
var ReactPropTransferer = {
/**
* Merge two props objects using TransferStrategies.
*
* @param {object} oldProps original props (they take precedence)
* @param {object} newProps new props to merge in
* @return {object} a new object containing both sets of props merged.
*/
mergeProps: function (oldProps, newProps) {
return transferInto(assign({}, oldProps), newProps);
}
};
module.exports = ReactPropTransferer;
},{"152":152,"163":163,"24":24}],80:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTypeLocationNames
*/
'use strict';
var ReactPropTypeLocationNames = {};
if ("development" !== 'production') {
ReactPropTypeLocationNames = {
prop: 'prop',
context: 'context',
childContext: 'child context'
};
}
module.exports = ReactPropTypeLocationNames;
},{}],81:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTypeLocations
*/
'use strict';
var keyMirror = _dereq_(164);
var ReactPropTypeLocations = keyMirror({
prop: null,
context: null,
childContext: null
});
module.exports = ReactPropTypeLocations;
},{"164":164}],82:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactPropTypes
*/
'use strict';
var ReactElement = _dereq_(57);
var ReactPropTypeLocationNames = _dereq_(80);
var emptyFunction = _dereq_(152);
var getIteratorFn = _dereq_(128);
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker
};
function createChainableTypeChecker(validate) {
function checkType(isRequired, props, propName, componentName, location, propFullName) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (props[propName] == null) {
var locationName = ReactPropTypeLocationNames[location];
if (isRequired) {
return new Error('Required ' + locationName + ' `' + propFullName + '` was not specified in ' + ('`' + componentName + '`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
var locationName = ReactPropTypeLocationNames[location];
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunction.thatReturns(null));
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var locationName = ReactPropTypeLocationNames[location];
var propType = getPropType(propValue);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']');
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!ReactElement.isValidElement(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var locationName = ReactPropTypeLocationNames[location];
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
return createChainableTypeChecker(function () {
return new Error('Invalid argument supplied to oneOf, expected an instance of array.');
});
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (propValue === expectedValues[i]) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
var valuesString = JSON.stringify(expectedValues);
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (propValue.hasOwnProperty(key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
return createChainableTypeChecker(function () {
return new Error('Invalid argument supplied to oneOfType, expected an instance of array.');
});
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName) == null) {
return null;
}
}
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
var locationName = ReactPropTypeLocationNames[location];
return new Error('Invalid ' + locationName + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || ReactElement.isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return '<<anonymous>>';
}
return propValue.constructor.name;
}
module.exports = ReactPropTypes;
},{"128":128,"152":152,"57":57,"80":80}],83:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactReconcileTransaction
* @typechecks static-only
*/
'use strict';
var CallbackQueue = _dereq_(6);
var PooledClass = _dereq_(25);
var ReactBrowserEventEmitter = _dereq_(28);
var ReactDOMFeatureFlags = _dereq_(44);
var ReactInputSelection = _dereq_(66);
var Transaction = _dereq_(113);
var assign = _dereq_(24);
/**
* Ensures that, when possible, the selection range (currently selected text
* input) is not disturbed by performing the transaction.
*/
var SELECTION_RESTORATION = {
/**
* @return {Selection} Selection information.
*/
initialize: ReactInputSelection.getSelectionInformation,
/**
* @param {Selection} sel Selection information returned from `initialize`.
*/
close: ReactInputSelection.restoreSelection
};
/**
* Suppresses events (blur/focus) that could be inadvertently dispatched due to
* high level DOM manipulations (like temporarily removing a text input from the
* DOM).
*/
var EVENT_SUPPRESSION = {
/**
* @return {boolean} The enabled status of `ReactBrowserEventEmitter` before
* the reconciliation.
*/
initialize: function () {
var currentlyEnabled = ReactBrowserEventEmitter.isEnabled();
ReactBrowserEventEmitter.setEnabled(false);
return currentlyEnabled;
},
/**
* @param {boolean} previouslyEnabled Enabled status of
* `ReactBrowserEventEmitter` before the reconciliation occurred. `close`
* restores the previous value.
*/
close: function (previouslyEnabled) {
ReactBrowserEventEmitter.setEnabled(previouslyEnabled);
}
};
/**
* Provides a queue for collecting `componentDidMount` and
* `componentDidUpdate` callbacks during the the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function () {
this.reactMountReady.reset();
},
/**
* After DOM is flushed, invoke all registered `onDOMReady` callbacks.
*/
close: function () {
this.reactMountReady.notifyAll();
}
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [SELECTION_RESTORATION, EVENT_SUPPRESSION, ON_DOM_READY_QUEUEING];
/**
* Currently:
* - The order that these are listed in the transaction is critical:
* - Suppresses events.
* - Restores selection range.
*
* Future:
* - Restore document/overflow scroll positions that were unintentionally
* modified via DOM insertions above the top viewport boundary.
* - Implement/integrate with customized constraint based layout system and keep
* track of which dimensions must be remeasured.
*
* @class ReactReconcileTransaction
*/
function ReactReconcileTransaction(forceHTML) {
this.reinitializeTransaction();
// Only server-side rendering really needs this option (see
// `ReactServerRendering`), but server-side uses
// `ReactServerRenderingTransaction` instead. This option is here so that it's
// accessible and defaults to false when `ReactDOMComponent` and
// `ReactTextComponent` checks it in `mountComponent`.`
this.renderToStaticMarkup = false;
this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = !forceHTML && ReactDOMFeatureFlags.useCreateElement;
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array<object>} List of operation wrap procedures.
* TODO: convert to array<TransactionWrapper>
*/
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function () {
return this.reactMountReady;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be reused.
*/
destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
}
};
assign(ReactReconcileTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactReconcileTransaction);
module.exports = ReactReconcileTransaction;
},{"113":113,"24":24,"25":25,"28":28,"44":44,"6":6,"66":66}],84:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactReconciler
*/
'use strict';
var ReactRef = _dereq_(85);
/**
* Helper to call ReactRef.attachRefs with this composite component, split out
* to avoid allocations in the transaction mount-ready queue.
*/
function attachRefs() {
ReactRef.attachRefs(this, this._currentElement);
}
var ReactReconciler = {
/**
* Initializes the component, renders markup, and registers event listeners.
*
* @param {ReactComponent} internalInstance
* @param {string} rootID DOM ID of the root node.
* @param {ReactReconcileTransaction|ReactServerRenderingTransaction} transaction
* @return {?string} Rendered markup to be inserted into the DOM.
* @final
* @internal
*/
mountComponent: function (internalInstance, rootID, transaction, context) {
var markup = internalInstance.mountComponent(rootID, transaction, context);
if (internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
return markup;
},
/**
* Releases any resources allocated by `mountComponent`.
*
* @final
* @internal
*/
unmountComponent: function (internalInstance) {
ReactRef.detachRefs(internalInstance, internalInstance._currentElement);
internalInstance.unmountComponent();
},
/**
* Update a component using a new element.
*
* @param {ReactComponent} internalInstance
* @param {ReactElement} nextElement
* @param {ReactReconcileTransaction} transaction
* @param {object} context
* @internal
*/
receiveComponent: function (internalInstance, nextElement, transaction, context) {
var prevElement = internalInstance._currentElement;
if (nextElement === prevElement && context === internalInstance._context) {
// Since elements are immutable after the owner is rendered,
// we can do a cheap identity compare here to determine if this is a
// superfluous reconcile. It's possible for state to be mutable but such
// change should trigger an update of the owner which would recreate
// the element. We explicitly check for the existence of an owner since
// it's possible for an element created outside a composite to be
// deeply mutated and reused.
// TODO: Bailing out early is just a perf optimization right?
// TODO: Removing the return statement should affect correctness?
return;
}
var refsChanged = ReactRef.shouldUpdateRefs(prevElement, nextElement);
if (refsChanged) {
ReactRef.detachRefs(internalInstance, prevElement);
}
internalInstance.receiveComponent(nextElement, transaction, context);
if (refsChanged && internalInstance._currentElement && internalInstance._currentElement.ref != null) {
transaction.getReactMountReady().enqueue(attachRefs, internalInstance);
}
},
/**
* Flush any dirty changes in a component.
*
* @param {ReactComponent} internalInstance
* @param {ReactReconcileTransaction} transaction
* @internal
*/
performUpdateIfNecessary: function (internalInstance, transaction) {
internalInstance.performUpdateIfNecessary(transaction);
}
};
module.exports = ReactReconciler;
},{"85":85}],85:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactRef
*/
'use strict';
var ReactOwner = _dereq_(77);
var ReactRef = {};
function attachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(component.getPublicInstance());
} else {
// Legacy ref
ReactOwner.addComponentAsRefTo(component, ref, owner);
}
}
function detachRef(ref, component, owner) {
if (typeof ref === 'function') {
ref(null);
} else {
// Legacy ref
ReactOwner.removeComponentAsRefFrom(component, ref, owner);
}
}
ReactRef.attachRefs = function (instance, element) {
if (element === null || element === false) {
return;
}
var ref = element.ref;
if (ref != null) {
attachRef(ref, instance, element._owner);
}
};
ReactRef.shouldUpdateRefs = function (prevElement, nextElement) {
// If either the owner or a `ref` has changed, make sure the newest owner
// has stored a reference to `this`, and the previous owner (if different)
// has forgotten the reference to `this`. We use the element instead
// of the public this.props because the post processing cannot determine
// a ref. The ref conceptually lives on the element.
// TODO: Should this even be possible? The owner cannot change because
// it's forbidden by shouldUpdateReactComponent. The ref can change
// if you swap the keys of but not the refs. Reconsider where this check
// is made. It probably belongs where the key checking and
// instantiateReactComponent is done.
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
return(
// This has a few false positives w/r/t empty components.
prevEmpty || nextEmpty || nextElement._owner !== prevElement._owner || nextElement.ref !== prevElement.ref
);
};
ReactRef.detachRefs = function (instance, element) {
if (element === null || element === false) {
return;
}
var ref = element.ref;
if (ref != null) {
detachRef(ref, instance, element._owner);
}
};
module.exports = ReactRef;
},{"77":77}],86:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactRootIndex
* @typechecks
*/
'use strict';
var ReactRootIndexInjection = {
/**
* @param {function} _createReactRootIndex
*/
injectCreateReactRootIndex: function (_createReactRootIndex) {
ReactRootIndex.createReactRootIndex = _createReactRootIndex;
}
};
var ReactRootIndex = {
createReactRootIndex: null,
injection: ReactRootIndexInjection
};
module.exports = ReactRootIndex;
},{}],87:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactServerBatchingStrategy
* @typechecks
*/
'use strict';
var ReactServerBatchingStrategy = {
isBatchingUpdates: false,
batchedUpdates: function (callback) {
// Don't do anything here. During the server rendering we don't want to
// schedule any updates. We will simply ignore them.
}
};
module.exports = ReactServerBatchingStrategy;
},{}],88:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks static-only
* @providesModule ReactServerRendering
*/
'use strict';
var ReactDefaultBatchingStrategy = _dereq_(53);
var ReactElement = _dereq_(57);
var ReactInstanceHandles = _dereq_(67);
var ReactMarkupChecksum = _dereq_(71);
var ReactServerBatchingStrategy = _dereq_(87);
var ReactServerRenderingTransaction = _dereq_(89);
var ReactUpdates = _dereq_(96);
var emptyObject = _dereq_(153);
var instantiateReactComponent = _dereq_(131);
var invariant = _dereq_(160);
/**
* @param {ReactElement} element
* @return {string} the HTML markup
*/
function renderToString(element) {
!ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'renderToString(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(false);
return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
var markup = componentInstance.mountComponent(id, transaction, emptyObject);
return ReactMarkupChecksum.addChecksumToMarkup(markup);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
// Revert to the DOM batching strategy since these two renderers
// currently share these stateful modules.
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
/**
* @param {ReactElement} element
* @return {string} the HTML markup, without the extra React ID and checksum
* (for generating static pages)
*/
function renderToStaticMarkup(element) {
!ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'renderToStaticMarkup(): You must pass a valid ReactElement.') : invariant(false) : undefined;
var transaction;
try {
ReactUpdates.injection.injectBatchingStrategy(ReactServerBatchingStrategy);
var id = ReactInstanceHandles.createReactRootID();
transaction = ReactServerRenderingTransaction.getPooled(true);
return transaction.perform(function () {
var componentInstance = instantiateReactComponent(element, null);
return componentInstance.mountComponent(id, transaction, emptyObject);
}, null);
} finally {
ReactServerRenderingTransaction.release(transaction);
// Revert to the DOM batching strategy since these two renderers
// currently share these stateful modules.
ReactUpdates.injection.injectBatchingStrategy(ReactDefaultBatchingStrategy);
}
}
module.exports = {
renderToString: renderToString,
renderToStaticMarkup: renderToStaticMarkup
};
},{"131":131,"153":153,"160":160,"53":53,"57":57,"67":67,"71":71,"87":87,"89":89,"96":96}],89:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactServerRenderingTransaction
* @typechecks
*/
'use strict';
var PooledClass = _dereq_(25);
var CallbackQueue = _dereq_(6);
var Transaction = _dereq_(113);
var assign = _dereq_(24);
var emptyFunction = _dereq_(152);
/**
* Provides a `CallbackQueue` queue for collecting `onDOMReady` callbacks
* during the performing of the transaction.
*/
var ON_DOM_READY_QUEUEING = {
/**
* Initializes the internal `onDOMReady` queue.
*/
initialize: function () {
this.reactMountReady.reset();
},
close: emptyFunction
};
/**
* Executed within the scope of the `Transaction` instance. Consider these as
* being member methods, but with an implied ordering while being isolated from
* each other.
*/
var TRANSACTION_WRAPPERS = [ON_DOM_READY_QUEUEING];
/**
* @class ReactServerRenderingTransaction
* @param {boolean} renderToStaticMarkup
*/
function ReactServerRenderingTransaction(renderToStaticMarkup) {
this.reinitializeTransaction();
this.renderToStaticMarkup = renderToStaticMarkup;
this.reactMountReady = CallbackQueue.getPooled(null);
this.useCreateElement = false;
}
var Mixin = {
/**
* @see Transaction
* @abstract
* @final
* @return {array} Empty list of operation wrap procedures.
*/
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
/**
* @return {object} The queue to collect `onDOMReady` callbacks with.
*/
getReactMountReady: function () {
return this.reactMountReady;
},
/**
* `PooledClass` looks for this, and will invoke this before allowing this
* instance to be reused.
*/
destructor: function () {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
}
};
assign(ReactServerRenderingTransaction.prototype, Transaction.Mixin, Mixin);
PooledClass.addPoolingTo(ReactServerRenderingTransaction);
module.exports = ReactServerRenderingTransaction;
},{"113":113,"152":152,"24":24,"25":25,"6":6}],90:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactStateSetters
*/
'use strict';
var ReactStateSetters = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* @param {ReactCompositeComponent} component
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function (component, funcReturningState) {
return function (a, b, c, d, e, f) {
var partialState = funcReturningState.call(component, a, b, c, d, e, f);
if (partialState) {
component.setState(partialState);
}
};
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {ReactCompositeComponent} component
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function (component, key) {
// Memoize the setters.
var cache = component.__keySetters || (component.__keySetters = {});
return cache[key] || (cache[key] = createStateKeySetter(component, key));
}
};
function createStateKeySetter(component, key) {
// Partial state is allocated outside of the function closure so it can be
// reused with every call, avoiding memory allocation when this function
// is called.
var partialState = {};
return function stateKeySetter(value) {
partialState[key] = value;
component.setState(partialState);
};
}
ReactStateSetters.Mixin = {
/**
* Returns a function that calls the provided function, and uses the result
* of that to set the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateSetter(function(xValue) {
* return {x: xValue};
* })(1);
*
* @param {function} funcReturningState Returned callback uses this to
* determine how to update state.
* @return {function} callback that when invoked uses funcReturningState to
* determined the object literal to setState.
*/
createStateSetter: function (funcReturningState) {
return ReactStateSetters.createStateSetter(this, funcReturningState);
},
/**
* Returns a single-argument callback that can be used to update a single
* key in the component's state.
*
* For example, these statements are equivalent:
*
* this.setState({x: 1});
* this.createStateKeySetter('x')(1);
*
* Note: this is memoized function, which makes it inexpensive to call.
*
* @param {string} key The key in the state that you should update.
* @return {function} callback of 1 argument which calls setState() with
* the provided keyName and callback argument.
*/
createStateKeySetter: function (key) {
return ReactStateSetters.createStateKeySetter(this, key);
}
};
module.exports = ReactStateSetters;
},{}],91:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactTestUtils
*/
'use strict';
var EventConstants = _dereq_(15);
var EventPluginHub = _dereq_(16);
var EventPropagators = _dereq_(19);
var React = _dereq_(26);
var ReactDOM = _dereq_(40);
var ReactElement = _dereq_(57);
var ReactBrowserEventEmitter = _dereq_(28);
var ReactCompositeComponent = _dereq_(38);
var ReactInstanceHandles = _dereq_(67);
var ReactInstanceMap = _dereq_(68);
var ReactMount = _dereq_(72);
var ReactUpdates = _dereq_(96);
var SyntheticEvent = _dereq_(105);
var assign = _dereq_(24);
var emptyObject = _dereq_(153);
var findDOMNode = _dereq_(121);
var invariant = _dereq_(160);
var topLevelTypes = EventConstants.topLevelTypes;
function Event(suffix) {}
/**
* @class ReactTestUtils
*/
function findAllInRenderedTreeInternal(inst, test) {
if (!inst || !inst.getPublicInstance) {
return [];
}
var publicInst = inst.getPublicInstance();
var ret = test(publicInst) ? [publicInst] : [];
var currentElement = inst._currentElement;
if (ReactTestUtils.isDOMComponent(publicInst)) {
var renderedChildren = inst._renderedChildren;
var key;
for (key in renderedChildren) {
if (!renderedChildren.hasOwnProperty(key)) {
continue;
}
ret = ret.concat(findAllInRenderedTreeInternal(renderedChildren[key], test));
}
} else if (ReactElement.isValidElement(currentElement) && typeof currentElement.type === 'function') {
ret = ret.concat(findAllInRenderedTreeInternal(inst._renderedComponent, test));
}
return ret;
}
/**
* Todo: Support the entire DOM.scry query syntax. For now, these simple
* utilities will suffice for testing purposes.
* @lends ReactTestUtils
*/
var ReactTestUtils = {
renderIntoDocument: function (instance) {
var div = document.createElement('div');
// None of our tests actually require attaching the container to the
// DOM, and doing so creates a mess that we rely on test isolation to
// clean up, so we're going to stop honoring the name of this method
// (and probably rename it eventually) if no problems arise.
// document.documentElement.appendChild(div);
return ReactDOM.render(instance, div);
},
isElement: function (element) {
return ReactElement.isValidElement(element);
},
isElementOfType: function (inst, convenienceConstructor) {
return ReactElement.isValidElement(inst) && inst.type === convenienceConstructor;
},
isDOMComponent: function (inst) {
// TODO: Fix this heuristic. It's just here because composites can currently
// pretend to be DOM components.
return !!(inst && inst.nodeType === 1 && inst.tagName);
},
isDOMComponentElement: function (inst) {
return !!(inst && ReactElement.isValidElement(inst) && !!inst.tagName);
},
isCompositeComponent: function (inst) {
if (ReactTestUtils.isDOMComponent(inst)) {
// Accessing inst.setState warns; just return false as that'll be what
// this returns when we have DOM nodes as refs directly
return false;
}
return inst != null && typeof inst.render === 'function' && typeof inst.setState === 'function';
},
isCompositeComponentWithType: function (inst, type) {
if (!ReactTestUtils.isCompositeComponent(inst)) {
return false;
}
var internalInstance = ReactInstanceMap.get(inst);
var constructor = internalInstance._currentElement.type;
return constructor === type;
},
isCompositeComponentElement: function (inst) {
if (!ReactElement.isValidElement(inst)) {
return false;
}
// We check the prototype of the type that will get mounted, not the
// instance itself. This is a future proof way of duck typing.
var prototype = inst.type.prototype;
return typeof prototype.render === 'function' && typeof prototype.setState === 'function';
},
isCompositeComponentElementWithType: function (inst, type) {
var internalInstance = ReactInstanceMap.get(inst);
var constructor = internalInstance._currentElement.type;
return !!(ReactTestUtils.isCompositeComponentElement(inst) && constructor === type);
},
getRenderedChildOfCompositeComponent: function (inst) {
if (!ReactTestUtils.isCompositeComponent(inst)) {
return null;
}
var internalInstance = ReactInstanceMap.get(inst);
return internalInstance._renderedComponent.getPublicInstance();
},
findAllInRenderedTree: function (inst, test) {
if (!inst) {
return [];
}
!ReactTestUtils.isCompositeComponent(inst) ? "development" !== 'production' ? invariant(false, 'findAllInRenderedTree(...): instance must be a composite component') : invariant(false) : undefined;
return findAllInRenderedTreeInternal(ReactInstanceMap.get(inst), test);
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the class name matching `className`.
* @return {array} an array of all the matches.
*/
scryRenderedDOMComponentsWithClass: function (root, classNames) {
if (!Array.isArray(classNames)) {
classNames = classNames.split(/\s+/);
}
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
if (ReactTestUtils.isDOMComponent(inst)) {
var classList = ReactDOM.findDOMNode(inst).className.split(/\s+/);
return classNames.every(function (className) {
return classList.indexOf(className) !== -1;
});
}
return false;
});
},
/**
* Like scryRenderedDOMComponentsWithClass but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithClass: function (root, className) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithClass(root, className);
if (all.length !== 1) {
throw new Error('Did not find exactly one match ' + '(found: ' + all.length + ') for class:' + className);
}
return all[0];
},
/**
* Finds all instance of components in the rendered tree that are DOM
* components with the tag name matching `tagName`.
* @return {array} an array of all the matches.
*/
scryRenderedDOMComponentsWithTag: function (root, tagName) {
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
return ReactTestUtils.isDOMComponent(inst) && inst.tagName.toUpperCase() === tagName.toUpperCase();
});
},
/**
* Like scryRenderedDOMComponentsWithTag but expects there to be one result,
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactDOMComponent} The one match.
*/
findRenderedDOMComponentWithTag: function (root, tagName) {
var all = ReactTestUtils.scryRenderedDOMComponentsWithTag(root, tagName);
if (all.length !== 1) {
throw new Error('Did not find exactly one match for tag:' + tagName);
}
return all[0];
},
/**
* Finds all instances of components with type equal to `componentType`.
* @return {array} an array of all the matches.
*/
scryRenderedComponentsWithType: function (root, componentType) {
return ReactTestUtils.findAllInRenderedTree(root, function (inst) {
return ReactTestUtils.isCompositeComponentWithType(inst, componentType);
});
},
/**
* Same as `scryRenderedComponentsWithType` but expects there to be one result
* and returns that one result, or throws exception if there is any other
* number of matches besides one.
* @return {!ReactComponent} The one match.
*/
findRenderedComponentWithType: function (root, componentType) {
var all = ReactTestUtils.scryRenderedComponentsWithType(root, componentType);
if (all.length !== 1) {
throw new Error('Did not find exactly one match for componentType:' + componentType + ' (found ' + all.length + ')');
}
return all[0];
},
/**
* Pass a mocked component module to this method to augment it with
* useful methods that allow it to be used as a dummy React component.
* Instead of rendering as usual, the component will become a simple
* <div> containing any provided children.
*
* @param {object} module the mock function object exported from a
* module that defines the component to be mocked
* @param {?string} mockTagName optional dummy root tag name to return
* from render method (overrides
* module.mockTagName if provided)
* @return {object} the ReactTestUtils object (for chaining)
*/
mockComponent: function (module, mockTagName) {
mockTagName = mockTagName || module.mockTagName || 'div';
module.prototype.render.mockImplementation(function () {
return React.createElement(mockTagName, null, this.props.children);
});
return this;
},
/**
* Simulates a top level event being dispatched from a raw event that occurred
* on an `Element` node.
* @param {Object} topLevelType A type from `EventConstants.topLevelTypes`
* @param {!Element} node The dom to simulate an event occurring on.
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
simulateNativeEventOnNode: function (topLevelType, node, fakeNativeEvent) {
fakeNativeEvent.target = node;
ReactBrowserEventEmitter.ReactEventListener.dispatchEvent(topLevelType, fakeNativeEvent);
},
/**
* Simulates a top level event being dispatched from a raw event that occurred
* on the `ReactDOMComponent` `comp`.
* @param {Object} topLevelType A type from `EventConstants.topLevelTypes`.
* @param {!ReactDOMComponent} comp
* @param {?Event} fakeNativeEvent Fake native event to use in SyntheticEvent.
*/
simulateNativeEventOnDOMComponent: function (topLevelType, comp, fakeNativeEvent) {
ReactTestUtils.simulateNativeEventOnNode(topLevelType, findDOMNode(comp), fakeNativeEvent);
},
nativeTouchData: function (x, y) {
return {
touches: [{ pageX: x, pageY: y }]
};
},
createRenderer: function () {
return new ReactShallowRenderer();
},
Simulate: null,
SimulateNative: {}
};
/**
* @class ReactShallowRenderer
*/
var ReactShallowRenderer = function () {
this._instance = null;
};
ReactShallowRenderer.prototype.getRenderOutput = function () {
return this._instance && this._instance._renderedComponent && this._instance._renderedComponent._renderedOutput || null;
};
var NoopInternalComponent = function (element) {
this._renderedOutput = element;
this._currentElement = element;
};
NoopInternalComponent.prototype = {
mountComponent: function () {},
receiveComponent: function (element) {
this._renderedOutput = element;
this._currentElement = element;
},
unmountComponent: function () {}
};
var ShallowComponentWrapper = function () {};
assign(ShallowComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
_instantiateReactComponent: function (element) {
return new NoopInternalComponent(element);
},
_replaceNodeWithMarkupByID: function () {},
_renderValidatedComponent: ReactCompositeComponent.Mixin._renderValidatedComponentWithoutOwnerOrContext
});
ReactShallowRenderer.prototype.render = function (element, context) {
!ReactElement.isValidElement(element) ? "development" !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Invalid component element.%s', typeof element === 'function' ? ' Instead of passing a component class, make sure to instantiate ' + 'it by passing it to React.createElement.' : '') : invariant(false) : undefined;
!(typeof element.type !== 'string') ? "development" !== 'production' ? invariant(false, 'ReactShallowRenderer render(): Shallow rendering works only with custom ' + 'components, not primitives (%s). Instead of calling `.render(el)` and ' + 'inspecting the rendered output, look at `el.props` directly instead.', element.type) : invariant(false) : undefined;
if (!context) {
context = emptyObject;
}
var transaction = ReactUpdates.ReactReconcileTransaction.getPooled(false);
this._render(element, transaction, context);
ReactUpdates.ReactReconcileTransaction.release(transaction);
};
ReactShallowRenderer.prototype.unmount = function () {
if (this._instance) {
this._instance.unmountComponent();
}
};
ReactShallowRenderer.prototype._render = function (element, transaction, context) {
if (this._instance) {
this._instance.receiveComponent(element, transaction, context);
} else {
var rootID = ReactInstanceHandles.createReactRootID();
var instance = new ShallowComponentWrapper(element.type);
instance.construct(element);
instance.mountComponent(rootID, transaction, context);
this._instance = instance;
}
};
/**
* Exports:
*
* - `ReactTestUtils.Simulate.click(Element/ReactDOMComponent)`
* - `ReactTestUtils.Simulate.mouseMove(Element/ReactDOMComponent)`
* - `ReactTestUtils.Simulate.change(Element/ReactDOMComponent)`
* - ... (All keys from event plugin `eventTypes` objects)
*/
function makeSimulator(eventType) {
return function (domComponentOrNode, eventData) {
var node;
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
node = findDOMNode(domComponentOrNode);
} else if (domComponentOrNode.tagName) {
node = domComponentOrNode;
}
var dispatchConfig = ReactBrowserEventEmitter.eventNameDispatchConfigs[eventType];
var fakeNativeEvent = new Event();
fakeNativeEvent.target = node;
// We don't use SyntheticEvent.getPooled in order to not have to worry about
// properly destroying any properties assigned from `eventData` upon release
var event = new SyntheticEvent(dispatchConfig, ReactMount.getID(node), fakeNativeEvent, node);
assign(event, eventData);
if (dispatchConfig.phasedRegistrationNames) {
EventPropagators.accumulateTwoPhaseDispatches(event);
} else {
EventPropagators.accumulateDirectDispatches(event);
}
ReactUpdates.batchedUpdates(function () {
EventPluginHub.enqueueEvents(event);
EventPluginHub.processEventQueue(true);
});
};
}
function buildSimulators() {
ReactTestUtils.Simulate = {};
var eventType;
for (eventType in ReactBrowserEventEmitter.eventNameDispatchConfigs) {
/**
* @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?object} eventData Fake event data to use in SyntheticEvent.
*/
ReactTestUtils.Simulate[eventType] = makeSimulator(eventType);
}
}
// Rebuild ReactTestUtils.Simulate whenever event plugins are injected
var oldInjectEventPluginOrder = EventPluginHub.injection.injectEventPluginOrder;
EventPluginHub.injection.injectEventPluginOrder = function () {
oldInjectEventPluginOrder.apply(this, arguments);
buildSimulators();
};
var oldInjectEventPlugins = EventPluginHub.injection.injectEventPluginsByName;
EventPluginHub.injection.injectEventPluginsByName = function () {
oldInjectEventPlugins.apply(this, arguments);
buildSimulators();
};
buildSimulators();
/**
* Exports:
*
* - `ReactTestUtils.SimulateNative.click(Element/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseMove(Element/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseIn/ReactDOMComponent)`
* - `ReactTestUtils.SimulateNative.mouseOut(Element/ReactDOMComponent)`
* - ... (All keys from `EventConstants.topLevelTypes`)
*
* Note: Top level event types are a subset of the entire set of handler types
* (which include a broader set of "synthetic" events). For example, onDragDone
* is a synthetic event. Except when testing an event plugin or React's event
* handling code specifically, you probably want to use ReactTestUtils.Simulate
* to dispatch synthetic events.
*/
function makeNativeSimulator(eventType) {
return function (domComponentOrNode, nativeEventData) {
var fakeNativeEvent = new Event(eventType);
assign(fakeNativeEvent, nativeEventData);
if (ReactTestUtils.isDOMComponent(domComponentOrNode)) {
ReactTestUtils.simulateNativeEventOnDOMComponent(eventType, domComponentOrNode, fakeNativeEvent);
} else if (domComponentOrNode.tagName) {
// Will allow on actual dom nodes.
ReactTestUtils.simulateNativeEventOnNode(eventType, domComponentOrNode, fakeNativeEvent);
}
};
}
Object.keys(topLevelTypes).forEach(function (eventType) {
// Event type is stored as 'topClick' - we transform that to 'click'
var convenienceName = eventType.indexOf('top') === 0 ? eventType.charAt(3).toLowerCase() + eventType.substr(4) : eventType;
/**
* @param {!Element|ReactDOMComponent} domComponentOrNode
* @param {?Event} nativeEventData Fake native event to use in SyntheticEvent.
*/
ReactTestUtils.SimulateNative[convenienceName] = makeNativeSimulator(eventType);
});
module.exports = ReactTestUtils;
},{"105":105,"121":121,"15":15,"153":153,"16":16,"160":160,"19":19,"24":24,"26":26,"28":28,"38":38,"40":40,"57":57,"67":67,"68":68,"72":72,"96":96}],92:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks static-only
* @providesModule ReactTransitionChildMapping
*/
'use strict';
var flattenChildren = _dereq_(122);
var ReactTransitionChildMapping = {
/**
* Given `this.props.children`, return an object mapping key to child. Just
* simple syntactic sugar around flattenChildren().
*
* @param {*} children `this.props.children`
* @return {object} Mapping of key to child
*/
getChildMapping: function (children) {
if (!children) {
return children;
}
return flattenChildren(children);
},
/**
* When you're adding or removing children some may be added or removed in the
* same render pass. We want to show *both* since we want to simultaneously
* animate elements in and out. This function takes a previous set of keys
* and a new set of keys and merges them with its best guess of the correct
* ordering. In the future we may expose some of the utilities in
* ReactMultiChild to make this easy, but for now React itself does not
* directly have this concept of the union of prevChildren and nextChildren
* so we implement it here.
*
* @param {object} prev prev children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @param {object} next next children as returned from
* `ReactTransitionChildMapping.getChildMapping()`.
* @return {object} a key set that contains all keys in `prev` and all keys
* in `next` in a reasonable order.
*/
mergeChildMappings: function (prev, next) {
prev = prev || {};
next = next || {};
function getValueForKey(key) {
if (next.hasOwnProperty(key)) {
return next[key];
} else {
return prev[key];
}
}
// For each key of `next`, the list of keys to insert before that key in
// the combined list
var nextKeysPending = {};
var pendingKeys = [];
for (var prevKey in prev) {
if (next.hasOwnProperty(prevKey)) {
if (pendingKeys.length) {
nextKeysPending[prevKey] = pendingKeys;
pendingKeys = [];
}
} else {
pendingKeys.push(prevKey);
}
}
var i;
var childMapping = {};
for (var nextKey in next) {
if (nextKeysPending.hasOwnProperty(nextKey)) {
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
var pendingNextKey = nextKeysPending[nextKey][i];
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
}
}
childMapping[nextKey] = getValueForKey(nextKey);
}
// Finally, add the keys which didn't appear before any key in `next`
for (i = 0; i < pendingKeys.length; i++) {
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
}
return childMapping;
}
};
module.exports = ReactTransitionChildMapping;
},{"122":122}],93:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactTransitionEvents
*/
'use strict';
var ExecutionEnvironment = _dereq_(146);
/**
* EVENT_NAME_MAP is used to determine which event fired when a
* transition/animation ends, based on the style property used to
* define that event.
*/
var EVENT_NAME_MAP = {
transitionend: {
'transition': 'transitionend',
'WebkitTransition': 'webkitTransitionEnd',
'MozTransition': 'mozTransitionEnd',
'OTransition': 'oTransitionEnd',
'msTransition': 'MSTransitionEnd'
},
animationend: {
'animation': 'animationend',
'WebkitAnimation': 'webkitAnimationEnd',
'MozAnimation': 'mozAnimationEnd',
'OAnimation': 'oAnimationEnd',
'msAnimation': 'MSAnimationEnd'
}
};
var endEvents = [];
function detectEvents() {
var testEl = document.createElement('div');
var style = testEl.style;
// On some platforms, in particular some releases of Android 4.x,
// the un-prefixed "animation" and "transition" properties are defined on the
// style object but the events that fire will still be prefixed, so we need
// to check if the un-prefixed events are useable, and if not remove them
// from the map
if (!('AnimationEvent' in window)) {
delete EVENT_NAME_MAP.animationend.animation;
}
if (!('TransitionEvent' in window)) {
delete EVENT_NAME_MAP.transitionend.transition;
}
for (var baseEventName in EVENT_NAME_MAP) {
var baseEvents = EVENT_NAME_MAP[baseEventName];
for (var styleName in baseEvents) {
if (styleName in style) {
endEvents.push(baseEvents[styleName]);
break;
}
}
}
}
if (ExecutionEnvironment.canUseDOM) {
detectEvents();
}
// We use the raw {add|remove}EventListener() call because EventListener
// does not know how to remove event listeners and we really should
// clean up. Also, these events are not triggered in older browsers
// so we should be A-OK here.
function addEventListener(node, eventName, eventListener) {
node.addEventListener(eventName, eventListener, false);
}
function removeEventListener(node, eventName, eventListener) {
node.removeEventListener(eventName, eventListener, false);
}
var ReactTransitionEvents = {
addEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
// If CSS transitions are not supported, trigger an "end animation"
// event immediately.
window.setTimeout(eventListener, 0);
return;
}
endEvents.forEach(function (endEvent) {
addEventListener(node, endEvent, eventListener);
});
},
removeEndEventListener: function (node, eventListener) {
if (endEvents.length === 0) {
return;
}
endEvents.forEach(function (endEvent) {
removeEventListener(node, endEvent, eventListener);
});
}
};
module.exports = ReactTransitionEvents;
},{"146":146}],94:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactTransitionGroup
*/
'use strict';
var React = _dereq_(26);
var ReactTransitionChildMapping = _dereq_(92);
var assign = _dereq_(24);
var emptyFunction = _dereq_(152);
var ReactTransitionGroup = React.createClass({
displayName: 'ReactTransitionGroup',
propTypes: {
component: React.PropTypes.any,
childFactory: React.PropTypes.func
},
getDefaultProps: function () {
return {
component: 'span',
childFactory: emptyFunction.thatReturnsArgument
};
},
getInitialState: function () {
return {
children: ReactTransitionChildMapping.getChildMapping(this.props.children)
};
},
componentWillMount: function () {
this.currentlyTransitioningKeys = {};
this.keysToEnter = [];
this.keysToLeave = [];
},
componentDidMount: function () {
var initialChildMapping = this.state.children;
for (var key in initialChildMapping) {
if (initialChildMapping[key]) {
this.performAppear(key);
}
}
},
componentWillReceiveProps: function (nextProps) {
var nextChildMapping = ReactTransitionChildMapping.getChildMapping(nextProps.children);
var prevChildMapping = this.state.children;
this.setState({
children: ReactTransitionChildMapping.mergeChildMappings(prevChildMapping, nextChildMapping)
});
var key;
for (key in nextChildMapping) {
var hasPrev = prevChildMapping && prevChildMapping.hasOwnProperty(key);
if (nextChildMapping[key] && !hasPrev && !this.currentlyTransitioningKeys[key]) {
this.keysToEnter.push(key);
}
}
for (key in prevChildMapping) {
var hasNext = nextChildMapping && nextChildMapping.hasOwnProperty(key);
if (prevChildMapping[key] && !hasNext && !this.currentlyTransitioningKeys[key]) {
this.keysToLeave.push(key);
}
}
// If we want to someday check for reordering, we could do it here.
},
componentDidUpdate: function () {
var keysToEnter = this.keysToEnter;
this.keysToEnter = [];
keysToEnter.forEach(this.performEnter);
var keysToLeave = this.keysToLeave;
this.keysToLeave = [];
keysToLeave.forEach(this.performLeave);
},
performAppear: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillAppear) {
component.componentWillAppear(this._handleDoneAppearing.bind(this, key));
} else {
this._handleDoneAppearing(key);
}
},
_handleDoneAppearing: function (key) {
var component = this.refs[key];
if (component.componentDidAppear) {
component.componentDidAppear();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully appeared. Remove it.
this.performLeave(key);
}
},
performEnter: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillEnter) {
component.componentWillEnter(this._handleDoneEntering.bind(this, key));
} else {
this._handleDoneEntering(key);
}
},
_handleDoneEntering: function (key) {
var component = this.refs[key];
if (component.componentDidEnter) {
component.componentDidEnter();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) {
// This was removed before it had fully entered. Remove it.
this.performLeave(key);
}
},
performLeave: function (key) {
this.currentlyTransitioningKeys[key] = true;
var component = this.refs[key];
if (component.componentWillLeave) {
component.componentWillLeave(this._handleDoneLeaving.bind(this, key));
} else {
// Note that this is somewhat dangerous b/c it calls setState()
// again, effectively mutating the component before all the work
// is done.
this._handleDoneLeaving(key);
}
},
_handleDoneLeaving: function (key) {
var component = this.refs[key];
if (component.componentDidLeave) {
component.componentDidLeave();
}
delete this.currentlyTransitioningKeys[key];
var currentChildMapping = ReactTransitionChildMapping.getChildMapping(this.props.children);
if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) {
// This entered again before it fully left. Add it again.
this.performEnter(key);
} else {
this.setState(function (state) {
var newChildren = assign({}, state.children);
delete newChildren[key];
return { children: newChildren };
});
}
},
render: function () {
// TODO: we could get rid of the need for the wrapper node
// by cloning a single child
var childrenToRender = [];
for (var key in this.state.children) {
var child = this.state.children[key];
if (child) {
// You may need to apply reactive updates to a child as it is leaving.
// The normal React way to do it won't work since the child will have
// already been removed. In case you need this behavior you can provide
// a childFactory function to wrap every child, even the ones that are
// leaving.
childrenToRender.push(React.cloneElement(this.props.childFactory(child), { ref: key, key: key }));
}
}
return React.createElement(this.props.component, this.props, childrenToRender);
}
});
module.exports = ReactTransitionGroup;
},{"152":152,"24":24,"26":26,"92":92}],95:[function(_dereq_,module,exports){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactUpdateQueue
*/
'use strict';
var ReactCurrentOwner = _dereq_(39);
var ReactElement = _dereq_(57);
var ReactInstanceMap = _dereq_(68);
var ReactUpdates = _dereq_(96);
var assign = _dereq_(24);
var invariant = _dereq_(160);
var warning = _dereq_(172);
function enqueueUpdate(internalInstance) {
ReactUpdates.enqueueUpdate(internalInstance);
}
function getInternalInstanceReadyForUpdate(publicInstance, callerName) {
var internalInstance = ReactInstanceMap.get(publicInstance);
if (!internalInstance) {
if ("development" !== 'production') {
// Only warn when we have a callerName. Otherwise we should be silent.
// We're probably calling from enqueueCallback. We don't want to warn
// there because we already warned for the corresponding lifecycle method.
"development" !== 'production' ? warning(!callerName, '%s(...): Can only update a mounted or mounting component. ' + 'This usually means you called %s() on an unmounted component. ' + 'This is a no-op. Please check the code for the %s component.', callerName, callerName, publicInstance.constructor.displayName) : undefined;
}
return null;
}
if ("development" !== 'production') {
"development" !== 'production' ? warning(ReactCurrentOwner.current == null, '%s(...): Cannot update during an existing state transition ' + '(such as within `render`). Render methods should be a pure function ' + 'of props and state.', callerName) : undefined;
}
return internalInstance;
}
/**
* ReactUpdateQueue allows for state updates to be scheduled into a later
* reconciliation step.
*/
var ReactUpdateQueue = {
/**
* Checks whether or not this composite component is mounted.
* @param {ReactClass} publicInstance The instance we want to test.
* @return {boolean} True if mounted, false otherwise.
* @protected
* @final
*/
isMounted: function (publicInstance) {
if ("development" !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
"development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
var internalInstance = ReactInstanceMap.get(publicInstance);
if (internalInstance) {
// During componentWillMount and render this will still be null but after
// that will always render to something. At least for now. So we can use
// this hack.
return !!internalInstance._renderedComponent;
} else {
return false;
}
},
/**
* Enqueue a callback that will be executed after all the pending updates
* have processed.
*
* @param {ReactClass} publicInstance The instance to use as `this` context.
* @param {?function} callback Called after state is updated.
* @internal
*/
enqueueCallback: function (publicInstance, callback) {
!(typeof callback === 'function') ? "development" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance);
// Previously we would throw an error if we didn't have an internal
// instance. Since we want to make it a no-op instead, we mirror the same
// behavior we have in other enqueue* methods.
// We also need to ignore callbacks in componentWillMount. See
// enqueueUpdates.
if (!internalInstance) {
return null;
}
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
internalInstance._pendingCallbacks = [callback];
}
// TODO: The callback here is ignored when setState is called from
// componentWillMount. Either fix it or disallow doing so completely in
// favor of getInitialState. Alternatively, we can disallow
// componentWillMount during server-side rendering.
enqueueUpdate(internalInstance);
},
enqueueCallbackInternal: function (internalInstance, callback) {
!(typeof callback === 'function') ? "development" !== 'production' ? invariant(false, 'enqueueCallback(...): You called `setProps`, `replaceProps`, ' + '`setState`, `replaceState`, or `forceUpdate` with a callback that ' + 'isn\'t callable.') : invariant(false) : undefined;
if (internalInstance._pendingCallbacks) {
internalInstance._pendingCallbacks.push(callback);
} else {
internalInstance._pendingCallbacks = [callback];
}
enqueueUpdate(internalInstance);
},
/**
* Forces an update. This should only be invoked when it is known with
* certainty that we are **not** in a DOM transaction.
*
* You may want to call this when you know that some deeper aspect of the
* component's state has changed but `setState` was not called.
*
* This will not invoke `shouldComponentUpdate`, but it will invoke
* `componentWillUpdate` and `componentDidUpdate`.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @internal
*/
enqueueForceUpdate: function (publicInstance) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'forceUpdate');
if (!internalInstance) {
return;
}
internalInstance._pendingForceUpdate = true;
enqueueUpdate(internalInstance);
},
/**
* Replaces all of the state. Always use this or `setState` to mutate state.
* You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} completeState Next state.
* @internal
*/
enqueueReplaceState: function (publicInstance, completeState) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceState');
if (!internalInstance) {
return;
}
internalInstance._pendingStateQueue = [completeState];
internalInstance._pendingReplaceState = true;
enqueueUpdate(internalInstance);
},
/**
* Sets a subset of the state. This only exists because _pendingState is
* internal. This provides a merging strategy that is not available to deep
* properties which is confusing. TODO: Expose pendingState or don't use it
* during the merge.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialState Next partial state to be merged with state.
* @internal
*/
enqueueSetState: function (publicInstance, partialState) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setState');
if (!internalInstance) {
return;
}
var queue = internalInstance._pendingStateQueue || (internalInstance._pendingStateQueue = []);
queue.push(partialState);
enqueueUpdate(internalInstance);
},
/**
* Sets a subset of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} partialProps Subset of the next props.
* @internal
*/
enqueueSetProps: function (publicInstance, partialProps) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'setProps');
if (!internalInstance) {
return;
}
ReactUpdateQueue.enqueueSetPropsInternal(internalInstance, partialProps);
},
enqueueSetPropsInternal: function (internalInstance, partialProps) {
var topLevelWrapper = internalInstance._topLevelWrapper;
!topLevelWrapper ? "development" !== 'production' ? invariant(false, 'setProps(...): You called `setProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
var element = wrapElement.props;
var props = assign({}, element.props, partialProps);
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
enqueueUpdate(topLevelWrapper);
},
/**
* Replaces all of the props.
*
* @param {ReactClass} publicInstance The instance that should rerender.
* @param {object} props New props.
* @internal
*/
enqueueReplaceProps: function (publicInstance, props) {
var internalInstance = getInternalInstanceReadyForUpdate(publicInstance, 'replaceProps');
if (!internalInstance) {
return;
}
ReactUpdateQueue.enqueueReplacePropsInternal(internalInstance, props);
},
enqueueReplacePropsInternal: function (internalInstance, props) {
var topLevelWrapper = internalInstance._topLevelWrapper;
!topLevelWrapper ? "development" !== 'production' ? invariant(false, 'replaceProps(...): You called `replaceProps` on a ' + 'component with a parent. This is an anti-pattern since props will ' + 'get reactively updated when rendered. Instead, change the owner\'s ' + '`render` method to pass the correct value as props to the component ' + 'where it is created.') : invariant(false) : undefined;
// Merge with the pending element if it exists, otherwise with existing
// element props.
var wrapElement = topLevelWrapper._pendingElement || topLevelWrapper._currentElement;
var element = wrapElement.props;
topLevelWrapper._pendingElement = ReactElement.cloneAndReplaceProps(wrapElement, ReactElement.cloneAndReplaceProps(element, props));
enqueueUpdate(topLevelWrapper);
},
enqueueElementInternal: function (internalInstance, newElement) {
internalInstance._pendingElement = newElement;
enqueueUpdate(internalInstance);
}
};
module.exports = ReactUpdateQueue;
},{"160":160,"172":172,"24":24,"39":39,"57":57,"68":68,"96":96}],96:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactUpdates
*/
'use strict';
var CallbackQueue = _dereq_(6);
var PooledClass = _dereq_(25);
var ReactPerf = _dereq_(78);
var ReactReconciler = _dereq_(84);
var Transaction = _dereq_(113);
var assign = _dereq_(24);
var invariant = _dereq_(160);
var dirtyComponents = [];
var asapCallbackQueue = CallbackQueue.getPooled();
var asapEnqueued = false;
var batchingStrategy = null;
function ensureInjected() {
!(ReactUpdates.ReactReconcileTransaction && batchingStrategy) ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must inject a reconcile transaction class and batching ' + 'strategy') : invariant(false) : undefined;
}
var NESTED_UPDATES = {
initialize: function () {
this.dirtyComponentsLength = dirtyComponents.length;
},
close: function () {
if (this.dirtyComponentsLength !== dirtyComponents.length) {
// Additional updates were enqueued by componentDidUpdate handlers or
// similar; before our own UPDATE_QUEUEING wrapper closes, we want to run
// these new updates so that if A's componentDidUpdate calls setState on
// B, B will update before the callback A's updater provided when calling
// setState.
dirtyComponents.splice(0, this.dirtyComponentsLength);
flushBatchedUpdates();
} else {
dirtyComponents.length = 0;
}
}
};
var UPDATE_QUEUEING = {
initialize: function () {
this.callbackQueue.reset();
},
close: function () {
this.callbackQueue.notifyAll();
}
};
var TRANSACTION_WRAPPERS = [NESTED_UPDATES, UPDATE_QUEUEING];
function ReactUpdatesFlushTransaction() {
this.reinitializeTransaction();
this.dirtyComponentsLength = null;
this.callbackQueue = CallbackQueue.getPooled();
this.reconcileTransaction = ReactUpdates.ReactReconcileTransaction.getPooled( /* forceHTML */false);
}
assign(ReactUpdatesFlushTransaction.prototype, Transaction.Mixin, {
getTransactionWrappers: function () {
return TRANSACTION_WRAPPERS;
},
destructor: function () {
this.dirtyComponentsLength = null;
CallbackQueue.release(this.callbackQueue);
this.callbackQueue = null;
ReactUpdates.ReactReconcileTransaction.release(this.reconcileTransaction);
this.reconcileTransaction = null;
},
perform: function (method, scope, a) {
// Essentially calls `this.reconcileTransaction.perform(method, scope, a)`
// with this transaction's wrappers around it.
return Transaction.Mixin.perform.call(this, this.reconcileTransaction.perform, this.reconcileTransaction, method, scope, a);
}
});
PooledClass.addPoolingTo(ReactUpdatesFlushTransaction);
function batchedUpdates(callback, a, b, c, d, e) {
ensureInjected();
batchingStrategy.batchedUpdates(callback, a, b, c, d, e);
}
/**
* Array comparator for ReactComponents by mount ordering.
*
* @param {ReactComponent} c1 first component you're comparing
* @param {ReactComponent} c2 second component you're comparing
* @return {number} Return value usable by Array.prototype.sort().
*/
function mountOrderComparator(c1, c2) {
return c1._mountOrder - c2._mountOrder;
}
function runBatchedUpdates(transaction) {
var len = transaction.dirtyComponentsLength;
!(len === dirtyComponents.length) ? "development" !== 'production' ? invariant(false, 'Expected flush transaction\'s stored dirty-components length (%s) to ' + 'match dirty-components array length (%s).', len, dirtyComponents.length) : invariant(false) : undefined;
// Since reconciling a component higher in the owner hierarchy usually (not
// always -- see shouldComponentUpdate()) will reconcile children, reconcile
// them before their children by sorting the array.
dirtyComponents.sort(mountOrderComparator);
for (var i = 0; i < len; i++) {
// If a component is unmounted before pending changes apply, it will still
// be here, but we assume that it has cleared its _pendingCallbacks and
// that performUpdateIfNecessary is a noop.
var component = dirtyComponents[i];
// If performUpdateIfNecessary happens to enqueue any new updates, we
// shouldn't execute the callbacks until the next render happens, so
// stash the callbacks first
var callbacks = component._pendingCallbacks;
component._pendingCallbacks = null;
ReactReconciler.performUpdateIfNecessary(component, transaction.reconcileTransaction);
if (callbacks) {
for (var j = 0; j < callbacks.length; j++) {
transaction.callbackQueue.enqueue(callbacks[j], component.getPublicInstance());
}
}
}
}
var flushBatchedUpdates = function () {
// ReactUpdatesFlushTransaction's wrappers will clear the dirtyComponents
// array and perform any updates enqueued by mount-ready handlers (i.e.,
// componentDidUpdate) but we need to check here too in order to catch
// updates enqueued by setState callbacks and asap calls.
while (dirtyComponents.length || asapEnqueued) {
if (dirtyComponents.length) {
var transaction = ReactUpdatesFlushTransaction.getPooled();
transaction.perform(runBatchedUpdates, null, transaction);
ReactUpdatesFlushTransaction.release(transaction);
}
if (asapEnqueued) {
asapEnqueued = false;
var queue = asapCallbackQueue;
asapCallbackQueue = CallbackQueue.getPooled();
queue.notifyAll();
CallbackQueue.release(queue);
}
}
};
flushBatchedUpdates = ReactPerf.measure('ReactUpdates', 'flushBatchedUpdates', flushBatchedUpdates);
/**
* Mark a component as needing a rerender, adding an optional callback to a
* list of functions which will be executed once the rerender occurs.
*/
function enqueueUpdate(component) {
ensureInjected();
// Various parts of our code (such as ReactCompositeComponent's
// _renderValidatedComponent) assume that calls to render aren't nested;
// verify that that's the case. (This is called by each top-level update
// function, like setProps, setState, forceUpdate, etc.; creation and
// destruction of top-level components is guarded in ReactMount.)
if (!batchingStrategy.isBatchingUpdates) {
batchingStrategy.batchedUpdates(enqueueUpdate, component);
return;
}
dirtyComponents.push(component);
}
/**
* Enqueue a callback to be run at the end of the current batching cycle. Throws
* if no updates are currently being performed.
*/
function asap(callback, context) {
!batchingStrategy.isBatchingUpdates ? "development" !== 'production' ? invariant(false, 'ReactUpdates.asap: Can\'t enqueue an asap callback in a context where' + 'updates are not being batched.') : invariant(false) : undefined;
asapCallbackQueue.enqueue(callback, context);
asapEnqueued = true;
}
var ReactUpdatesInjection = {
injectReconcileTransaction: function (ReconcileTransaction) {
!ReconcileTransaction ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a reconcile transaction class') : invariant(false) : undefined;
ReactUpdates.ReactReconcileTransaction = ReconcileTransaction;
},
injectBatchingStrategy: function (_batchingStrategy) {
!_batchingStrategy ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batching strategy') : invariant(false) : undefined;
!(typeof _batchingStrategy.batchedUpdates === 'function') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide a batchedUpdates() function') : invariant(false) : undefined;
!(typeof _batchingStrategy.isBatchingUpdates === 'boolean') ? "development" !== 'production' ? invariant(false, 'ReactUpdates: must provide an isBatchingUpdates boolean attribute') : invariant(false) : undefined;
batchingStrategy = _batchingStrategy;
}
};
var ReactUpdates = {
/**
* React references `ReactReconcileTransaction` using this property in order
* to allow dependency injection.
*
* @internal
*/
ReactReconcileTransaction: null,
batchedUpdates: batchedUpdates,
enqueueUpdate: enqueueUpdate,
flushBatchedUpdates: flushBatchedUpdates,
injection: ReactUpdatesInjection,
asap: asap
};
module.exports = ReactUpdates;
},{"113":113,"160":160,"24":24,"25":25,"6":6,"78":78,"84":84}],97:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactVersion
*/
'use strict';
module.exports = '0.14.0';
},{}],98:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SVGDOMPropertyConfig
*/
'use strict';
var DOMProperty = _dereq_(10);
var MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE;
var NS = {
xlink: 'http://www.w3.org/1999/xlink',
xml: 'http://www.w3.org/XML/1998/namespace'
};
var SVGDOMPropertyConfig = {
Properties: {
clipPath: MUST_USE_ATTRIBUTE,
cx: MUST_USE_ATTRIBUTE,
cy: MUST_USE_ATTRIBUTE,
d: MUST_USE_ATTRIBUTE,
dx: MUST_USE_ATTRIBUTE,
dy: MUST_USE_ATTRIBUTE,
fill: MUST_USE_ATTRIBUTE,
fillOpacity: MUST_USE_ATTRIBUTE,
fontFamily: MUST_USE_ATTRIBUTE,
fontSize: MUST_USE_ATTRIBUTE,
fx: MUST_USE_ATTRIBUTE,
fy: MUST_USE_ATTRIBUTE,
gradientTransform: MUST_USE_ATTRIBUTE,
gradientUnits: MUST_USE_ATTRIBUTE,
markerEnd: MUST_USE_ATTRIBUTE,
markerMid: MUST_USE_ATTRIBUTE,
markerStart: MUST_USE_ATTRIBUTE,
offset: MUST_USE_ATTRIBUTE,
opacity: MUST_USE_ATTRIBUTE,
patternContentUnits: MUST_USE_ATTRIBUTE,
patternUnits: MUST_USE_ATTRIBUTE,
points: MUST_USE_ATTRIBUTE,
preserveAspectRatio: MUST_USE_ATTRIBUTE,
r: MUST_USE_ATTRIBUTE,
rx: MUST_USE_ATTRIBUTE,
ry: MUST_USE_ATTRIBUTE,
spreadMethod: MUST_USE_ATTRIBUTE,
stopColor: MUST_USE_ATTRIBUTE,
stopOpacity: MUST_USE_ATTRIBUTE,
stroke: MUST_USE_ATTRIBUTE,
strokeDasharray: MUST_USE_ATTRIBUTE,
strokeLinecap: MUST_USE_ATTRIBUTE,
strokeOpacity: MUST_USE_ATTRIBUTE,
strokeWidth: MUST_USE_ATTRIBUTE,
textAnchor: MUST_USE_ATTRIBUTE,
transform: MUST_USE_ATTRIBUTE,
version: MUST_USE_ATTRIBUTE,
viewBox: MUST_USE_ATTRIBUTE,
x1: MUST_USE_ATTRIBUTE,
x2: MUST_USE_ATTRIBUTE,
x: MUST_USE_ATTRIBUTE,
xlinkActuate: MUST_USE_ATTRIBUTE,
xlinkArcrole: MUST_USE_ATTRIBUTE,
xlinkHref: MUST_USE_ATTRIBUTE,
xlinkRole: MUST_USE_ATTRIBUTE,
xlinkShow: MUST_USE_ATTRIBUTE,
xlinkTitle: MUST_USE_ATTRIBUTE,
xlinkType: MUST_USE_ATTRIBUTE,
xmlBase: MUST_USE_ATTRIBUTE,
xmlLang: MUST_USE_ATTRIBUTE,
xmlSpace: MUST_USE_ATTRIBUTE,
y1: MUST_USE_ATTRIBUTE,
y2: MUST_USE_ATTRIBUTE,
y: MUST_USE_ATTRIBUTE
},
DOMAttributeNamespaces: {
xlinkActuate: NS.xlink,
xlinkArcrole: NS.xlink,
xlinkHref: NS.xlink,
xlinkRole: NS.xlink,
xlinkShow: NS.xlink,
xlinkTitle: NS.xlink,
xlinkType: NS.xlink,
xmlBase: NS.xml,
xmlLang: NS.xml,
xmlSpace: NS.xml
},
DOMAttributeNames: {
clipPath: 'clip-path',
fillOpacity: 'fill-opacity',
fontFamily: 'font-family',
fontSize: 'font-size',
gradientTransform: 'gradientTransform',
gradientUnits: 'gradientUnits',
markerEnd: 'marker-end',
markerMid: 'marker-mid',
markerStart: 'marker-start',
patternContentUnits: 'patternContentUnits',
patternUnits: 'patternUnits',
preserveAspectRatio: 'preserveAspectRatio',
spreadMethod: 'spreadMethod',
stopColor: 'stop-color',
stopOpacity: 'stop-opacity',
strokeDasharray: 'stroke-dasharray',
strokeLinecap: 'stroke-linecap',
strokeOpacity: 'stroke-opacity',
strokeWidth: 'stroke-width',
textAnchor: 'text-anchor',
viewBox: 'viewBox',
xlinkActuate: 'xlink:actuate',
xlinkArcrole: 'xlink:arcrole',
xlinkHref: 'xlink:href',
xlinkRole: 'xlink:role',
xlinkShow: 'xlink:show',
xlinkTitle: 'xlink:title',
xlinkType: 'xlink:type',
xmlBase: 'xml:base',
xmlLang: 'xml:lang',
xmlSpace: 'xml:space'
}
};
module.exports = SVGDOMPropertyConfig;
},{"10":10}],99:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SelectEventPlugin
*/
'use strict';
var EventConstants = _dereq_(15);
var EventPropagators = _dereq_(19);
var ExecutionEnvironment = _dereq_(146);
var ReactInputSelection = _dereq_(66);
var SyntheticEvent = _dereq_(105);
var getActiveElement = _dereq_(155);
var isTextInputElement = _dereq_(133);
var keyOf = _dereq_(165);
var shallowEqual = _dereq_(170);
var topLevelTypes = EventConstants.topLevelTypes;
var skipSelectionChangeEvent = ExecutionEnvironment.canUseDOM && 'documentMode' in document && document.documentMode <= 11;
var eventTypes = {
select: {
phasedRegistrationNames: {
bubbled: keyOf({ onSelect: null }),
captured: keyOf({ onSelectCapture: null })
},
dependencies: [topLevelTypes.topBlur, topLevelTypes.topContextMenu, topLevelTypes.topFocus, topLevelTypes.topKeyDown, topLevelTypes.topMouseDown, topLevelTypes.topMouseUp, topLevelTypes.topSelectionChange]
}
};
var activeElement = null;
var activeElementID = null;
var lastSelection = null;
var mouseDown = false;
// Track whether a listener exists for this plugin. If none exist, we do
// not extract events.
var hasListener = false;
var ON_SELECT_KEY = keyOf({ onSelect: null });
/**
* Get an object which is a unique representation of the current selection.
*
* The return value will not be consistent across nodes or browsers, but
* two identical selections on the same node will return identical objects.
*
* @param {DOMElement} node
* @return {object}
*/
function getSelection(node) {
if ('selectionStart' in node && ReactInputSelection.hasSelectionCapabilities(node)) {
return {
start: node.selectionStart,
end: node.selectionEnd
};
} else if (window.getSelection) {
var selection = window.getSelection();
return {
anchorNode: selection.anchorNode,
anchorOffset: selection.anchorOffset,
focusNode: selection.focusNode,
focusOffset: selection.focusOffset
};
} else if (document.selection) {
var range = document.selection.createRange();
return {
parentElement: range.parentElement(),
text: range.text,
top: range.boundingTop,
left: range.boundingLeft
};
}
}
/**
* Poll selection to see whether it's changed.
*
* @param {object} nativeEvent
* @return {?SyntheticEvent}
*/
function constructSelectEvent(nativeEvent, nativeEventTarget) {
// Ensure we have the right element, and that the user is not dragging a
// selection (this matches native `select` event behavior). In HTML5, select
// fires only on input and textarea thus if there's no focused element we
// won't dispatch.
if (mouseDown || activeElement == null || activeElement !== getActiveElement()) {
return null;
}
// Only fire when selection has actually changed.
var currentSelection = getSelection(activeElement);
if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) {
lastSelection = currentSelection;
var syntheticEvent = SyntheticEvent.getPooled(eventTypes.select, activeElementID, nativeEvent, nativeEventTarget);
syntheticEvent.type = 'select';
syntheticEvent.target = activeElement;
EventPropagators.accumulateTwoPhaseDispatches(syntheticEvent);
return syntheticEvent;
}
return null;
}
/**
* This plugin creates an `onSelect` event that normalizes select events
* across form elements.
*
* Supported elements are:
* - input (see `isTextInputElement`)
* - textarea
* - contentEditable
*
* This differs from native browser implementations in the following ways:
* - Fires on contentEditable fields as well as inputs.
* - Fires for collapsed selection.
* - Fires after user input.
*/
var SelectEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
if (!hasListener) {
return null;
}
switch (topLevelType) {
// Track the input node that has focus.
case topLevelTypes.topFocus:
if (isTextInputElement(topLevelTarget) || topLevelTarget.contentEditable === 'true') {
activeElement = topLevelTarget;
activeElementID = topLevelTargetID;
lastSelection = null;
}
break;
case topLevelTypes.topBlur:
activeElement = null;
activeElementID = null;
lastSelection = null;
break;
// Don't fire the event while the user is dragging. This matches the
// semantics of the native select event.
case topLevelTypes.topMouseDown:
mouseDown = true;
break;
case topLevelTypes.topContextMenu:
case topLevelTypes.topMouseUp:
mouseDown = false;
return constructSelectEvent(nativeEvent, nativeEventTarget);
// Chrome and IE fire non-standard event when selection is changed (and
// sometimes when it hasn't). IE's event fires out of order with respect
// to key and input events on deletion, so we discard it.
//
// Firefox doesn't support selectionchange, so check selection status
// after each key entry. The selection changes after keydown and before
// keyup, but we check on keydown as well in the case of holding down a
// key, when multiple keydown events are fired but only one keyup is.
// This is also our approach for IE handling, for the reason above.
case topLevelTypes.topSelectionChange:
if (skipSelectionChangeEvent) {
break;
}
// falls through
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
return constructSelectEvent(nativeEvent, nativeEventTarget);
}
return null;
},
didPutListener: function (id, registrationName, listener) {
if (registrationName === ON_SELECT_KEY) {
hasListener = true;
}
}
};
module.exports = SelectEventPlugin;
},{"105":105,"133":133,"146":146,"15":15,"155":155,"165":165,"170":170,"19":19,"66":66}],100:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ServerReactRootIndex
* @typechecks
*/
'use strict';
/**
* Size of the reactRoot ID space. We generate random numbers for React root
* IDs and if there's a collision the events and DOM update system will
* get confused. In the future we need a way to generate GUIDs but for
* now this will work on a smaller scale.
*/
var GLOBAL_MOUNT_POINT_MAX = Math.pow(2, 53);
var ServerReactRootIndex = {
createReactRootIndex: function () {
return Math.ceil(Math.random() * GLOBAL_MOUNT_POINT_MAX);
}
};
module.exports = ServerReactRootIndex;
},{}],101:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SimpleEventPlugin
*/
'use strict';
var EventConstants = _dereq_(15);
var EventListener = _dereq_(145);
var EventPropagators = _dereq_(19);
var ReactMount = _dereq_(72);
var SyntheticClipboardEvent = _dereq_(102);
var SyntheticEvent = _dereq_(105);
var SyntheticFocusEvent = _dereq_(106);
var SyntheticKeyboardEvent = _dereq_(108);
var SyntheticMouseEvent = _dereq_(109);
var SyntheticDragEvent = _dereq_(104);
var SyntheticTouchEvent = _dereq_(110);
var SyntheticUIEvent = _dereq_(111);
var SyntheticWheelEvent = _dereq_(112);
var emptyFunction = _dereq_(152);
var getEventCharCode = _dereq_(124);
var invariant = _dereq_(160);
var keyOf = _dereq_(165);
var topLevelTypes = EventConstants.topLevelTypes;
var eventTypes = {
abort: {
phasedRegistrationNames: {
bubbled: keyOf({ onAbort: true }),
captured: keyOf({ onAbortCapture: true })
}
},
blur: {
phasedRegistrationNames: {
bubbled: keyOf({ onBlur: true }),
captured: keyOf({ onBlurCapture: true })
}
},
canPlay: {
phasedRegistrationNames: {
bubbled: keyOf({ onCanPlay: true }),
captured: keyOf({ onCanPlayCapture: true })
}
},
canPlayThrough: {
phasedRegistrationNames: {
bubbled: keyOf({ onCanPlayThrough: true }),
captured: keyOf({ onCanPlayThroughCapture: true })
}
},
click: {
phasedRegistrationNames: {
bubbled: keyOf({ onClick: true }),
captured: keyOf({ onClickCapture: true })
}
},
contextMenu: {
phasedRegistrationNames: {
bubbled: keyOf({ onContextMenu: true }),
captured: keyOf({ onContextMenuCapture: true })
}
},
copy: {
phasedRegistrationNames: {
bubbled: keyOf({ onCopy: true }),
captured: keyOf({ onCopyCapture: true })
}
},
cut: {
phasedRegistrationNames: {
bubbled: keyOf({ onCut: true }),
captured: keyOf({ onCutCapture: true })
}
},
doubleClick: {
phasedRegistrationNames: {
bubbled: keyOf({ onDoubleClick: true }),
captured: keyOf({ onDoubleClickCapture: true })
}
},
drag: {
phasedRegistrationNames: {
bubbled: keyOf({ onDrag: true }),
captured: keyOf({ onDragCapture: true })
}
},
dragEnd: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragEnd: true }),
captured: keyOf({ onDragEndCapture: true })
}
},
dragEnter: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragEnter: true }),
captured: keyOf({ onDragEnterCapture: true })
}
},
dragExit: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragExit: true }),
captured: keyOf({ onDragExitCapture: true })
}
},
dragLeave: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragLeave: true }),
captured: keyOf({ onDragLeaveCapture: true })
}
},
dragOver: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragOver: true }),
captured: keyOf({ onDragOverCapture: true })
}
},
dragStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onDragStart: true }),
captured: keyOf({ onDragStartCapture: true })
}
},
drop: {
phasedRegistrationNames: {
bubbled: keyOf({ onDrop: true }),
captured: keyOf({ onDropCapture: true })
}
},
durationChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onDurationChange: true }),
captured: keyOf({ onDurationChangeCapture: true })
}
},
emptied: {
phasedRegistrationNames: {
bubbled: keyOf({ onEmptied: true }),
captured: keyOf({ onEmptiedCapture: true })
}
},
encrypted: {
phasedRegistrationNames: {
bubbled: keyOf({ onEncrypted: true }),
captured: keyOf({ onEncryptedCapture: true })
}
},
ended: {
phasedRegistrationNames: {
bubbled: keyOf({ onEnded: true }),
captured: keyOf({ onEndedCapture: true })
}
},
error: {
phasedRegistrationNames: {
bubbled: keyOf({ onError: true }),
captured: keyOf({ onErrorCapture: true })
}
},
focus: {
phasedRegistrationNames: {
bubbled: keyOf({ onFocus: true }),
captured: keyOf({ onFocusCapture: true })
}
},
input: {
phasedRegistrationNames: {
bubbled: keyOf({ onInput: true }),
captured: keyOf({ onInputCapture: true })
}
},
keyDown: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyDown: true }),
captured: keyOf({ onKeyDownCapture: true })
}
},
keyPress: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyPress: true }),
captured: keyOf({ onKeyPressCapture: true })
}
},
keyUp: {
phasedRegistrationNames: {
bubbled: keyOf({ onKeyUp: true }),
captured: keyOf({ onKeyUpCapture: true })
}
},
load: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoad: true }),
captured: keyOf({ onLoadCapture: true })
}
},
loadedData: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoadedData: true }),
captured: keyOf({ onLoadedDataCapture: true })
}
},
loadedMetadata: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoadedMetadata: true }),
captured: keyOf({ onLoadedMetadataCapture: true })
}
},
loadStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onLoadStart: true }),
captured: keyOf({ onLoadStartCapture: true })
}
},
// Note: We do not allow listening to mouseOver events. Instead, use the
// onMouseEnter/onMouseLeave created by `EnterLeaveEventPlugin`.
mouseDown: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseDown: true }),
captured: keyOf({ onMouseDownCapture: true })
}
},
mouseMove: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseMove: true }),
captured: keyOf({ onMouseMoveCapture: true })
}
},
mouseOut: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseOut: true }),
captured: keyOf({ onMouseOutCapture: true })
}
},
mouseOver: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseOver: true }),
captured: keyOf({ onMouseOverCapture: true })
}
},
mouseUp: {
phasedRegistrationNames: {
bubbled: keyOf({ onMouseUp: true }),
captured: keyOf({ onMouseUpCapture: true })
}
},
paste: {
phasedRegistrationNames: {
bubbled: keyOf({ onPaste: true }),
captured: keyOf({ onPasteCapture: true })
}
},
pause: {
phasedRegistrationNames: {
bubbled: keyOf({ onPause: true }),
captured: keyOf({ onPauseCapture: true })
}
},
play: {
phasedRegistrationNames: {
bubbled: keyOf({ onPlay: true }),
captured: keyOf({ onPlayCapture: true })
}
},
playing: {
phasedRegistrationNames: {
bubbled: keyOf({ onPlaying: true }),
captured: keyOf({ onPlayingCapture: true })
}
},
progress: {
phasedRegistrationNames: {
bubbled: keyOf({ onProgress: true }),
captured: keyOf({ onProgressCapture: true })
}
},
rateChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onRateChange: true }),
captured: keyOf({ onRateChangeCapture: true })
}
},
reset: {
phasedRegistrationNames: {
bubbled: keyOf({ onReset: true }),
captured: keyOf({ onResetCapture: true })
}
},
scroll: {
phasedRegistrationNames: {
bubbled: keyOf({ onScroll: true }),
captured: keyOf({ onScrollCapture: true })
}
},
seeked: {
phasedRegistrationNames: {
bubbled: keyOf({ onSeeked: true }),
captured: keyOf({ onSeekedCapture: true })
}
},
seeking: {
phasedRegistrationNames: {
bubbled: keyOf({ onSeeking: true }),
captured: keyOf({ onSeekingCapture: true })
}
},
stalled: {
phasedRegistrationNames: {
bubbled: keyOf({ onStalled: true }),
captured: keyOf({ onStalledCapture: true })
}
},
submit: {
phasedRegistrationNames: {
bubbled: keyOf({ onSubmit: true }),
captured: keyOf({ onSubmitCapture: true })
}
},
suspend: {
phasedRegistrationNames: {
bubbled: keyOf({ onSuspend: true }),
captured: keyOf({ onSuspendCapture: true })
}
},
timeUpdate: {
phasedRegistrationNames: {
bubbled: keyOf({ onTimeUpdate: true }),
captured: keyOf({ onTimeUpdateCapture: true })
}
},
touchCancel: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchCancel: true }),
captured: keyOf({ onTouchCancelCapture: true })
}
},
touchEnd: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchEnd: true }),
captured: keyOf({ onTouchEndCapture: true })
}
},
touchMove: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchMove: true }),
captured: keyOf({ onTouchMoveCapture: true })
}
},
touchStart: {
phasedRegistrationNames: {
bubbled: keyOf({ onTouchStart: true }),
captured: keyOf({ onTouchStartCapture: true })
}
},
volumeChange: {
phasedRegistrationNames: {
bubbled: keyOf({ onVolumeChange: true }),
captured: keyOf({ onVolumeChangeCapture: true })
}
},
waiting: {
phasedRegistrationNames: {
bubbled: keyOf({ onWaiting: true }),
captured: keyOf({ onWaitingCapture: true })
}
},
wheel: {
phasedRegistrationNames: {
bubbled: keyOf({ onWheel: true }),
captured: keyOf({ onWheelCapture: true })
}
}
};
var topLevelEventsToDispatchConfig = {
topAbort: eventTypes.abort,
topBlur: eventTypes.blur,
topCanPlay: eventTypes.canPlay,
topCanPlayThrough: eventTypes.canPlayThrough,
topClick: eventTypes.click,
topContextMenu: eventTypes.contextMenu,
topCopy: eventTypes.copy,
topCut: eventTypes.cut,
topDoubleClick: eventTypes.doubleClick,
topDrag: eventTypes.drag,
topDragEnd: eventTypes.dragEnd,
topDragEnter: eventTypes.dragEnter,
topDragExit: eventTypes.dragExit,
topDragLeave: eventTypes.dragLeave,
topDragOver: eventTypes.dragOver,
topDragStart: eventTypes.dragStart,
topDrop: eventTypes.drop,
topDurationChange: eventTypes.durationChange,
topEmptied: eventTypes.emptied,
topEncrypted: eventTypes.encrypted,
topEnded: eventTypes.ended,
topError: eventTypes.error,
topFocus: eventTypes.focus,
topInput: eventTypes.input,
topKeyDown: eventTypes.keyDown,
topKeyPress: eventTypes.keyPress,
topKeyUp: eventTypes.keyUp,
topLoad: eventTypes.load,
topLoadedData: eventTypes.loadedData,
topLoadedMetadata: eventTypes.loadedMetadata,
topLoadStart: eventTypes.loadStart,
topMouseDown: eventTypes.mouseDown,
topMouseMove: eventTypes.mouseMove,
topMouseOut: eventTypes.mouseOut,
topMouseOver: eventTypes.mouseOver,
topMouseUp: eventTypes.mouseUp,
topPaste: eventTypes.paste,
topPause: eventTypes.pause,
topPlay: eventTypes.play,
topPlaying: eventTypes.playing,
topProgress: eventTypes.progress,
topRateChange: eventTypes.rateChange,
topReset: eventTypes.reset,
topScroll: eventTypes.scroll,
topSeeked: eventTypes.seeked,
topSeeking: eventTypes.seeking,
topStalled: eventTypes.stalled,
topSubmit: eventTypes.submit,
topSuspend: eventTypes.suspend,
topTimeUpdate: eventTypes.timeUpdate,
topTouchCancel: eventTypes.touchCancel,
topTouchEnd: eventTypes.touchEnd,
topTouchMove: eventTypes.touchMove,
topTouchStart: eventTypes.touchStart,
topVolumeChange: eventTypes.volumeChange,
topWaiting: eventTypes.waiting,
topWheel: eventTypes.wheel
};
for (var type in topLevelEventsToDispatchConfig) {
topLevelEventsToDispatchConfig[type].dependencies = [type];
}
var ON_CLICK_KEY = keyOf({ onClick: null });
var onClickListeners = {};
var SimpleEventPlugin = {
eventTypes: eventTypes,
/**
* @param {string} topLevelType Record from `EventConstants`.
* @param {DOMEventTarget} topLevelTarget The listening component root node.
* @param {string} topLevelTargetID ID of `topLevelTarget`.
* @param {object} nativeEvent Native browser event.
* @return {*} An accumulation of synthetic events.
* @see {EventPluginHub.extractEvents}
*/
extractEvents: function (topLevelType, topLevelTarget, topLevelTargetID, nativeEvent, nativeEventTarget) {
var dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
return null;
}
var EventConstructor;
switch (topLevelType) {
case topLevelTypes.topAbort:
case topLevelTypes.topCanPlay:
case topLevelTypes.topCanPlayThrough:
case topLevelTypes.topDurationChange:
case topLevelTypes.topEmptied:
case topLevelTypes.topEncrypted:
case topLevelTypes.topEnded:
case topLevelTypes.topError:
case topLevelTypes.topInput:
case topLevelTypes.topLoad:
case topLevelTypes.topLoadedData:
case topLevelTypes.topLoadedMetadata:
case topLevelTypes.topLoadStart:
case topLevelTypes.topPause:
case topLevelTypes.topPlay:
case topLevelTypes.topPlaying:
case topLevelTypes.topProgress:
case topLevelTypes.topRateChange:
case topLevelTypes.topReset:
case topLevelTypes.topSeeked:
case topLevelTypes.topSeeking:
case topLevelTypes.topStalled:
case topLevelTypes.topSubmit:
case topLevelTypes.topSuspend:
case topLevelTypes.topTimeUpdate:
case topLevelTypes.topVolumeChange:
case topLevelTypes.topWaiting:
// HTML Events
// @see http://www.w3.org/TR/html5/index.html#events-0
EventConstructor = SyntheticEvent;
break;
case topLevelTypes.topKeyPress:
// FireFox creates a keypress event for function keys too. This removes
// the unwanted keypress events. Enter is however both printable and
// non-printable. One would expect Tab to be as well (but it isn't).
if (getEventCharCode(nativeEvent) === 0) {
return null;
}
/* falls through */
case topLevelTypes.topKeyDown:
case topLevelTypes.topKeyUp:
EventConstructor = SyntheticKeyboardEvent;
break;
case topLevelTypes.topBlur:
case topLevelTypes.topFocus:
EventConstructor = SyntheticFocusEvent;
break;
case topLevelTypes.topClick:
// Firefox creates a click event on right mouse clicks. This removes the
// unwanted click events.
if (nativeEvent.button === 2) {
return null;
}
/* falls through */
case topLevelTypes.topContextMenu:
case topLevelTypes.topDoubleClick:
case topLevelTypes.topMouseDown:
case topLevelTypes.topMouseMove:
case topLevelTypes.topMouseOut:
case topLevelTypes.topMouseOver:
case topLevelTypes.topMouseUp:
EventConstructor = SyntheticMouseEvent;
break;
case topLevelTypes.topDrag:
case topLevelTypes.topDragEnd:
case topLevelTypes.topDragEnter:
case topLevelTypes.topDragExit:
case topLevelTypes.topDragLeave:
case topLevelTypes.topDragOver:
case topLevelTypes.topDragStart:
case topLevelTypes.topDrop:
EventConstructor = SyntheticDragEvent;
break;
case topLevelTypes.topTouchCancel:
case topLevelTypes.topTouchEnd:
case topLevelTypes.topTouchMove:
case topLevelTypes.topTouchStart:
EventConstructor = SyntheticTouchEvent;
break;
case topLevelTypes.topScroll:
EventConstructor = SyntheticUIEvent;
break;
case topLevelTypes.topWheel:
EventConstructor = SyntheticWheelEvent;
break;
case topLevelTypes.topCopy:
case topLevelTypes.topCut:
case topLevelTypes.topPaste:
EventConstructor = SyntheticClipboardEvent;
break;
}
!EventConstructor ? "development" !== 'production' ? invariant(false, 'SimpleEventPlugin: Unhandled event type, `%s`.', topLevelType) : invariant(false) : undefined;
var event = EventConstructor.getPooled(dispatchConfig, topLevelTargetID, nativeEvent, nativeEventTarget);
EventPropagators.accumulateTwoPhaseDispatches(event);
return event;
},
didPutListener: function (id, registrationName, listener) {
// Mobile Safari does not fire properly bubble click events on
// non-interactive elements, which means delegated click listeners do not
// fire. The workaround for this bug involves attaching an empty click
// listener on the target node.
if (registrationName === ON_CLICK_KEY) {
var node = ReactMount.getNode(id);
if (!onClickListeners[id]) {
onClickListeners[id] = EventListener.listen(node, 'click', emptyFunction);
}
}
},
willDeleteListener: function (id, registrationName) {
if (registrationName === ON_CLICK_KEY) {
onClickListeners[id].remove();
delete onClickListeners[id];
}
}
};
module.exports = SimpleEventPlugin;
},{"102":102,"104":104,"105":105,"106":106,"108":108,"109":109,"110":110,"111":111,"112":112,"124":124,"145":145,"15":15,"152":152,"160":160,"165":165,"19":19,"72":72}],102:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticClipboardEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = _dereq_(105);
/**
* @interface Event
* @see http://www.w3.org/TR/clipboard-apis/
*/
var ClipboardEventInterface = {
clipboardData: function (event) {
return 'clipboardData' in event ? event.clipboardData : window.clipboardData;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticClipboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticClipboardEvent, ClipboardEventInterface);
module.exports = SyntheticClipboardEvent;
},{"105":105}],103:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticCompositionEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = _dereq_(105);
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents
*/
var CompositionEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticCompositionEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticCompositionEvent, CompositionEventInterface);
module.exports = SyntheticCompositionEvent;
},{"105":105}],104:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticDragEvent
* @typechecks static-only
*/
'use strict';
var SyntheticMouseEvent = _dereq_(109);
/**
* @interface DragEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var DragEventInterface = {
dataTransfer: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticDragEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticDragEvent, DragEventInterface);
module.exports = SyntheticDragEvent;
},{"109":109}],105:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticEvent
* @typechecks static-only
*/
'use strict';
var PooledClass = _dereq_(25);
var assign = _dereq_(24);
var emptyFunction = _dereq_(152);
var warning = _dereq_(172);
/**
* @interface Event
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var EventInterface = {
type: null,
// currentTarget is set when dispatching; no use in copying it here
currentTarget: emptyFunction.thatReturnsNull,
eventPhase: null,
bubbles: null,
cancelable: null,
timeStamp: function (event) {
return event.timeStamp || Date.now();
},
defaultPrevented: null,
isTrusted: null
};
/**
* Synthetic events are dispatched by event plugins, typically in response to a
* top-level event delegation handler.
*
* These systems should generally use pooling to reduce the frequency of garbage
* collection. The system should check `isPersistent` to determine whether the
* event should be released into the pool after being dispatched. Users that
* need a persisted event should invoke `persist`.
*
* Synthetic events (and subclasses) implement the DOM Level 3 Events API by
* normalizing browser quirks. Subclasses do not necessarily have to implement a
* DOM interface; custom application-specific events can also subclass this.
*
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
*/
function SyntheticEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
this.dispatchConfig = dispatchConfig;
this.dispatchMarker = dispatchMarker;
this.nativeEvent = nativeEvent;
this.target = nativeEventTarget;
this.currentTarget = nativeEventTarget;
var Interface = this.constructor.Interface;
for (var propName in Interface) {
if (!Interface.hasOwnProperty(propName)) {
continue;
}
var normalize = Interface[propName];
if (normalize) {
this[propName] = normalize(nativeEvent);
} else {
this[propName] = nativeEvent[propName];
}
}
var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false;
if (defaultPrevented) {
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
} else {
this.isDefaultPrevented = emptyFunction.thatReturnsFalse;
}
this.isPropagationStopped = emptyFunction.thatReturnsFalse;
}
assign(SyntheticEvent.prototype, {
preventDefault: function () {
this.defaultPrevented = true;
var event = this.nativeEvent;
if ("development" !== 'production') {
"development" !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `preventDefault` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
}
if (!event) {
return;
}
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false;
}
this.isDefaultPrevented = emptyFunction.thatReturnsTrue;
},
stopPropagation: function () {
var event = this.nativeEvent;
if ("development" !== 'production') {
"development" !== 'production' ? warning(event, 'This synthetic event is reused for performance reasons. If you\'re ' + 'seeing this, you\'re calling `stopPropagation` on a ' + 'released/nullified synthetic event. This is a no-op. See ' + 'https://fb.me/react-event-pooling for more information.') : undefined;
}
if (!event) {
return;
}
if (event.stopPropagation) {
event.stopPropagation();
} else {
event.cancelBubble = true;
}
this.isPropagationStopped = emptyFunction.thatReturnsTrue;
},
/**
* We release all dispatched `SyntheticEvent`s after each event loop, adding
* them back into the pool. This allows a way to hold onto a reference that
* won't be added back into the pool.
*/
persist: function () {
this.isPersistent = emptyFunction.thatReturnsTrue;
},
/**
* Checks if this event should be released back into the pool.
*
* @return {boolean} True if this should not be released, false otherwise.
*/
isPersistent: emptyFunction.thatReturnsFalse,
/**
* `PooledClass` looks for `destructor` on each instance it releases.
*/
destructor: function () {
var Interface = this.constructor.Interface;
for (var propName in Interface) {
this[propName] = null;
}
this.dispatchConfig = null;
this.dispatchMarker = null;
this.nativeEvent = null;
}
});
SyntheticEvent.Interface = EventInterface;
/**
* Helper to reduce boilerplate when creating subclasses.
*
* @param {function} Class
* @param {?object} Interface
*/
SyntheticEvent.augmentClass = function (Class, Interface) {
var Super = this;
var prototype = Object.create(Super.prototype);
assign(prototype, Class.prototype);
Class.prototype = prototype;
Class.prototype.constructor = Class;
Class.Interface = assign({}, Super.Interface, Interface);
Class.augmentClass = Super.augmentClass;
PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler);
};
PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);
module.exports = SyntheticEvent;
},{"152":152,"172":172,"24":24,"25":25}],106:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticFocusEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = _dereq_(111);
/**
* @interface FocusEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var FocusEventInterface = {
relatedTarget: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticFocusEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticFocusEvent, FocusEventInterface);
module.exports = SyntheticFocusEvent;
},{"111":111}],107:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticInputEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = _dereq_(105);
/**
* @interface Event
* @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105
* /#events-inputevents
*/
var InputEventInterface = {
data: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticInputEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticInputEvent, InputEventInterface);
module.exports = SyntheticInputEvent;
},{"105":105}],108:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticKeyboardEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = _dereq_(111);
var getEventCharCode = _dereq_(124);
var getEventKey = _dereq_(125);
var getEventModifierState = _dereq_(126);
/**
* @interface KeyboardEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var KeyboardEventInterface = {
key: getEventKey,
location: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
repeat: null,
locale: null,
getModifierState: getEventModifierState,
// Legacy Interface
charCode: function (event) {
// `charCode` is the result of a KeyPress event and represents the value of
// the actual printable character.
// KeyPress is deprecated, but its replacement is not yet final and not
// implemented in any major browser. Only KeyPress has charCode.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
return 0;
},
keyCode: function (event) {
// `keyCode` is the result of a KeyDown/Up event and represents the value of
// physical keyboard key.
// The actual meaning of the value depends on the users' keyboard layout
// which cannot be detected. Assuming that it is a US keyboard layout
// provides a surprisingly accurate mapping for US and European users.
// Due to this, it is left to the user to implement at this time.
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
},
which: function (event) {
// `which` is an alias for either `keyCode` or `charCode` depending on the
// type of the event.
if (event.type === 'keypress') {
return getEventCharCode(event);
}
if (event.type === 'keydown' || event.type === 'keyup') {
return event.keyCode;
}
return 0;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticKeyboardEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticKeyboardEvent, KeyboardEventInterface);
module.exports = SyntheticKeyboardEvent;
},{"111":111,"124":124,"125":125,"126":126}],109:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticMouseEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = _dereq_(111);
var ViewportMetrics = _dereq_(114);
var getEventModifierState = _dereq_(126);
/**
* @interface MouseEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var MouseEventInterface = {
screenX: null,
screenY: null,
clientX: null,
clientY: null,
ctrlKey: null,
shiftKey: null,
altKey: null,
metaKey: null,
getModifierState: getEventModifierState,
button: function (event) {
// Webkit, Firefox, IE9+
// which: 1 2 3
// button: 0 1 2 (standard)
var button = event.button;
if ('which' in event) {
return button;
}
// IE<9
// which: undefined
// button: 0 0 0
// button: 1 4 2 (onmouseup)
return button === 2 ? 2 : button === 4 ? 1 : 0;
},
buttons: null,
relatedTarget: function (event) {
return event.relatedTarget || (event.fromElement === event.srcElement ? event.toElement : event.fromElement);
},
// "Proprietary" Interface.
pageX: function (event) {
return 'pageX' in event ? event.pageX : event.clientX + ViewportMetrics.currentScrollLeft;
},
pageY: function (event) {
return 'pageY' in event ? event.pageY : event.clientY + ViewportMetrics.currentScrollTop;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticMouseEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticMouseEvent, MouseEventInterface);
module.exports = SyntheticMouseEvent;
},{"111":111,"114":114,"126":126}],110:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticTouchEvent
* @typechecks static-only
*/
'use strict';
var SyntheticUIEvent = _dereq_(111);
var getEventModifierState = _dereq_(126);
/**
* @interface TouchEvent
* @see http://www.w3.org/TR/touch-events/
*/
var TouchEventInterface = {
touches: null,
targetTouches: null,
changedTouches: null,
altKey: null,
metaKey: null,
ctrlKey: null,
shiftKey: null,
getModifierState: getEventModifierState
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticUIEvent}
*/
function SyntheticTouchEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticUIEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticUIEvent.augmentClass(SyntheticTouchEvent, TouchEventInterface);
module.exports = SyntheticTouchEvent;
},{"111":111,"126":126}],111:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticUIEvent
* @typechecks static-only
*/
'use strict';
var SyntheticEvent = _dereq_(105);
var getEventTarget = _dereq_(127);
/**
* @interface UIEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var UIEventInterface = {
view: function (event) {
if (event.view) {
return event.view;
}
var target = getEventTarget(event);
if (target != null && target.window === target) {
// target is a window object
return target;
}
var doc = target.ownerDocument;
// TODO: Figure out why `ownerDocument` is sometimes undefined in IE8.
if (doc) {
return doc.defaultView || doc.parentWindow;
} else {
return window;
}
},
detail: function (event) {
return event.detail || 0;
}
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticEvent}
*/
function SyntheticUIEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticEvent.augmentClass(SyntheticUIEvent, UIEventInterface);
module.exports = SyntheticUIEvent;
},{"105":105,"127":127}],112:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule SyntheticWheelEvent
* @typechecks static-only
*/
'use strict';
var SyntheticMouseEvent = _dereq_(109);
/**
* @interface WheelEvent
* @see http://www.w3.org/TR/DOM-Level-3-Events/
*/
var WheelEventInterface = {
deltaX: function (event) {
return 'deltaX' in event ? event.deltaX :
// Fallback to `wheelDeltaX` for Webkit and normalize (right is positive).
'wheelDeltaX' in event ? -event.wheelDeltaX : 0;
},
deltaY: function (event) {
return 'deltaY' in event ? event.deltaY :
// Fallback to `wheelDeltaY` for Webkit and normalize (down is positive).
'wheelDeltaY' in event ? -event.wheelDeltaY :
// Fallback to `wheelDelta` for IE<9 and normalize (down is positive).
'wheelDelta' in event ? -event.wheelDelta : 0;
},
deltaZ: null,
// Browsers without "deltaMode" is reporting in raw wheel delta where one
// notch on the scroll is always +/- 120, roughly equivalent to pixels.
// A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or
// ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size.
deltaMode: null
};
/**
* @param {object} dispatchConfig Configuration used to dispatch this event.
* @param {string} dispatchMarker Marker identifying the event target.
* @param {object} nativeEvent Native browser event.
* @extends {SyntheticMouseEvent}
*/
function SyntheticWheelEvent(dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget) {
SyntheticMouseEvent.call(this, dispatchConfig, dispatchMarker, nativeEvent, nativeEventTarget);
}
SyntheticMouseEvent.augmentClass(SyntheticWheelEvent, WheelEventInterface);
module.exports = SyntheticWheelEvent;
},{"109":109}],113:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Transaction
*/
'use strict';
var invariant = _dereq_(160);
/**
* `Transaction` creates a black box that is able to wrap any method such that
* certain invariants are maintained before and after the method is invoked
* (Even if an exception is thrown while invoking the wrapped method). Whoever
* instantiates a transaction can provide enforcers of the invariants at
* creation time. The `Transaction` class itself will supply one additional
* automatic invariant for you - the invariant that any transaction instance
* should not be run while it is already being run. You would typically create a
* single instance of a `Transaction` for reuse multiple times, that potentially
* is used to wrap several different methods. Wrappers are extremely simple -
* they only require implementing two methods.
*
* <pre>
* wrappers (injected at creation time)
* + +
* | |
* +-----------------|--------|--------------+
* | v | |
* | +---------------+ | |
* | +--| wrapper1 |---|----+ |
* | | +---------------+ v | |
* | | +-------------+ | |
* | | +----| wrapper2 |--------+ |
* | | | +-------------+ | | |
* | | | | | |
* | v v v v | wrapper
* | +---+ +---+ +---------+ +---+ +---+ | invariants
* perform(anyMethod) | | | | | | | | | | | | maintained
* +----------------->|-|---|-|---|-->|anyMethod|---|---|-|---|-|-------->
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | | | | | | | | | | | |
* | +---+ +---+ +---------+ +---+ +---+ |
* | initialize close |
* +-----------------------------------------+
* </pre>
*
* Use cases:
* - Preserving the input selection ranges before/after reconciliation.
* Restoring selection even in the event of an unexpected error.
* - Deactivating events while rearranging the DOM, preventing blurs/focuses,
* while guaranteeing that afterwards, the event system is reactivated.
* - Flushing a queue of collected DOM mutations to the main UI thread after a
* reconciliation takes place in a worker thread.
* - Invoking any collected `componentDidUpdate` callbacks after rendering new
* content.
* - (Future use case): Wrapping particular flushes of the `ReactWorker` queue
* to preserve the `scrollTop` (an automatic scroll aware DOM).
* - (Future use case): Layout calculations before and after DOM updates.
*
* Transactional plugin API:
* - A module that has an `initialize` method that returns any precomputation.
* - and a `close` method that accepts the precomputation. `close` is invoked
* when the wrapped process is completed, or has failed.
*
* @param {Array<TransactionalWrapper>} transactionWrapper Wrapper modules
* that implement `initialize` and `close`.
* @return {Transaction} Single transaction for reuse in thread.
*
* @class Transaction
*/
var Mixin = {
/**
* Sets up this instance so that it is prepared for collecting metrics. Does
* so such that this setup method may be used on an instance that is already
* initialized, in a way that does not consume additional memory upon reuse.
* That can be useful if you decide to make your subclass of this mixin a
* "PooledClass".
*/
reinitializeTransaction: function () {
this.transactionWrappers = this.getTransactionWrappers();
if (this.wrapperInitData) {
this.wrapperInitData.length = 0;
} else {
this.wrapperInitData = [];
}
this._isInTransaction = false;
},
_isInTransaction: false,
/**
* @abstract
* @return {Array<TransactionWrapper>} Array of transaction wrappers.
*/
getTransactionWrappers: null,
isInTransaction: function () {
return !!this._isInTransaction;
},
/**
* Executes the function within a safety window. Use this for the top level
* methods that result in large amounts of computation/mutations that would
* need to be safety checked. The optional arguments helps prevent the need
* to bind in many cases.
*
* @param {function} method Member of scope to call.
* @param {Object} scope Scope to invoke from.
* @param {Object?=} a Argument to pass to the method.
* @param {Object?=} b Argument to pass to the method.
* @param {Object?=} c Argument to pass to the method.
* @param {Object?=} d Argument to pass to the method.
* @param {Object?=} e Argument to pass to the method.
* @param {Object?=} f Argument to pass to the method.
*
* @return {*} Return value from `method`.
*/
perform: function (method, scope, a, b, c, d, e, f) {
!!this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.perform(...): Cannot initialize a transaction when there ' + 'is already an outstanding transaction.') : invariant(false) : undefined;
var errorThrown;
var ret;
try {
this._isInTransaction = true;
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// one of these calls threw.
errorThrown = true;
this.initializeAll(0);
ret = method.call(scope, a, b, c, d, e, f);
errorThrown = false;
} finally {
try {
if (errorThrown) {
// If `method` throws, prefer to show that stack trace over any thrown
// by invoking `closeAll`.
try {
this.closeAll(0);
} catch (err) {}
} else {
// Since `method` didn't throw, we don't want to silence the exception
// here.
this.closeAll(0);
}
} finally {
this._isInTransaction = false;
}
}
return ret;
},
initializeAll: function (startIndex) {
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
try {
// Catching errors makes debugging more difficult, so we start with the
// OBSERVED_ERROR state before overwriting it with the real return value
// of initialize -- if it's still set to OBSERVED_ERROR in the finally
// block, it means wrapper.initialize threw.
this.wrapperInitData[i] = Transaction.OBSERVED_ERROR;
this.wrapperInitData[i] = wrapper.initialize ? wrapper.initialize.call(this) : null;
} finally {
if (this.wrapperInitData[i] === Transaction.OBSERVED_ERROR) {
// The initializer for wrapper i threw an error; initialize the
// remaining wrappers but silence any exceptions from them to ensure
// that the first error is the one to bubble up.
try {
this.initializeAll(i + 1);
} catch (err) {}
}
}
}
},
/**
* Invokes each of `this.transactionWrappers.close[i]` functions, passing into
* them the respective return values of `this.transactionWrappers.init[i]`
* (`close`rs that correspond to initializers that failed will not be
* invoked).
*/
closeAll: function (startIndex) {
!this.isInTransaction() ? "development" !== 'production' ? invariant(false, 'Transaction.closeAll(): Cannot close transaction when none are open.') : invariant(false) : undefined;
var transactionWrappers = this.transactionWrappers;
for (var i = startIndex; i < transactionWrappers.length; i++) {
var wrapper = transactionWrappers[i];
var initData = this.wrapperInitData[i];
var errorThrown;
try {
// Catching errors makes debugging more difficult, so we start with
// errorThrown set to true before setting it to false after calling
// close -- if it's still set to true in the finally block, it means
// wrapper.close threw.
errorThrown = true;
if (initData !== Transaction.OBSERVED_ERROR && wrapper.close) {
wrapper.close.call(this, initData);
}
errorThrown = false;
} finally {
if (errorThrown) {
// The closer for wrapper i threw an error; close the remaining
// wrappers but silence any exceptions from them to ensure that the
// first error is the one to bubble up.
try {
this.closeAll(i + 1);
} catch (e) {}
}
}
}
this.wrapperInitData.length = 0;
}
};
var Transaction = {
Mixin: Mixin,
/**
* Token to look for to determine if an error occurred.
*/
OBSERVED_ERROR: {}
};
module.exports = Transaction;
},{"160":160}],114:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ViewportMetrics
*/
'use strict';
var ViewportMetrics = {
currentScrollLeft: 0,
currentScrollTop: 0,
refreshScrollValues: function (scrollPosition) {
ViewportMetrics.currentScrollLeft = scrollPosition.x;
ViewportMetrics.currentScrollTop = scrollPosition.y;
}
};
module.exports = ViewportMetrics;
},{}],115:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule accumulateInto
*/
'use strict';
var invariant = _dereq_(160);
/**
*
* Accumulates items that must not be null or undefined into the first one. This
* is used to conserve memory by avoiding array allocations, and thus sacrifices
* API cleanness. Since `current` can be null before being passed in and not
* null after this function, make sure to assign it back to `current`:
*
* `a = accumulateInto(a, b);`
*
* This API should be sparingly used. Try `accumulate` for something cleaner.
*
* @return {*|array<*>} An accumulation of items.
*/
function accumulateInto(current, next) {
!(next != null) ? "development" !== 'production' ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : invariant(false) : undefined;
if (current == null) {
return next;
}
// Both are not empty. Warning: Never call x.concat(y) when you are not
// certain that x is an Array (x could be a string with concat method).
var currentIsArray = Array.isArray(current);
var nextIsArray = Array.isArray(next);
if (currentIsArray && nextIsArray) {
current.push.apply(current, next);
return current;
}
if (currentIsArray) {
current.push(next);
return current;
}
if (nextIsArray) {
// A bit too dangerous to mutate `next`.
return [current].concat(next);
}
return [current, next];
}
module.exports = accumulateInto;
},{"160":160}],116:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule adler32
*/
'use strict';
var MOD = 65521;
// adler32 is not cryptographically strong, and is only used to sanity check that
// markup generated on the server matches the markup generated on the client.
// This implementation (a modified version of the SheetJS version) has been optimized
// for our use case, at the expense of conforming to the adler32 specification
// for non-ascii inputs.
function adler32(data) {
var a = 1;
var b = 0;
var i = 0;
var l = data.length;
var m = l & ~0x3;
while (i < m) {
for (; i < Math.min(i + 4096, m); i += 4) {
b += (a += data.charCodeAt(i)) + (a += data.charCodeAt(i + 1)) + (a += data.charCodeAt(i + 2)) + (a += data.charCodeAt(i + 3));
}
a %= MOD;
b %= MOD;
}
for (; i < l; i++) {
b += a += data.charCodeAt(i);
}
a %= MOD;
b %= MOD;
return a | b << 16;
}
module.exports = adler32;
},{}],117:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @typechecks static-only
* @providesModule cloneWithProps
*/
'use strict';
var ReactElement = _dereq_(57);
var ReactPropTransferer = _dereq_(79);
var keyOf = _dereq_(165);
var warning = _dereq_(172);
var CHILDREN_PROP = keyOf({ children: null });
var didDeprecatedWarn = false;
/**
* Sometimes you want to change the props of a child passed to you. Usually
* this is to add a CSS class.
*
* @param {ReactElement} child child element you'd like to clone
* @param {object} props props you'd like to modify. className and style will be
* merged automatically.
* @return {ReactElement} a clone of child with props merged in.
* @deprecated
*/
function cloneWithProps(child, props) {
if ("development" !== 'production') {
"development" !== 'production' ? warning(didDeprecatedWarn, 'cloneWithProps(...) is deprecated. ' + 'Please use React.cloneElement instead.') : undefined;
didDeprecatedWarn = true;
"development" !== 'production' ? warning(!child.ref, 'You are calling cloneWithProps() on a child with a ref. This is ' + 'dangerous because you\'re creating a new child which will not be ' + 'added as a ref to its parent.') : undefined;
}
var newProps = ReactPropTransferer.mergeProps(props, child.props);
// Use `child.props.children` if it is provided.
if (!newProps.hasOwnProperty(CHILDREN_PROP) && child.props.hasOwnProperty(CHILDREN_PROP)) {
newProps.children = child.props.children;
}
// The current API doesn't retain _owner, which is why this
// doesn't use ReactElement.cloneAndReplaceProps.
return ReactElement.createElement(child.type, newProps);
}
module.exports = cloneWithProps;
},{"165":165,"172":172,"57":57,"79":79}],118:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule dangerousStyleValue
* @typechecks static-only
*/
'use strict';
var CSSProperty = _dereq_(4);
var isUnitlessNumber = CSSProperty.isUnitlessNumber;
/**
* Convert a value into the proper css writable value. The style name `name`
* should be logical (no hyphens), as specified
* in `CSSProperty.isUnitlessNumber`.
*
* @param {string} name CSS property name such as `topMargin`.
* @param {*} value CSS property value such as `10px`.
* @return {string} Normalized style value with dimensions applied.
*/
function dangerousStyleValue(name, value) {
// Note that we've removed escapeTextForBrowser() calls here since the
// whole string will be escaped when the attribute is injected into
// the markup. If you provide unsafe user data here they can inject
// arbitrary CSS which may be problematic (I couldn't repro this):
// https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet
// http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/
// This is not an XSS hole but instead a potential CSS injection issue
// which has lead to a greater discussion about how we're going to
// trust URLs moving forward. See #2115901
var isEmpty = value == null || typeof value === 'boolean' || value === '';
if (isEmpty) {
return '';
}
var isNonNumeric = isNaN(value);
if (isNonNumeric || value === 0 || isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name]) {
return '' + value; // cast to string
}
if (typeof value === 'string') {
value = value.trim();
}
return value + 'px';
}
module.exports = dangerousStyleValue;
},{"4":4}],119:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule deprecated
*/
'use strict';
var assign = _dereq_(24);
var warning = _dereq_(172);
/**
* This will log a single deprecation notice per function and forward the call
* on to the new API.
*
* @param {string} fnName The name of the function
* @param {string} newModule The module that fn will exist in
* @param {string} newPackage The module that fn will exist in
* @param {*} ctx The context this forwarded call should run in
* @param {function} fn The function to forward on to
* @return {function} The function that will warn once and then call fn
*/
function deprecated(fnName, newModule, newPackage, ctx, fn) {
var warned = false;
if ("development" !== 'production') {
var newFn = function () {
"development" !== 'production' ? warning(warned,
// Require examples in this string must be split to prevent React's
// build tools from mistaking them for real requires.
// Otherwise the build tools will attempt to build a '%s' module.
'React.%s is deprecated. Please use %s.%s from require' + '(\'%s\') ' + 'instead.', fnName, newModule, fnName, newPackage) : undefined;
warned = true;
return fn.apply(ctx, arguments);
};
// We need to make sure all properties of the original fn are copied over.
// In particular, this is needed to support PropTypes
return assign(newFn, fn);
}
return fn;
}
module.exports = deprecated;
},{"172":172,"24":24}],120:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule escapeTextContentForBrowser
*/
'use strict';
var ESCAPE_LOOKUP = {
'&': '&',
'>': '>',
'<': '<',
'"': '"',
'\'': '''
};
var ESCAPE_REGEX = /[&><"']/g;
function escaper(match) {
return ESCAPE_LOOKUP[match];
}
/**
* Escapes text to prevent scripting attacks.
*
* @param {*} text Text value to escape.
* @return {string} An escaped string.
*/
function escapeTextContentForBrowser(text) {
return ('' + text).replace(ESCAPE_REGEX, escaper);
}
module.exports = escapeTextContentForBrowser;
},{}],121:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule findDOMNode
* @typechecks static-only
*/
'use strict';
var ReactCurrentOwner = _dereq_(39);
var ReactInstanceMap = _dereq_(68);
var ReactMount = _dereq_(72);
var invariant = _dereq_(160);
var warning = _dereq_(172);
/**
* Returns the DOM node rendered by this element.
*
* @param {ReactComponent|DOMElement} componentOrElement
* @return {?DOMElement} The root node of this element.
*/
function findDOMNode(componentOrElement) {
if ("development" !== 'production') {
var owner = ReactCurrentOwner.current;
if (owner !== null) {
"development" !== 'production' ? warning(owner._warnedAboutRefsInRender, '%s is accessing getDOMNode or findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', owner.getName() || 'A component') : undefined;
owner._warnedAboutRefsInRender = true;
}
}
if (componentOrElement == null) {
return null;
}
if (componentOrElement.nodeType === 1) {
return componentOrElement;
}
if (ReactInstanceMap.has(componentOrElement)) {
return ReactMount.getNodeFromInstance(componentOrElement);
}
!(componentOrElement.render == null || typeof componentOrElement.render !== 'function') ? "development" !== 'production' ? invariant(false, 'findDOMNode was called on an unmounted component.') : invariant(false) : undefined;
!false ? "development" !== 'production' ? invariant(false, 'Element appears to be neither ReactComponent nor DOMNode (keys: %s)', Object.keys(componentOrElement)) : invariant(false) : undefined;
}
module.exports = findDOMNode;
},{"160":160,"172":172,"39":39,"68":68,"72":72}],122:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule flattenChildren
*/
'use strict';
var traverseAllChildren = _dereq_(141);
var warning = _dereq_(172);
/**
* @param {function} traverseContext Context passed through traversal.
* @param {?ReactComponent} child React child component.
* @param {!string} name String name of key path to child.
*/
function flattenSingleChildIntoContext(traverseContext, child, name) {
// We found a component instance.
var result = traverseContext;
var keyUnique = result[name] === undefined;
if ("development" !== 'production') {
"development" !== 'production' ? warning(keyUnique, 'flattenChildren(...): Encountered two children with the same key, ' + '`%s`. Child keys must be unique; when two children share a key, only ' + 'the first child will be used.', name) : undefined;
}
if (keyUnique && child != null) {
result[name] = child;
}
}
/**
* Flattens children that are typically specified as `props.children`. Any null
* children will not be included in the resulting object.
* @return {!object} flattened children keyed by name.
*/
function flattenChildren(children) {
if (children == null) {
return children;
}
var result = {};
traverseAllChildren(children, flattenSingleChildIntoContext, result);
return result;
}
module.exports = flattenChildren;
},{"141":141,"172":172}],123:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule forEachAccumulated
*/
'use strict';
/**
* @param {array} arr an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
*/
var forEachAccumulated = function (arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
cb.call(scope, arr);
}
};
module.exports = forEachAccumulated;
},{}],124:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventCharCode
* @typechecks static-only
*/
'use strict';
/**
* `charCode` represents the actual "character code" and is safe to use with
* `String.fromCharCode`. As such, only keys that correspond to printable
* characters produce a valid `charCode`, the only exception to this is Enter.
* The Tab-key is considered non-printable and does not have a `charCode`,
* presumably because it does not produce a tab-character in browsers.
*
* @param {object} nativeEvent Native browser event.
* @return {number} Normalized `charCode` property.
*/
function getEventCharCode(nativeEvent) {
var charCode;
var keyCode = nativeEvent.keyCode;
if ('charCode' in nativeEvent) {
charCode = nativeEvent.charCode;
// FF does not set `charCode` for the Enter-key, check against `keyCode`.
if (charCode === 0 && keyCode === 13) {
charCode = 13;
}
} else {
// IE8 does not implement `charCode`, but `keyCode` has the correct value.
charCode = keyCode;
}
// Some non-printable keys are reported in `charCode`/`keyCode`, discard them.
// Must not discard the (non-)printable Enter-key.
if (charCode >= 32 || charCode === 13) {
return charCode;
}
return 0;
}
module.exports = getEventCharCode;
},{}],125:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventKey
* @typechecks static-only
*/
'use strict';
var getEventCharCode = _dereq_(124);
/**
* Normalization of deprecated HTML5 `key` values
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var normalizeKey = {
'Esc': 'Escape',
'Spacebar': ' ',
'Left': 'ArrowLeft',
'Up': 'ArrowUp',
'Right': 'ArrowRight',
'Down': 'ArrowDown',
'Del': 'Delete',
'Win': 'OS',
'Menu': 'ContextMenu',
'Apps': 'ContextMenu',
'Scroll': 'ScrollLock',
'MozPrintableKey': 'Unidentified'
};
/**
* Translation from legacy `keyCode` to HTML5 `key`
* Only special keys supported, all others depend on keyboard layout or browser
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names
*/
var translateToKey = {
8: 'Backspace',
9: 'Tab',
12: 'Clear',
13: 'Enter',
16: 'Shift',
17: 'Control',
18: 'Alt',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
32: ' ',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
45: 'Insert',
46: 'Delete',
112: 'F1', 113: 'F2', 114: 'F3', 115: 'F4', 116: 'F5', 117: 'F6',
118: 'F7', 119: 'F8', 120: 'F9', 121: 'F10', 122: 'F11', 123: 'F12',
144: 'NumLock',
145: 'ScrollLock',
224: 'Meta'
};
/**
* @param {object} nativeEvent Native browser event.
* @return {string} Normalized `key` property.
*/
function getEventKey(nativeEvent) {
if (nativeEvent.key) {
// Normalize inconsistent values reported by browsers due to
// implementations of a working draft specification.
// FireFox implements `key` but returns `MozPrintableKey` for all
// printable characters (normalized to `Unidentified`), ignore it.
var key = normalizeKey[nativeEvent.key] || nativeEvent.key;
if (key !== 'Unidentified') {
return key;
}
}
// Browser does not implement `key`, polyfill as much of it as we can.
if (nativeEvent.type === 'keypress') {
var charCode = getEventCharCode(nativeEvent);
// The enter-key is technically both printable and non-printable and can
// thus be captured by `keypress`, no other non-printable key should.
return charCode === 13 ? 'Enter' : String.fromCharCode(charCode);
}
if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') {
// While user keyboard layout determines the actual meaning of each
// `keyCode` value, almost all function keys have a universal value.
return translateToKey[nativeEvent.keyCode] || 'Unidentified';
}
return '';
}
module.exports = getEventKey;
},{"124":124}],126:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventModifierState
* @typechecks static-only
*/
'use strict';
/**
* Translation from modifier key to the associated property in the event.
* @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers
*/
var modifierKeyToProp = {
'Alt': 'altKey',
'Control': 'ctrlKey',
'Meta': 'metaKey',
'Shift': 'shiftKey'
};
// IE8 does not implement getModifierState so we simply map it to the only
// modifier keys exposed by the event itself, does not support Lock-keys.
// Currently, all major browsers except Chrome seems to support Lock-keys.
function modifierStateGetter(keyArg) {
var syntheticEvent = this;
var nativeEvent = syntheticEvent.nativeEvent;
if (nativeEvent.getModifierState) {
return nativeEvent.getModifierState(keyArg);
}
var keyProp = modifierKeyToProp[keyArg];
return keyProp ? !!nativeEvent[keyProp] : false;
}
function getEventModifierState(nativeEvent) {
return modifierStateGetter;
}
module.exports = getEventModifierState;
},{}],127:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getEventTarget
* @typechecks static-only
*/
'use strict';
/**
* Gets the target node from a native browser event by accounting for
* inconsistencies in browser DOM APIs.
*
* @param {object} nativeEvent Native browser event.
* @return {DOMEventTarget} Target node.
*/
function getEventTarget(nativeEvent) {
var target = nativeEvent.target || nativeEvent.srcElement || window;
// Safari may fire events on text nodes (Node.TEXT_NODE is 3).
// @see http://www.quirksmode.org/js/events_properties.html
return target.nodeType === 3 ? target.parentNode : target;
}
module.exports = getEventTarget;
},{}],128:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getIteratorFn
* @typechecks static-only
*/
'use strict';
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
module.exports = getIteratorFn;
},{}],129:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getNodeForCharacterOffset
*/
'use strict';
/**
* Given any node return the first leaf node without children.
*
* @param {DOMElement|DOMTextNode} node
* @return {DOMElement|DOMTextNode}
*/
function getLeafNode(node) {
while (node && node.firstChild) {
node = node.firstChild;
}
return node;
}
/**
* Get the next sibling within a container. This will walk up the
* DOM if a node's siblings have been exhausted.
*
* @param {DOMElement|DOMTextNode} node
* @return {?DOMElement|DOMTextNode}
*/
function getSiblingNode(node) {
while (node) {
if (node.nextSibling) {
return node.nextSibling;
}
node = node.parentNode;
}
}
/**
* Get object describing the nodes which contain characters at offset.
*
* @param {DOMElement|DOMTextNode} root
* @param {number} offset
* @return {?object}
*/
function getNodeForCharacterOffset(root, offset) {
var node = getLeafNode(root);
var nodeStart = 0;
var nodeEnd = 0;
while (node) {
if (node.nodeType === 3) {
nodeEnd = nodeStart + node.textContent.length;
if (nodeStart <= offset && nodeEnd >= offset) {
return {
node: node,
offset: offset - nodeStart
};
}
nodeStart = nodeEnd;
}
node = getLeafNode(getSiblingNode(node));
}
}
module.exports = getNodeForCharacterOffset;
},{}],130:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getTextContentAccessor
*/
'use strict';
var ExecutionEnvironment = _dereq_(146);
var contentKey = null;
/**
* Gets the key used to access text content on a DOM node.
*
* @return {?string} Key used to access text content.
* @internal
*/
function getTextContentAccessor() {
if (!contentKey && ExecutionEnvironment.canUseDOM) {
// Prefer textContent to innerText because many browsers support both but
// SVG <text> elements don't support innerText even when <div> does.
contentKey = 'textContent' in document.documentElement ? 'textContent' : 'innerText';
}
return contentKey;
}
module.exports = getTextContentAccessor;
},{"146":146}],131:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule instantiateReactComponent
* @typechecks static-only
*/
'use strict';
var ReactCompositeComponent = _dereq_(38);
var ReactEmptyComponent = _dereq_(59);
var ReactNativeComponent = _dereq_(75);
var assign = _dereq_(24);
var invariant = _dereq_(160);
var warning = _dereq_(172);
// To avoid a cyclic dependency, we create the final class in this module
var ReactCompositeComponentWrapper = function () {};
assign(ReactCompositeComponentWrapper.prototype, ReactCompositeComponent.Mixin, {
_instantiateReactComponent: instantiateReactComponent
});
function getDeclarationErrorAddendum(owner) {
if (owner) {
var name = owner.getName();
if (name) {
return ' Check the render method of `' + name + '`.';
}
}
return '';
}
/**
* Check if the type reference is a known internal type. I.e. not a user
* provided composite type.
*
* @param {function} type
* @return {boolean} Returns true if this is a valid internal type.
*/
function isInternalComponentType(type) {
return typeof type === 'function' && typeof type.prototype !== 'undefined' && typeof type.prototype.mountComponent === 'function' && typeof type.prototype.receiveComponent === 'function';
}
/**
* Given a ReactNode, create an instance that will actually be mounted.
*
* @param {ReactNode} node
* @return {object} A new instance of the element's constructor.
* @protected
*/
function instantiateReactComponent(node) {
var instance;
if (node === null || node === false) {
instance = new ReactEmptyComponent(instantiateReactComponent);
} else if (typeof node === 'object') {
var element = node;
!(element && (typeof element.type === 'function' || typeof element.type === 'string')) ? "development" !== 'production' ? invariant(false, 'Element type is invalid: expected a string (for built-in components) ' + 'or a class/function (for composite components) but got: %s.%s', element.type == null ? element.type : typeof element.type, getDeclarationErrorAddendum(element._owner)) : invariant(false) : undefined;
// Special case string values
if (typeof element.type === 'string') {
instance = ReactNativeComponent.createInternalComponent(element);
} else if (isInternalComponentType(element.type)) {
// This is temporarily available for custom components that are not string
// representations. I.e. ART. Once those are updated to use the string
// representation, we can drop this code path.
instance = new element.type(element);
} else {
instance = new ReactCompositeComponentWrapper();
}
} else if (typeof node === 'string' || typeof node === 'number') {
instance = ReactNativeComponent.createInstanceForText(node);
} else {
!false ? "development" !== 'production' ? invariant(false, 'Encountered invalid React node of type %s', typeof node) : invariant(false) : undefined;
}
if ("development" !== 'production') {
"development" !== 'production' ? warning(typeof instance.construct === 'function' && typeof instance.mountComponent === 'function' && typeof instance.receiveComponent === 'function' && typeof instance.unmountComponent === 'function', 'Only React Components can be mounted.') : undefined;
}
// Sets up the instance. This can probably just move into the constructor now.
instance.construct(node);
// These two fields are used by the DOM and ART diffing algorithms
// respectively. Instead of using expandos on components, we should be
// storing the state needed by the diffing algorithms elsewhere.
instance._mountIndex = 0;
instance._mountImage = null;
if ("development" !== 'production') {
instance._isOwnerNecessary = false;
instance._warnedAboutRefsInRender = false;
}
// Internal instances should fully constructed at this point, so they should
// not get any new fields added to them at this point.
if ("development" !== 'production') {
if (Object.preventExtensions) {
Object.preventExtensions(instance);
}
}
return instance;
}
module.exports = instantiateReactComponent;
},{"160":160,"172":172,"24":24,"38":38,"59":59,"75":75}],132:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isEventSupported
*/
'use strict';
var ExecutionEnvironment = _dereq_(146);
var useHasFeature;
if (ExecutionEnvironment.canUseDOM) {
useHasFeature = document.implementation && document.implementation.hasFeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
document.implementation.hasFeature('', '') !== true;
}
/**
* Checks if an event is supported in the current execution environment.
*
* NOTE: This will not work correctly for non-generic events such as `change`,
* `reset`, `load`, `error`, and `select`.
*
* Borrows from Modernizr.
*
* @param {string} eventNameSuffix Event name, e.g. "click".
* @param {?boolean} capture Check if the capture phase is supported.
* @return {boolean} True if the event is supported.
* @internal
* @license Modernizr 3.0.0pre (Custom Build) | MIT
*/
function isEventSupported(eventNameSuffix, capture) {
if (!ExecutionEnvironment.canUseDOM || capture && !('addEventListener' in document)) {
return false;
}
var eventName = 'on' + eventNameSuffix;
var isSupported = (eventName in document);
if (!isSupported) {
var element = document.createElement('div');
element.setAttribute(eventName, 'return;');
isSupported = typeof element[eventName] === 'function';
}
if (!isSupported && useHasFeature && eventNameSuffix === 'wheel') {
// This is the only way to test support for the `wheel` event in IE9+.
isSupported = document.implementation.hasFeature('Events.wheel', '3.0');
}
return isSupported;
}
module.exports = isEventSupported;
},{"146":146}],133:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isTextInputElement
*/
'use strict';
/**
* @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary
*/
var supportedInputTypes = {
'color': true,
'date': true,
'datetime': true,
'datetime-local': true,
'email': true,
'month': true,
'number': true,
'password': true,
'range': true,
'search': true,
'tel': true,
'text': true,
'time': true,
'url': true,
'week': true
};
function isTextInputElement(elem) {
var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();
return nodeName && (nodeName === 'input' && supportedInputTypes[elem.type] || nodeName === 'textarea');
}
module.exports = isTextInputElement;
},{}],134:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule onlyChild
*/
'use strict';
var ReactElement = _dereq_(57);
var invariant = _dereq_(160);
/**
* Returns the first child in a collection of children and verifies that there
* is only one child in the collection. The current implementation of this
* function assumes that a single child gets passed without a wrapper, but the
* purpose of this helper function is to abstract away the particular structure
* of children.
*
* @param {?object} children Child collection structure.
* @return {ReactComponent} The first and only `ReactComponent` contained in the
* structure.
*/
function onlyChild(children) {
!ReactElement.isValidElement(children) ? "development" !== 'production' ? invariant(false, 'onlyChild must be passed a children with exactly one child.') : invariant(false) : undefined;
return children;
}
module.exports = onlyChild;
},{"160":160,"57":57}],135:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule quoteAttributeValueForBrowser
*/
'use strict';
var escapeTextContentForBrowser = _dereq_(120);
/**
* Escapes attribute value to prevent scripting attacks.
*
* @param {*} value Value to escape.
* @return {string} An escaped string.
*/
function quoteAttributeValueForBrowser(value) {
return '"' + escapeTextContentForBrowser(value) + '"';
}
module.exports = quoteAttributeValueForBrowser;
},{"120":120}],136:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule renderSubtreeIntoContainer
*/
'use strict';
var ReactMount = _dereq_(72);
module.exports = ReactMount.renderSubtreeIntoContainer;
},{"72":72}],137:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule setInnerHTML
*/
/* globals MSApp */
'use strict';
var ExecutionEnvironment = _dereq_(146);
var WHITESPACE_TEST = /^[ \r\n\t\f]/;
var NONVISIBLE_TEST = /<(!--|link|noscript|meta|script|style)[ \r\n\t\f\/>]/;
/**
* Set the innerHTML property of a node, ensuring that whitespace is preserved
* even in IE8.
*
* @param {DOMElement} node
* @param {string} html
* @internal
*/
var setInnerHTML = function (node, html) {
node.innerHTML = html;
};
// Win8 apps: Allow all html to be inserted
if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) {
setInnerHTML = function (node, html) {
MSApp.execUnsafeLocalFunction(function () {
node.innerHTML = html;
});
};
}
if (ExecutionEnvironment.canUseDOM) {
// IE8: When updating a just created node with innerHTML only leading
// whitespace is removed. When updating an existing node with innerHTML
// whitespace in root TextNodes is also collapsed.
// @see quirksmode.org/bugreports/archives/2004/11/innerhtml_and_t.html
// Feature detection; only IE8 is known to behave improperly like this.
var testElement = document.createElement('div');
testElement.innerHTML = ' ';
if (testElement.innerHTML === '') {
setInnerHTML = function (node, html) {
// Magic theory: IE8 supposedly differentiates between added and updated
// nodes when processing innerHTML, innerHTML on updated nodes suffers
// from worse whitespace behavior. Re-adding a node like this triggers
// the initial and more favorable whitespace behavior.
// TODO: What to do on a detached node?
if (node.parentNode) {
node.parentNode.replaceChild(node, node);
}
// We also implement a workaround for non-visible tags disappearing into
// thin air on IE8, this only happens if there is no visible text
// in-front of the non-visible tags. Piggyback on the whitespace fix
// and simply check if any non-visible tags appear in the source.
if (WHITESPACE_TEST.test(html) || html[0] === '<' && NONVISIBLE_TEST.test(html)) {
// Recover leading whitespace by temporarily prepending any character.
// \uFEFF has the potential advantage of being zero-width/invisible.
// UglifyJS drops U+FEFF chars when parsing, so use String.fromCharCode
// in hopes that this is preserved even if "\uFEFF" is transformed to
// the actual Unicode character (by Babel, for example).
// https://github.com/mishoo/UglifyJS2/blob/v2.4.20/lib/parse.js#L216
node.innerHTML = String.fromCharCode(0xFEFF) + html;
// deleteData leaves an empty `TextNode` which offsets the index of all
// children. Definitely want to avoid this.
var textNode = node.firstChild;
if (textNode.data.length === 1) {
node.removeChild(textNode);
} else {
textNode.deleteData(0, 1);
}
} else {
node.innerHTML = html;
}
};
}
}
module.exports = setInnerHTML;
},{"146":146}],138:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule setTextContent
*/
'use strict';
var ExecutionEnvironment = _dereq_(146);
var escapeTextContentForBrowser = _dereq_(120);
var setInnerHTML = _dereq_(137);
/**
* Set the textContent property of a node, ensuring that whitespace is preserved
* even in IE8. innerText is a poor substitute for textContent and, among many
* issues, inserts <br> instead of the literal newline chars. innerHTML behaves
* as it should.
*
* @param {DOMElement} node
* @param {string} text
* @internal
*/
var setTextContent = function (node, text) {
node.textContent = text;
};
if (ExecutionEnvironment.canUseDOM) {
if (!('textContent' in document.documentElement)) {
setTextContent = function (node, text) {
setInnerHTML(node, escapeTextContentForBrowser(text));
};
}
}
module.exports = setTextContent;
},{"120":120,"137":137,"146":146}],139:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shallowCompare
*/
'use strict';
var shallowEqual = _dereq_(170);
/**
* Does a shallow comparison for props and state.
* See ReactComponentWithPureRenderMixin
*/
function shallowCompare(instance, nextProps, nextState) {
return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
}
module.exports = shallowCompare;
},{"170":170}],140:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shouldUpdateReactComponent
* @typechecks static-only
*/
'use strict';
/**
* Given a `prevElement` and `nextElement`, determines if the existing
* instance should be updated as opposed to being destroyed or replaced by a new
* instance. Both arguments are elements. This ensures that this logic can
* operate on stateless trees without any backing instance.
*
* @param {?object} prevElement
* @param {?object} nextElement
* @return {boolean} True if the existing instance should be updated.
* @protected
*/
function shouldUpdateReactComponent(prevElement, nextElement) {
var prevEmpty = prevElement === null || prevElement === false;
var nextEmpty = nextElement === null || nextElement === false;
if (prevEmpty || nextEmpty) {
return prevEmpty === nextEmpty;
}
var prevType = typeof prevElement;
var nextType = typeof nextElement;
if (prevType === 'string' || prevType === 'number') {
return nextType === 'string' || nextType === 'number';
} else {
return nextType === 'object' && prevElement.type === nextElement.type && prevElement.key === nextElement.key;
}
return false;
}
module.exports = shouldUpdateReactComponent;
},{}],141:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule traverseAllChildren
*/
'use strict';
var ReactCurrentOwner = _dereq_(39);
var ReactElement = _dereq_(57);
var ReactInstanceHandles = _dereq_(67);
var getIteratorFn = _dereq_(128);
var invariant = _dereq_(160);
var warning = _dereq_(172);
var SEPARATOR = ReactInstanceHandles.SEPARATOR;
var SUBSEPARATOR = ':';
/**
* TODO: Test that a single child and an array with one item have the same key
* pattern.
*/
var userProvidedKeyEscaperLookup = {
'=': '=0',
'.': '=1',
':': '=2'
};
var userProvidedKeyEscapeRegex = /[=.:]/g;
var didWarnAboutMaps = false;
function userProvidedKeyEscaper(match) {
return userProvidedKeyEscaperLookup[match];
}
/**
* Generate a key string that identifies a component within a set.
*
* @param {*} component A component that could contain a manual key.
* @param {number} index Index that is used if a manual key is not provided.
* @return {string}
*/
function getComponentKey(component, index) {
if (component && component.key != null) {
// Explicit key
return wrapUserProvidedKey(component.key);
}
// Implicit key determined by the index in the set
return index.toString(36);
}
/**
* Escape a component key so that it is safe to use in a reactid.
*
* @param {*} text Component key to be escaped.
* @return {string} An escaped string.
*/
function escapeUserProvidedKey(text) {
return ('' + text).replace(userProvidedKeyEscapeRegex, userProvidedKeyEscaper);
}
/**
* Wrap a `key` value explicitly provided by the user to distinguish it from
* implicitly-generated keys generated by a component's index in its parent.
*
* @param {string} key Value of a user-provided `key` attribute
* @return {string}
*/
function wrapUserProvidedKey(key) {
return '$' + escapeUserProvidedKey(key);
}
/**
* @param {?*} children Children tree container.
* @param {!string} nameSoFar Name of the key path so far.
* @param {!function} callback Callback to invoke with each child found.
* @param {?*} traverseContext Used to pass information throughout the traversal
* process.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildrenImpl(children, nameSoFar, callback, traverseContext) {
var type = typeof children;
if (type === 'undefined' || type === 'boolean') {
// All of the above are perceived as null.
children = null;
}
if (children === null || type === 'string' || type === 'number' || ReactElement.isValidElement(children)) {
callback(traverseContext, children,
// If it's the only child, treat the name as if it was wrapped in an array
// so that it's consistent if the number of children grows.
nameSoFar === '' ? SEPARATOR + getComponentKey(children, 0) : nameSoFar);
return 1;
}
var child;
var nextName;
var subtreeCount = 0; // Count of children found in the current subtree.
var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
if (Array.isArray(children)) {
for (var i = 0; i < children.length; i++) {
child = children[i];
nextName = nextNamePrefix + getComponentKey(child, i);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
var iteratorFn = getIteratorFn(children);
if (iteratorFn) {
var iterator = iteratorFn.call(children);
var step;
if (iteratorFn !== children.entries) {
var ii = 0;
while (!(step = iterator.next()).done) {
child = step.value;
nextName = nextNamePrefix + getComponentKey(child, ii++);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
} else {
if ("development" !== 'production') {
"development" !== 'production' ? warning(didWarnAboutMaps, 'Using Maps as children is not yet fully supported. It is an ' + 'experimental feature that might be removed. Convert it to a ' + 'sequence / iterable of keyed ReactElements instead.') : undefined;
didWarnAboutMaps = true;
}
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
child = entry[1];
nextName = nextNamePrefix + wrapUserProvidedKey(entry[0]) + SUBSEPARATOR + getComponentKey(child, 0);
subtreeCount += traverseAllChildrenImpl(child, nextName, callback, traverseContext);
}
}
}
} else if (type === 'object') {
var addendum = '';
if ("development" !== 'production') {
addendum = ' If you meant to render a collection of children, use an array ' + 'instead or wrap the object using createFragment(object) from the ' + 'React add-ons.';
if (children._isReactElement) {
addendum = ' It looks like you\'re using an element created by a different ' + 'version of React. Make sure to use only one copy of React.';
}
if (ReactCurrentOwner.current) {
var name = ReactCurrentOwner.current.getName();
if (name) {
addendum += ' Check the render method of `' + name + '`.';
}
}
}
var childrenString = String(children);
!false ? "development" !== 'production' ? invariant(false, 'Objects are not valid as a React child (found: %s).%s', childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString, addendum) : invariant(false) : undefined;
}
}
return subtreeCount;
}
/**
* Traverses children that are typically specified as `props.children`, but
* might also be specified through attributes:
*
* - `traverseAllChildren(this.props.children, ...)`
* - `traverseAllChildren(this.props.leftPanelChildren, ...)`
*
* The `traverseContext` is an optional argument that is passed through the
* entire traversal. It can be used to store accumulations or anything else that
* the callback might find relevant.
*
* @param {?*} children Children tree object.
* @param {!function} callback To invoke upon traversing each child.
* @param {?*} traverseContext Context for traversal.
* @return {!number} The number of children in this subtree.
*/
function traverseAllChildren(children, callback, traverseContext) {
if (children == null) {
return 0;
}
return traverseAllChildrenImpl(children, '', callback, traverseContext);
}
module.exports = traverseAllChildren;
},{"128":128,"160":160,"172":172,"39":39,"57":57,"67":67}],142:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule update
*/
/* global hasOwnProperty:true */
'use strict';
var assign = _dereq_(24);
var keyOf = _dereq_(165);
var invariant = _dereq_(160);
var hasOwnProperty = ({}).hasOwnProperty;
function shallowCopy(x) {
if (Array.isArray(x)) {
return x.concat();
} else if (x && typeof x === 'object') {
return assign(new x.constructor(), x);
} else {
return x;
}
}
var COMMAND_PUSH = keyOf({ $push: null });
var COMMAND_UNSHIFT = keyOf({ $unshift: null });
var COMMAND_SPLICE = keyOf({ $splice: null });
var COMMAND_SET = keyOf({ $set: null });
var COMMAND_MERGE = keyOf({ $merge: null });
var COMMAND_APPLY = keyOf({ $apply: null });
var ALL_COMMANDS_LIST = [COMMAND_PUSH, COMMAND_UNSHIFT, COMMAND_SPLICE, COMMAND_SET, COMMAND_MERGE, COMMAND_APPLY];
var ALL_COMMANDS_SET = {};
ALL_COMMANDS_LIST.forEach(function (command) {
ALL_COMMANDS_SET[command] = true;
});
function invariantArrayCase(value, spec, command) {
!Array.isArray(value) ? "development" !== 'production' ? invariant(false, 'update(): expected target of %s to be an array; got %s.', command, value) : invariant(false) : undefined;
var specValue = spec[command];
!Array.isArray(specValue) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array; got %s. ' + 'Did you forget to wrap your parameter in an array?', command, specValue) : invariant(false) : undefined;
}
function update(value, spec) {
!(typeof spec === 'object') ? "development" !== 'production' ? invariant(false, 'update(): You provided a key path to update() that did not contain one ' + 'of %s. Did you forget to include {%s: ...}?', ALL_COMMANDS_LIST.join(', '), COMMAND_SET) : invariant(false) : undefined;
if (hasOwnProperty.call(spec, COMMAND_SET)) {
!(Object.keys(spec).length === 1) ? "development" !== 'production' ? invariant(false, 'Cannot have more than one key in an object with %s', COMMAND_SET) : invariant(false) : undefined;
return spec[COMMAND_SET];
}
var nextValue = shallowCopy(value);
if (hasOwnProperty.call(spec, COMMAND_MERGE)) {
var mergeObj = spec[COMMAND_MERGE];
!(mergeObj && typeof mergeObj === 'object') ? "development" !== 'production' ? invariant(false, 'update(): %s expects a spec of type \'object\'; got %s', COMMAND_MERGE, mergeObj) : invariant(false) : undefined;
!(nextValue && typeof nextValue === 'object') ? "development" !== 'production' ? invariant(false, 'update(): %s expects a target of type \'object\'; got %s', COMMAND_MERGE, nextValue) : invariant(false) : undefined;
assign(nextValue, spec[COMMAND_MERGE]);
}
if (hasOwnProperty.call(spec, COMMAND_PUSH)) {
invariantArrayCase(value, spec, COMMAND_PUSH);
spec[COMMAND_PUSH].forEach(function (item) {
nextValue.push(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_UNSHIFT)) {
invariantArrayCase(value, spec, COMMAND_UNSHIFT);
spec[COMMAND_UNSHIFT].forEach(function (item) {
nextValue.unshift(item);
});
}
if (hasOwnProperty.call(spec, COMMAND_SPLICE)) {
!Array.isArray(value) ? "development" !== 'production' ? invariant(false, 'Expected %s target to be an array; got %s', COMMAND_SPLICE, value) : invariant(false) : undefined;
!Array.isArray(spec[COMMAND_SPLICE]) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
spec[COMMAND_SPLICE].forEach(function (args) {
!Array.isArray(args) ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be an array of arrays; got %s. ' + 'Did you forget to wrap your parameters in an array?', COMMAND_SPLICE, spec[COMMAND_SPLICE]) : invariant(false) : undefined;
nextValue.splice.apply(nextValue, args);
});
}
if (hasOwnProperty.call(spec, COMMAND_APPLY)) {
!(typeof spec[COMMAND_APPLY] === 'function') ? "development" !== 'production' ? invariant(false, 'update(): expected spec of %s to be a function; got %s.', COMMAND_APPLY, spec[COMMAND_APPLY]) : invariant(false) : undefined;
nextValue = spec[COMMAND_APPLY](nextValue);
}
for (var k in spec) {
if (!(ALL_COMMANDS_SET.hasOwnProperty(k) && ALL_COMMANDS_SET[k])) {
nextValue[k] = update(value[k], spec[k]);
}
}
return nextValue;
}
module.exports = update;
},{"160":160,"165":165,"24":24}],143:[function(_dereq_,module,exports){
/**
* Copyright 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule validateDOMNesting
*/
'use strict';
var assign = _dereq_(24);
var emptyFunction = _dereq_(152);
var warning = _dereq_(172);
var validateDOMNesting = emptyFunction;
if ("development" !== 'production') {
// This validation code was written based on the HTML5 parsing spec:
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
//
// Note: this does not catch all invalid nesting, nor does it try to (as it's
// not clear what practical benefit doing so provides); instead, we warn only
// for cases where the parser will give a parse tree differing from what React
// intended. For example, <b><div></div></b> is invalid but we don't warn
// because it still parses correctly; we do warn for other cases like nested
// <p> tags where the beginning of the second element implicitly closes the
// first, causing a confusing mess.
// https://html.spec.whatwg.org/multipage/syntax.html#special
var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp'];
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope
var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template',
// https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point
// TODO: Distinguish by namespace here -- for <title>, including it here
// errs on the side of fewer warnings
'foreignObject', 'desc', 'title'];
// https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope
var buttonScopeTags = inScopeTags.concat(['button']);
// https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags
var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt'];
var emptyAncestorInfo = {
parentTag: null,
formTag: null,
aTagInScope: null,
buttonTagInScope: null,
nobrTagInScope: null,
pTagInButtonScope: null,
listItemTagAutoclosing: null,
dlItemTagAutoclosing: null
};
var updatedAncestorInfo = function (oldInfo, tag, instance) {
var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo);
var info = { tag: tag, instance: instance };
if (inScopeTags.indexOf(tag) !== -1) {
ancestorInfo.aTagInScope = null;
ancestorInfo.buttonTagInScope = null;
ancestorInfo.nobrTagInScope = null;
}
if (buttonScopeTags.indexOf(tag) !== -1) {
ancestorInfo.pTagInButtonScope = null;
}
// See rules for 'li', 'dd', 'dt' start tags in
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') {
ancestorInfo.listItemTagAutoclosing = null;
ancestorInfo.dlItemTagAutoclosing = null;
}
ancestorInfo.parentTag = info;
if (tag === 'form') {
ancestorInfo.formTag = info;
}
if (tag === 'a') {
ancestorInfo.aTagInScope = info;
}
if (tag === 'button') {
ancestorInfo.buttonTagInScope = info;
}
if (tag === 'nobr') {
ancestorInfo.nobrTagInScope = info;
}
if (tag === 'p') {
ancestorInfo.pTagInButtonScope = info;
}
if (tag === 'li') {
ancestorInfo.listItemTagAutoclosing = info;
}
if (tag === 'dd' || tag === 'dt') {
ancestorInfo.dlItemTagAutoclosing = info;
}
return ancestorInfo;
};
/**
* Returns whether
*/
var isTagValidWithParent = function (tag, parentTag) {
// First, let's check if we're in an unusual parsing mode...
switch (parentTag) {
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect
case 'select':
return tag === 'option' || tag === 'optgroup' || tag === '#text';
case 'optgroup':
return tag === 'option' || tag === '#text';
// Strictly speaking, seeing an <option> doesn't mean we're in a <select>
// but
case 'option':
return tag === '#text';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption
// No special behavior since these rules fall back to "in body" mode for
// all except special table nodes which cause bad parsing behavior anyway.
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr
case 'tr':
return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody
case 'tbody':
case 'thead':
case 'tfoot':
return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup
case 'colgroup':
return tag === 'col' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable
case 'table':
return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead
case 'head':
return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template';
// https://html.spec.whatwg.org/multipage/semantics.html#the-html-element
case 'html':
return tag === 'head' || tag === 'body';
}
// Probably in the "in body" parsing mode, so we outlaw only tag combos
// where the parsing rules cause implicit opens or closes to be added.
// https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody
switch (tag) {
case 'h1':
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6';
case 'rp':
case 'rt':
return impliedEndTags.indexOf(parentTag) === -1;
case 'caption':
case 'col':
case 'colgroup':
case 'frame':
case 'head':
case 'tbody':
case 'td':
case 'tfoot':
case 'th':
case 'thead':
case 'tr':
// These tags are only valid with a few parents that have special child
// parsing rules -- if we're down here, then none of those matched and
// so we allow it only if we don't know what the parent is, as all other
// cases are invalid.
return parentTag == null;
}
return true;
};
/**
* Returns whether
*/
var findInvalidAncestorForTag = function (tag, ancestorInfo) {
switch (tag) {
case 'address':
case 'article':
case 'aside':
case 'blockquote':
case 'center':
case 'details':
case 'dialog':
case 'dir':
case 'div':
case 'dl':
case 'fieldset':
case 'figcaption':
case 'figure':
case 'footer':
case 'header':
case 'hgroup':
case 'main':
case 'menu':
case 'nav':
case 'ol':
case 'p':
case 'section':
case 'summary':
case 'ul':
case 'pre':
case 'listing':
case 'table':
case 'hr':
case 'xmp':
case 'h1':
case 'h2':
case 'h3':
case 'h4':
case 'h5':
case 'h6':
return ancestorInfo.pTagInButtonScope;
case 'form':
return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope;
case 'li':
return ancestorInfo.listItemTagAutoclosing;
case 'dd':
case 'dt':
return ancestorInfo.dlItemTagAutoclosing;
case 'button':
return ancestorInfo.buttonTagInScope;
case 'a':
// Spec says something about storing a list of markers, but it sounds
// equivalent to this check.
return ancestorInfo.aTagInScope;
case 'nobr':
return ancestorInfo.nobrTagInScope;
}
return null;
};
/**
* Given a ReactCompositeComponent instance, return a list of its recursive
* owners, starting at the root and ending with the instance itself.
*/
var findOwnerStack = function (instance) {
if (!instance) {
return [];
}
var stack = [];
/*eslint-disable space-after-keywords */
do {
/*eslint-enable space-after-keywords */
stack.push(instance);
} while (instance = instance._currentElement._owner);
stack.reverse();
return stack;
};
var didWarn = {};
validateDOMNesting = function (childTag, childInstance, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
var parentInfo = ancestorInfo.parentTag;
var parentTag = parentInfo && parentInfo.tag;
var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo;
var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo);
var problematic = invalidParent || invalidAncestor;
if (problematic) {
var ancestorTag = problematic.tag;
var ancestorInstance = problematic.instance;
var childOwner = childInstance && childInstance._currentElement._owner;
var ancestorOwner = ancestorInstance && ancestorInstance._currentElement._owner;
var childOwners = findOwnerStack(childOwner);
var ancestorOwners = findOwnerStack(ancestorOwner);
var minStackLen = Math.min(childOwners.length, ancestorOwners.length);
var i;
var deepestCommon = -1;
for (i = 0; i < minStackLen; i++) {
if (childOwners[i] === ancestorOwners[i]) {
deepestCommon = i;
} else {
break;
}
}
var UNKNOWN = '(unknown)';
var childOwnerNames = childOwners.slice(deepestCommon + 1).map(function (inst) {
return inst.getName() || UNKNOWN;
});
var ancestorOwnerNames = ancestorOwners.slice(deepestCommon + 1).map(function (inst) {
return inst.getName() || UNKNOWN;
});
var ownerInfo = [].concat(
// If the parent and child instances have a common owner ancestor, start
// with that -- otherwise we just start with the parent's owners.
deepestCommon !== -1 ? childOwners[deepestCommon].getName() || UNKNOWN : [], ancestorOwnerNames, ancestorTag,
// If we're warning about an invalid (non-parent) ancestry, add '...'
invalidAncestor ? ['...'] : [], childOwnerNames, childTag).join(' > ');
var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag + '|' + ownerInfo;
if (didWarn[warnKey]) {
return;
}
didWarn[warnKey] = true;
if (invalidParent) {
var info = '';
if (ancestorTag === 'table' && childTag === 'tr') {
info += ' Add a <tbody> to your code to match the DOM tree generated by ' + 'the browser.';
}
"development" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a child of <%s>. ' + 'See %s.%s', childTag, ancestorTag, ownerInfo, info) : undefined;
} else {
"development" !== 'production' ? warning(false, 'validateDOMNesting(...): <%s> cannot appear as a descendant of ' + '<%s>. See %s.', childTag, ancestorTag, ownerInfo) : undefined;
}
}
};
validateDOMNesting.ancestorInfoContextKey = '__validateDOMNesting_ancestorInfo$' + Math.random().toString(36).slice(2);
validateDOMNesting.updatedAncestorInfo = updatedAncestorInfo;
// For testing
validateDOMNesting.isTagValidInContext = function (tag, ancestorInfo) {
ancestorInfo = ancestorInfo || emptyAncestorInfo;
var parentInfo = ancestorInfo.parentTag;
var parentTag = parentInfo && parentInfo.tag;
return isTagValidWithParent(tag, parentTag) && !findInvalidAncestorForTag(tag, ancestorInfo);
};
}
module.exports = validateDOMNesting;
},{"152":152,"172":172,"24":24}],144:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule CSSCore
* @typechecks
*/
'use strict';
var invariant = _dereq_(160);
/**
* The CSSCore module specifies the API (and implements most of the methods)
* that should be used when dealing with the display of elements (via their
* CSS classes and visibility on screen. It is an API focused on mutating the
* display and not reading it as no logical state should be encoded in the
* display of elements.
*/
var CSSCore = {
/**
* Adds the class passed in to the element if it doesn't already have it.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
addClass: function (element, className) {
!!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSSCore.addClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
if (className) {
if (element.classList) {
element.classList.add(className);
} else if (!CSSCore.hasClass(element, className)) {
element.className = element.className + ' ' + className;
}
}
return element;
},
/**
* Removes the class passed in from the element
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @return {DOMElement} the element passed in
*/
removeClass: function (element, className) {
!!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSSCore.removeClass takes only a single class name. "%s" contains ' + 'multiple classes.', className) : invariant(false) : undefined;
if (className) {
if (element.classList) {
element.classList.remove(className);
} else if (CSSCore.hasClass(element, className)) {
element.className = element.className.replace(new RegExp('(^|\\s)' + className + '(?:\\s|$)', 'g'), '$1').replace(/\s+/g, ' ') // multiple spaces to one
.replace(/^\s*|\s*$/g, ''); // trim the ends
}
}
return element;
},
/**
* Helper to add or remove a class from an element based on a condition.
*
* @param {DOMElement} element the element to set the class on
* @param {string} className the CSS className
* @param {*} bool condition to whether to add or remove the class
* @return {DOMElement} the element passed in
*/
conditionClass: function (element, className, bool) {
return (bool ? CSSCore.addClass : CSSCore.removeClass)(element, className);
},
/**
* Tests whether the element has the class specified.
*
* @param {DOMNode|DOMWindow} element the element to set the class on
* @param {string} className the CSS className
* @return {boolean} true if the element has the class, false if not
*/
hasClass: function (element, className) {
!!/\s/.test(className) ? "development" !== 'production' ? invariant(false, 'CSS.hasClass takes only a single class name.') : invariant(false) : undefined;
if (element.classList) {
return !!className && element.classList.contains(className);
}
return (' ' + element.className + ' ').indexOf(' ' + className + ' ') > -1;
}
};
module.exports = CSSCore;
},{"160":160}],145:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
*
* 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.
*
* @providesModule EventListener
* @typechecks
*/
'use strict';
var emptyFunction = _dereq_(152);
/**
* Upstream version of event listener. Does not take into account specific
* nature of platform.
*/
var EventListener = {
/**
* Listen to DOM events during the bubble phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
listen: function (target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, false);
return {
remove: function () {
target.removeEventListener(eventType, callback, false);
}
};
} else if (target.attachEvent) {
target.attachEvent('on' + eventType, callback);
return {
remove: function () {
target.detachEvent('on' + eventType, callback);
}
};
}
},
/**
* Listen to DOM events during the capture phase.
*
* @param {DOMEventTarget} target DOM element to register listener on.
* @param {string} eventType Event type, e.g. 'click' or 'mouseover'.
* @param {function} callback Callback function.
* @return {object} Object with a `remove` method.
*/
capture: function (target, eventType, callback) {
if (target.addEventListener) {
target.addEventListener(eventType, callback, true);
return {
remove: function () {
target.removeEventListener(eventType, callback, true);
}
};
} else {
if ("development" !== 'production') {
console.error('Attempted to listen to events during the capture phase on a ' + 'browser that does not support the capture phase. Your application ' + 'will not receive some events.');
}
return {
remove: emptyFunction
};
}
},
registerDefault: function () {}
};
module.exports = EventListener;
},{"152":152}],146:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ExecutionEnvironment
*/
'use strict';
var canUseDOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
/**
* Simple, lightweight module assisting with the detection and context of
* Worker. Helps avoid circular dependencies and allows code to reason about
* whether or not they are in a Worker, even if they never include the main
* `ReactWorker` dependency.
*/
var ExecutionEnvironment = {
canUseDOM: canUseDOM,
canUseWorkers: typeof Worker !== 'undefined',
canUseEventListeners: canUseDOM && !!(window.addEventListener || window.attachEvent),
canUseViewport: canUseDOM && !!window.screen,
isInWorker: !canUseDOM // For now, this is true - might change in the future.
};
module.exports = ExecutionEnvironment;
},{}],147:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule camelize
* @typechecks
*/
"use strict";
var _hyphenPattern = /-(.)/g;
/**
* Camelcases a hyphenated string, for example:
*
* > camelize('background-color')
* < "backgroundColor"
*
* @param {string} string
* @return {string}
*/
function camelize(string) {
return string.replace(_hyphenPattern, function (_, character) {
return character.toUpperCase();
});
}
module.exports = camelize;
},{}],148:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule camelizeStyleName
* @typechecks
*/
'use strict';
var camelize = _dereq_(147);
var msPattern = /^-ms-/;
/**
* Camelcases a hyphenated CSS property name, for example:
*
* > camelizeStyleName('background-color')
* < "backgroundColor"
* > camelizeStyleName('-moz-transition')
* < "MozTransition"
* > camelizeStyleName('-ms-transition')
* < "msTransition"
*
* As Andi Smith suggests
* (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix
* is converted to lowercase `ms`.
*
* @param {string} string
* @return {string}
*/
function camelizeStyleName(string) {
return camelize(string.replace(msPattern, 'ms-'));
}
module.exports = camelizeStyleName;
},{"147":147}],149:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule containsNode
* @typechecks
*/
'use strict';
var isTextNode = _dereq_(162);
/*eslint-disable no-bitwise */
/**
* Checks if a given DOM node contains or is another DOM node.
*
* @param {?DOMNode} outerNode Outer DOM node.
* @param {?DOMNode} innerNode Inner DOM node.
* @return {boolean} True if `outerNode` contains or is `innerNode`.
*/
function containsNode(_x, _x2) {
var _again = true;
_function: while (_again) {
var outerNode = _x,
innerNode = _x2;
_again = false;
if (!outerNode || !innerNode) {
return false;
} else if (outerNode === innerNode) {
return true;
} else if (isTextNode(outerNode)) {
return false;
} else if (isTextNode(innerNode)) {
_x = outerNode;
_x2 = innerNode.parentNode;
_again = true;
continue _function;
} else if (outerNode.contains) {
return outerNode.contains(innerNode);
} else if (outerNode.compareDocumentPosition) {
return !!(outerNode.compareDocumentPosition(innerNode) & 16);
} else {
return false;
}
}
}
module.exports = containsNode;
},{"162":162}],150:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule createArrayFromMixed
* @typechecks
*/
'use strict';
var toArray = _dereq_(171);
/**
* Perform a heuristic test to determine if an object is "array-like".
*
* A monk asked Joshu, a Zen master, "Has a dog Buddha nature?"
* Joshu replied: "Mu."
*
* This function determines if its argument has "array nature": it returns
* true if the argument is an actual array, an `arguments' object, or an
* HTMLCollection (e.g. node.childNodes or node.getElementsByTagName()).
*
* It will return false for other array-like objects like Filelist.
*
* @param {*} obj
* @return {boolean}
*/
function hasArrayNature(obj) {
return(
// not null/false
!!obj && (
// arrays are objects, NodeLists are functions in Safari
typeof obj == 'object' || typeof obj == 'function') &&
// quacks like an array
'length' in obj &&
// not window
!('setInterval' in obj) &&
// no DOM node should be considered an array-like
// a 'select' element has 'length' and 'item' properties on IE8
typeof obj.nodeType != 'number' && (
// a real array
Array.isArray(obj) ||
// arguments
'callee' in obj ||
// HTMLCollection/NodeList
'item' in obj)
);
}
/**
* Ensure that the argument is an array by wrapping it in an array if it is not.
* Creates a copy of the argument if it is already an array.
*
* This is mostly useful idiomatically:
*
* var createArrayFromMixed = require('createArrayFromMixed');
*
* function takesOneOrMoreThings(things) {
* things = createArrayFromMixed(things);
* ...
* }
*
* This allows you to treat `things' as an array, but accept scalars in the API.
*
* If you need to convert an array-like object, like `arguments`, into an array
* use toArray instead.
*
* @param {*} obj
* @return {array}
*/
function createArrayFromMixed(obj) {
if (!hasArrayNature(obj)) {
return [obj];
} else if (Array.isArray(obj)) {
return obj.slice();
} else {
return toArray(obj);
}
}
module.exports = createArrayFromMixed;
},{"171":171}],151:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule createNodesFromMarkup
* @typechecks
*/
/*eslint-disable fb-www/unsafe-html*/
'use strict';
var ExecutionEnvironment = _dereq_(146);
var createArrayFromMixed = _dereq_(150);
var getMarkupWrap = _dereq_(156);
var invariant = _dereq_(160);
/**
* Dummy container used to render all markup.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Pattern used by `getNodeName`.
*/
var nodeNamePattern = /^\s*<(\w+)/;
/**
* Extracts the `nodeName` of the first element in a string of markup.
*
* @param {string} markup String of markup.
* @return {?string} Node name of the supplied markup.
*/
function getNodeName(markup) {
var nodeNameMatch = markup.match(nodeNamePattern);
return nodeNameMatch && nodeNameMatch[1].toLowerCase();
}
/**
* Creates an array containing the nodes rendered from the supplied markup. The
* optionally supplied `handleScript` function will be invoked once for each
* <script> element that is rendered. If no `handleScript` function is supplied,
* an exception is thrown if any <script> elements are rendered.
*
* @param {string} markup A string of valid HTML markup.
* @param {?function} handleScript Invoked once for each rendered <script>.
* @return {array<DOMElement|DOMTextNode>} An array of rendered nodes.
*/
function createNodesFromMarkup(markup, handleScript) {
var node = dummyNode;
!!!dummyNode ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup dummy not initialized') : invariant(false) : undefined;
var nodeName = getNodeName(markup);
var wrap = nodeName && getMarkupWrap(nodeName);
if (wrap) {
node.innerHTML = wrap[1] + markup + wrap[2];
var wrapDepth = wrap[0];
while (wrapDepth--) {
node = node.lastChild;
}
} else {
node.innerHTML = markup;
}
var scripts = node.getElementsByTagName('script');
if (scripts.length) {
!handleScript ? "development" !== 'production' ? invariant(false, 'createNodesFromMarkup(...): Unexpected <script> element rendered.') : invariant(false) : undefined;
createArrayFromMixed(scripts).forEach(handleScript);
}
var nodes = createArrayFromMixed(node.childNodes);
while (node.lastChild) {
node.removeChild(node.lastChild);
}
return nodes;
}
module.exports = createNodesFromMarkup;
},{"146":146,"150":150,"156":156,"160":160}],152:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule emptyFunction
*/
"use strict";
function makeEmptyFunction(arg) {
return function () {
return arg;
};
}
/**
* This function accepts and discards inputs; it has no side effects. This is
* primarily useful idiomatically for overridable function endpoints which
* always need to be callable, since JS lacks a null-call idiom ala Cocoa.
*/
function emptyFunction() {}
emptyFunction.thatReturns = makeEmptyFunction;
emptyFunction.thatReturnsFalse = makeEmptyFunction(false);
emptyFunction.thatReturnsTrue = makeEmptyFunction(true);
emptyFunction.thatReturnsNull = makeEmptyFunction(null);
emptyFunction.thatReturnsThis = function () {
return this;
};
emptyFunction.thatReturnsArgument = function (arg) {
return arg;
};
module.exports = emptyFunction;
},{}],153:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule emptyObject
*/
'use strict';
var emptyObject = {};
if ("development" !== 'production') {
Object.freeze(emptyObject);
}
module.exports = emptyObject;
},{}],154:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule focusNode
*/
'use strict';
/**
* @param {DOMElement} node input/textarea to focus
*/
function focusNode(node) {
// IE8 can throw "Can't move focus to the control because it is invisible,
// not enabled, or of a type that does not accept the focus." for all kinds of
// reasons that are too expensive and fragile to test.
try {
node.focus();
} catch (e) {}
}
module.exports = focusNode;
},{}],155:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getActiveElement
* @typechecks
*/
/**
* Same as document.activeElement but wraps in a try-catch block. In IE it is
* not safe to call document.activeElement if there is nothing focused.
*
* The activeElement will be null only if the document or document body is not yet defined.
*/
'use strict';
function getActiveElement() /*?DOMElement*/{
if (typeof document === 'undefined') {
return null;
}
try {
return document.activeElement || document.body;
} catch (e) {
return document.body;
}
}
module.exports = getActiveElement;
},{}],156:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getMarkupWrap
*/
/*eslint-disable fb-www/unsafe-html */
'use strict';
var ExecutionEnvironment = _dereq_(146);
var invariant = _dereq_(160);
/**
* Dummy container used to detect which wraps are necessary.
*/
var dummyNode = ExecutionEnvironment.canUseDOM ? document.createElement('div') : null;
/**
* Some browsers cannot use `innerHTML` to render certain elements standalone,
* so we wrap them, render the wrapped nodes, then extract the desired node.
*
* In IE8, certain elements cannot render alone, so wrap all elements ('*').
*/
var shouldWrap = {};
var selectWrap = [1, '<select multiple="true">', '</select>'];
var tableWrap = [1, '<table>', '</table>'];
var trWrap = [3, '<table><tbody><tr>', '</tr></tbody></table>'];
var svgWrap = [1, '<svg xmlns="http://www.w3.org/2000/svg">', '</svg>'];
var markupWrap = {
'*': [1, '?<div>', '</div>'],
'area': [1, '<map>', '</map>'],
'col': [2, '<table><tbody></tbody><colgroup>', '</colgroup></table>'],
'legend': [1, '<fieldset>', '</fieldset>'],
'param': [1, '<object>', '</object>'],
'tr': [2, '<table><tbody>', '</tbody></table>'],
'optgroup': selectWrap,
'option': selectWrap,
'caption': tableWrap,
'colgroup': tableWrap,
'tbody': tableWrap,
'tfoot': tableWrap,
'thead': tableWrap,
'td': trWrap,
'th': trWrap
};
// Initialize the SVG elements since we know they'll always need to be wrapped
// consistently. If they are created inside a <div> they will be initialized in
// the wrong namespace (and will not display).
var svgElements = ['circle', 'clipPath', 'defs', 'ellipse', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'text', 'tspan'];
svgElements.forEach(function (nodeName) {
markupWrap[nodeName] = svgWrap;
shouldWrap[nodeName] = true;
});
/**
* Gets the markup wrap configuration for the supplied `nodeName`.
*
* NOTE: This lazily detects which wraps are necessary for the current browser.
*
* @param {string} nodeName Lowercase `nodeName`.
* @return {?array} Markup wrap configuration, if applicable.
*/
function getMarkupWrap(nodeName) {
!!!dummyNode ? "development" !== 'production' ? invariant(false, 'Markup wrapping node not initialized') : invariant(false) : undefined;
if (!markupWrap.hasOwnProperty(nodeName)) {
nodeName = '*';
}
if (!shouldWrap.hasOwnProperty(nodeName)) {
if (nodeName === '*') {
dummyNode.innerHTML = '<link />';
} else {
dummyNode.innerHTML = '<' + nodeName + '></' + nodeName + '>';
}
shouldWrap[nodeName] = !dummyNode.firstChild;
}
return shouldWrap[nodeName] ? markupWrap[nodeName] : null;
}
module.exports = getMarkupWrap;
},{"146":146,"160":160}],157:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule getUnboundedScrollPosition
* @typechecks
*/
'use strict';
/**
* Gets the scroll position of the supplied element or window.
*
* The return values are unbounded, unlike `getScrollPosition`. This means they
* may be negative or exceed the element boundaries (which is possible using
* inertial scrolling).
*
* @param {DOMWindow|DOMElement} scrollable
* @return {object} Map with `x` and `y` keys.
*/
function getUnboundedScrollPosition(scrollable) {
if (scrollable === window) {
return {
x: window.pageXOffset || document.documentElement.scrollLeft,
y: window.pageYOffset || document.documentElement.scrollTop
};
}
return {
x: scrollable.scrollLeft,
y: scrollable.scrollTop
};
}
module.exports = getUnboundedScrollPosition;
},{}],158:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule hyphenate
* @typechecks
*/
'use strict';
var _uppercasePattern = /([A-Z])/g;
/**
* Hyphenates a camelcased string, for example:
*
* > hyphenate('backgroundColor')
* < "background-color"
*
* For CSS style names, use `hyphenateStyleName` instead which works properly
* with all vendor prefixes, including `ms`.
*
* @param {string} string
* @return {string}
*/
function hyphenate(string) {
return string.replace(_uppercasePattern, '-$1').toLowerCase();
}
module.exports = hyphenate;
},{}],159:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule hyphenateStyleName
* @typechecks
*/
'use strict';
var hyphenate = _dereq_(158);
var msPattern = /^ms-/;
/**
* Hyphenates a camelcased CSS property name, for example:
*
* > hyphenateStyleName('backgroundColor')
* < "background-color"
* > hyphenateStyleName('MozTransition')
* < "-moz-transition"
* > hyphenateStyleName('msTransition')
* < "-ms-transition"
*
* As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix
* is converted to `-ms-`.
*
* @param {string} string
* @return {string}
*/
function hyphenateStyleName(string) {
return hyphenate(string).replace(msPattern, '-ms-');
}
module.exports = hyphenateStyleName;
},{"158":158}],160:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule invariant
*/
'use strict';
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var invariant = function (condition, format, a, b, c, d, e, f) {
if ("development" !== 'production') {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
}
if (!condition) {
var error;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error('Invariant Violation: ' + format.replace(/%s/g, function () {
return args[argIndex++];
}));
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
};
module.exports = invariant;
},{}],161:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isNode
* @typechecks
*/
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM node.
*/
'use strict';
function isNode(object) {
return !!(object && (typeof Node === 'function' ? object instanceof Node : typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'));
}
module.exports = isNode;
},{}],162:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule isTextNode
* @typechecks
*/
'use strict';
var isNode = _dereq_(161);
/**
* @param {*} object The object to check.
* @return {boolean} Whether or not the object is a DOM text node.
*/
function isTextNode(object) {
return isNode(object) && object.nodeType == 3;
}
module.exports = isTextNode;
},{"161":161}],163:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule joinClasses
* @typechecks static-only
*/
'use strict';
/**
* Combines multiple className strings into one.
* http://jsperf.com/joinclasses-args-vs-array
*
* @param {...?string} className
* @return {string}
*/
function joinClasses(className /*, ... */) {
if (!className) {
className = '';
}
var nextClass;
var argLength = arguments.length;
if (argLength > 1) {
for (var ii = 1; ii < argLength; ii++) {
nextClass = arguments[ii];
if (nextClass) {
className = (className ? className + ' ' : '') + nextClass;
}
}
}
return className;
}
module.exports = joinClasses;
},{}],164:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule keyMirror
* @typechecks static-only
*/
'use strict';
var invariant = _dereq_(160);
/**
* Constructs an enumeration with keys equal to their value.
*
* For example:
*
* var COLORS = keyMirror({blue: null, red: null});
* var myColor = COLORS.blue;
* var isColorValid = !!COLORS[myColor];
*
* The last line could not be performed if the values of the generated enum were
* not equal to their keys.
*
* Input: {key1: val1, key2: val2}
* Output: {key1: key1, key2: key2}
*
* @param {object} obj
* @return {object}
*/
var keyMirror = function (obj) {
var ret = {};
var key;
!(obj instanceof Object && !Array.isArray(obj)) ? "development" !== 'production' ? invariant(false, 'keyMirror(...): Argument must be an object.') : invariant(false) : undefined;
for (key in obj) {
if (!obj.hasOwnProperty(key)) {
continue;
}
ret[key] = key;
}
return ret;
};
module.exports = keyMirror;
},{"160":160}],165:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule keyOf
*/
/**
* Allows extraction of a minified key. Let's the build system minify keys
* without losing the ability to dynamically use key strings as values
* themselves. Pass in an object with a single key/val pair and it will return
* you the string key of that single record. Suppose you want to grab the
* value for a key 'className' inside of an object. Key/val minification may
* have aliased that key to be 'xa12'. keyOf({className: null}) will return
* 'xa12' in that case. Resolve keys you want to use once at startup time, then
* reuse those resolutions.
*/
"use strict";
var keyOf = function (oneKeyObj) {
var key;
for (key in oneKeyObj) {
if (!oneKeyObj.hasOwnProperty(key)) {
continue;
}
return key;
}
return null;
};
module.exports = keyOf;
},{}],166:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule mapObject
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Executes the provided `callback` once for each enumerable own property in the
* object and constructs a new object from the results. The `callback` is
* invoked with three arguments:
*
* - the property value
* - the property name
* - the object being traversed
*
* Properties that are added after the call to `mapObject` will not be visited
* by `callback`. If the values of existing properties are changed, the value
* passed to `callback` will be the value at the time `mapObject` visits them.
* Properties that are deleted before being visited are not visited.
*
* @grep function objectMap()
* @grep function objMap()
*
* @param {?object} object
* @param {function} callback
* @param {*} context
* @return {?object}
*/
function mapObject(object, callback, context) {
if (!object) {
return null;
}
var result = {};
for (var name in object) {
if (hasOwnProperty.call(object, name)) {
result[name] = callback.call(context, object[name], name, object);
}
}
return result;
}
module.exports = mapObject;
},{}],167:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule memoizeStringOnly
* @typechecks static-only
*/
'use strict';
/**
* Memoizes the return value of a function that accepts one string argument.
*
* @param {function} callback
* @return {function}
*/
function memoizeStringOnly(callback) {
var cache = {};
return function (string) {
if (!cache.hasOwnProperty(string)) {
cache[string] = callback.call(this, string);
}
return cache[string];
};
}
module.exports = memoizeStringOnly;
},{}],168:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule performance
* @typechecks
*/
'use strict';
var ExecutionEnvironment = _dereq_(146);
var performance;
if (ExecutionEnvironment.canUseDOM) {
performance = window.performance || window.msPerformance || window.webkitPerformance;
}
module.exports = performance || {};
},{"146":146}],169:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule performanceNow
* @typechecks
*/
'use strict';
var performance = _dereq_(168);
var curPerformance = performance;
/**
* Detect if we can use `window.performance.now()` and gracefully fallback to
* `Date.now()` if it doesn't exist. We need to support Firefox < 15 for now
* because of Facebook's testing infrastructure.
*/
if (!curPerformance || !curPerformance.now) {
curPerformance = Date;
}
var performanceNow = curPerformance.now.bind(curPerformance);
module.exports = performanceNow;
},{"168":168}],170:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shallowEqual
* @typechecks
*
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
var bHasOwnProperty = hasOwnProperty.bind(objB);
for (var i = 0; i < keysA.length; i++) {
if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
},{}],171:[function(_dereq_,module,exports){
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule toArray
* @typechecks
*/
'use strict';
var invariant = _dereq_(160);
/**
* Convert array-like objects to arrays.
*
* This API assumes the caller knows the contents of the data type. For less
* well defined inputs use createArrayFromMixed.
*
* @param {object|function|filelist} obj
* @return {array}
*/
function toArray(obj) {
var length = obj.length;
// Some browse builtin objects can report typeof 'function' (e.g. NodeList in
// old versions of Safari).
!(!Array.isArray(obj) && (typeof obj === 'object' || typeof obj === 'function')) ? "development" !== 'production' ? invariant(false, 'toArray: Array-like object expected') : invariant(false) : undefined;
!(typeof length === 'number') ? "development" !== 'production' ? invariant(false, 'toArray: Object needs a length property') : invariant(false) : undefined;
!(length === 0 || length - 1 in obj) ? "development" !== 'production' ? invariant(false, 'toArray: Object should have keys for indices') : invariant(false) : undefined;
// Old IE doesn't give collections access to hasOwnProperty. Assume inputs
// without method will throw during the slice call and skip straight to the
// fallback.
if (obj.hasOwnProperty) {
try {
return Array.prototype.slice.call(obj);
} catch (e) {
// IE < 9 does not support Array#slice on collections objects
}
}
// Fall back to copying key by key. This assumes all keys have a value,
// so will not preserve sparsely populated inputs.
var ret = Array(length);
for (var ii = 0; ii < length; ii++) {
ret[ii] = obj[ii];
}
return ret;
}
module.exports = toArray;
},{"160":160}],172:[function(_dereq_,module,exports){
/**
* Copyright 2014-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule warning
*/
'use strict';
var emptyFunction = _dereq_(152);
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warning = emptyFunction;
if ("development" !== 'production') {
warning = function (condition, format) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
if (format === undefined) {
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (format.indexOf('Failed Composite propType: ') === 0) {
return; // Ignore CompositeComponent proptype check.
}
if (!condition) {
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
}
};
}
module.exports = warning;
},{"152":152}]},{},[1])(1)
});
|
js/src/ui/SectionList/sectionList.example.js
|
BSDStudios/parity
|
// Copyright 2015-2017 Parity Technologies (UK) Ltd.
// This file is part of Parity.
// Parity is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
import React, { Component } from 'react';
import PlaygroundExample from '~/playground/playgroundExample';
import SectionList from './';
const ITEM_STYLE = {
backgroundColor: 'rgba(0, 0, 0, 0.75)',
padding: '1em'
};
const items = [
{ name: 'Jack', desc: 'Item number 1' },
{ name: 'Paul', desc: 'Item number 2' },
{ name: 'Matt', desc: 'Item number 3' },
{ name: 'Titi', desc: 'Item number 4' }
];
export default class SectionListExample extends Component {
state = {
showOverlay: true
};
render () {
return (
<div>
<PlaygroundExample name='Simple Usage'>
{ this.renderSimple() }
</PlaygroundExample>
<PlaygroundExample name='With Overlay'>
{ this.renderWithOverlay() }
</PlaygroundExample>
</div>
);
}
renderSimple () {
return (
<SectionList
items={ items }
renderItem={ this.renderItem }
/>
);
}
renderWithOverlay () {
const { showOverlay } = this.state;
const overlay = (
<div>
<p>Overlay</p>
<button onClick={ this.hideOverlay }>hide</button>
</div>
);
return (
<SectionList
items={ items }
overlay={ showOverlay ? overlay : null }
renderItem={ this.renderItem }
/>
);
}
renderItem (item, index) {
const { desc, name } = item;
return (
<div style={ ITEM_STYLE }>
<h3>{ name }</h3>
<h3 data-hover='show'>{ desc }</h3>
</div>
);
}
hideOverlay = () => {
this.setState({ showOverlay: false });
}
}
|
server/frontend/src/index.js
|
cs472-spots/spots
|
// src/index.js
import React from 'react';
import ReactDOM from 'react-dom';
import { hashHistory } from 'react-router';
import { Provider } from 'nectarine';
// eslint-disable-next-line
import Store from './store/Store.js';
import Routes from './routes/index.js';
import './index.css';
//Renders the components passed by
ReactDOM.render(
<Provider store={Store}>
<Routes history={hashHistory} />
</Provider>,
document.getElementById('root')
);
|
ajax/libs/react-datepicker/0.23.0/react-datepicker.min.js
|
redmunds/cdnjs
|
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("moment"),require("react-dom"),require("react"),require("react-onclickoutside")):"function"==typeof define&&define.amd?define(["moment","react-dom","react","react-onclickoutside"],e):"object"==typeof exports?exports.DatePicker=e(require("moment"),require("react-dom"),require("react"),require("react-onclickoutside")):t.DatePicker=e(t.moment,t.ReactDOM,t.React,t.OnClickOutside)}(this,function(t,e,n,o){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}var r=n(1),i=o(r),a=n(7),s=o(a),l=n(4),d=o(l),p=n(14),u=o(p),f=n(6),h=d["default"].createClass({displayName:"DatePicker",propTypes:{selected:d["default"].PropTypes.object,locale:d["default"].PropTypes.string,dateFormatCalendar:d["default"].PropTypes.string,disabled:d["default"].PropTypes.bool,id:d["default"].PropTypes.string,popoverAttachment:d["default"].PropTypes.string,popoverTargetAttachment:d["default"].PropTypes.string,popoverTargetOffset:d["default"].PropTypes.string,tetherConstraints:d["default"].PropTypes.array,showYearDropdown:d["default"].PropTypes.bool,onChange:d["default"].PropTypes.func.isRequired,onBlur:d["default"].PropTypes.func,onFocus:d["default"].PropTypes.func,tabIndex:d["default"].PropTypes.number,filterDate:d["default"].PropTypes.func,todayButton:d["default"].PropTypes.string},getDefaultProps:function(){return{dateFormatCalendar:"MMMM YYYY",onChange:function(){},disabled:!1,onFocus:function(){},onBlur:function(){},popoverAttachment:"top left",popoverTargetAttachment:"bottom left",popoverTargetOffset:"10px 0",tetherConstraints:[{to:"window",attachment:"together"}]}},getInitialState:function(){return{open:!1}},setOpen:function(t){this.setState({open:t})},handleFocus:function(t){this.props.onFocus(t),this.setOpen(!0)},handleBlur:function(t){this.state.open?this.refs.input.focus():this.props.onBlur(t)},handleCalendarClickOutside:function(t){this.setOpen(!1)},handleSelect:function(t){this.setSelected(t),this.setOpen(!1)},setSelected:function(t){(0,f.isSameDay)(this.props.selected,t)||this.props.onChange(t)},onInputClick:function(){this.setOpen(!0)},handleInputDone:function(){this.setOpen(!1)},onClearClick:function(t){t.preventDefault(),this.props.onChange(null)},renderCalendar:function(){return!this.state.open||this.props.disabled?null:d["default"].createElement(s["default"],{ref:"calendar",locale:this.props.locale,dateFormat:this.props.dateFormatCalendar,selected:this.props.selected,onSelect:this.handleSelect,minDate:this.props.minDate,maxDate:this.props.maxDate,startDate:this.props.startDate,endDate:this.props.endDate,excludeDates:this.props.excludeDates,filterDate:this.props.filterDate,onClickOutside:this.handleCalendarClickOutside,includeDates:this.props.includeDates,showYearDropdown:this.props.showYearDropdown,todayButton:this.props.todayButton})},renderClearButton:function(){return this.props.isClearable&&null!=this.props.selected?d["default"].createElement("a",{className:"close-icon",href:"#",onClick:this.onClearClick}):null},render:function(){return d["default"].createElement(u["default"],{classPrefix:"datepicker__tether",attachment:this.props.popoverAttachment,targetAttachment:this.props.popoverTargetAttachment,targetOffset:this.props.popoverTargetOffset,constraints:this.props.tetherConstraints},d["default"].createElement("div",{className:"datepicker__input-container"},d["default"].createElement(i["default"],{ref:"input",id:this.props.id,name:this.props.name,date:this.props.selected,locale:this.props.locale,minDate:this.props.minDate,maxDate:this.props.maxDate,excludeDates:this.props.excludeDates,includeDates:this.props.includeDates,filterDate:this.props.filterDate,dateFormat:this.props.dateFormat,onFocus:this.handleFocus,onBlur:this.handleBlur,handleClick:this.onInputClick,handleDone:this.handleInputDone,setSelected:this.setSelected,placeholderText:this.props.placeholderText,disabled:this.props.disabled,className:this.props.className,title:this.props.title,readOnly:this.props.readOnly,required:this.props.required,tabIndex:this.props.tabIndex,open:this.state.open}),this.renderClearButton()),d["default"].createElement("div",null,this.renderCalendar()))}});t.exports=h},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}var r=n(2),i=o(r),a=n(3),s=(o(a),n(4)),l=o(s),d=n(5),p=o(d),u=n(6),f=l["default"].createClass({displayName:"DateInput",propTypes:{date:l["default"].PropTypes.object,locale:l["default"].PropTypes.string,minDate:l["default"].PropTypes.object,maxDate:l["default"].PropTypes.object,excludeDates:l["default"].PropTypes.array,includeDates:l["default"].PropTypes.array,filterDate:l["default"].PropTypes.func,open:l["default"].PropTypes.bool},getDefaultProps:function(){return{dateFormat:"YYYY-MM-DD"}},getInitialState:function(){return{maybeDate:this.safeDateFormat(this.props.date)}},componentWillReceiveProps:function(t){(0,u.isSameDay)(t.date,this.props.date)||this.setState({maybeDate:this.safeDateFormat(t.date)})},handleChange:function(t){var e=t.target.value,n=(0,i["default"])(e,this.props.dateFormat,!0);n.isValid()&&!(0,u.isDayDisabled)(n,this.props)?this.props.setSelected(n):""===e&&this.props.setSelected(null),this.setState({maybeDate:e})},safeDateFormat:function(t){return t&&t.clone().locale(this.props.locale||i["default"].locale()).format(this.props.dateFormat)},handleKeyDown:function(t){"Enter"===t.key||"Escape"===t.key?(t.preventDefault(),this.props.handleDone()):"Tab"===t.key&&this.props.handleDone()},handleClick:function(t){this.props.disabled||this.props.handleClick(t)},handleBlur:function(t){this.setState({maybeDate:this.safeDateFormat(this.props.date)}),this.props.onBlur&&this.props.onBlur(t)},focus:function(){this.refs.input.focus()},getClassNames:function(){return(0,p["default"])("datepicker__input",{"ignore-react-onclickoutside":this.props.open},this.props.className)},render:function(){return l["default"].createElement("input",{ref:"input",type:"text",id:this.props.id,name:this.props.name,value:this.state.maybeDate,onClick:this.handleClick,onKeyDown:this.handleKeyDown,onFocus:this.props.onFocus,onBlur:this.handleBlur,onChange:this.handleChange,className:this.getClassNames(),disabled:this.props.disabled,placeholder:this.props.placeholderText,readOnly:this.props.readOnly,required:this.props.required,tabIndex:this.props.tabIndex})}});t.exports=f},function(e,n){e.exports=t},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e,n){var o,r;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function n(){for(var t=[],e=0;e<arguments.length;e++){var o=arguments[e];if(o){var r=typeof o;if("string"===r||"number"===r)t.push(o);else if(Array.isArray(o))t.push(n.apply(null,o));else if("object"===r)for(var a in o)i.call(o,a)&&o[a]&&t.push(a)}}return t.join(" ")}var i={}.hasOwnProperty;"undefined"!=typeof t&&t.exports?t.exports=n:(o=[],r=function(){return n}.apply(e,o),!(void 0!==r&&(t.exports=r)))}()},function(t,e){"use strict";function n(t,e){return t&&e?t.isSame(e,"day"):!t&&!e}function o(t){var e=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=e.minDate,r=e.maxDate,i=e.excludeDates,a=e.includeDates,s=e.filterDate;return o&&t.isBefore(o,"day")||r&&t.isAfter(r,"day")||i&&i.some(function(e){return n(t,e)})||a&&!a.some(function(e){return n(t,e)})||s&&!s(t.clone())||!1}Object.defineProperty(e,"__esModule",{value:!0}),e.isSameDay=n,e.isDayDisabled=o},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}var r=n(2),i=o(r),a=n(8),s=o(a),l=n(11),d=o(l),p=n(4),u=o(p),f=n(6),h=u["default"].createClass({displayName:"Calendar",mixins:[n(10)],propTypes:{locale:u["default"].PropTypes.string,dateFormat:u["default"].PropTypes.string.isRequired,onSelect:u["default"].PropTypes.func.isRequired,onClickOutside:u["default"].PropTypes.func.isRequired,minDate:u["default"].PropTypes.object,maxDate:u["default"].PropTypes.object,startDate:u["default"].PropTypes.object,endDate:u["default"].PropTypes.object,excludeDates:u["default"].PropTypes.array,includeDates:u["default"].PropTypes.array,filterDate:u["default"].PropTypes.func,showYearDropdown:u["default"].PropTypes.bool},handleClickOutside:function(t){this.props.onClickOutside(t)},getInitialState:function(){return{date:this.localizeMoment(this.getDateInView())}},getDateInView:function(){var t=this.props,e=t.selected,n=t.minDate,o=t.maxDate,r=(0,i["default"])();return e?e:n&&n.isAfter(r)?n:o&&o.isBefore(r)?o:r},componentWillReceiveProps:function(t){t.selected&&!(0,f.isSameDay)(t.selected,this.props.selected)&&this.setState({date:this.localizeMoment(t.selected)})},localizeMoment:function(t){return t.clone().locale(this.props.locale||i["default"].locale())},increaseMonth:function(){this.setState({date:this.state.date.clone().add(1,"month")})},decreaseMonth:function(){this.setState({date:this.state.date.clone().subtract(1,"month")})},handleDayClick:function(t){this.props.onSelect(t)},changeYear:function(t){this.setState({date:this.state.date.clone().set("year",t)})},header:function(){var t=this.state.date.clone().startOf("week");return[0,1,2,3,4,5,6].map(function(e){var n=t.clone().add(e,"days");return u["default"].createElement("div",{key:e,className:"datepicker__day"},n.localeData().weekdaysMin(n))})},renderCurrentMonth:function(){var t=["datepicker__current-month"];return this.props.showYearDropdown&&t.push("datepicker__current-month--hasYearDropdown"),u["default"].createElement("div",{className:t.join(" ")},this.state.date.format(this.props.dateFormat))},renderYearDropdown:function(){return this.props.showYearDropdown?u["default"].createElement(s["default"],{onChange:this.changeYear,year:this.state.date.year()}):void 0},renderTodayButton:function(){var t=this;if(this.props.todayButton)return u["default"].createElement("div",{className:"datepicker__today-button",onClick:function(){return t.props.onSelect((0,i["default"])())}},this.props.todayButton)},render:function(){return u["default"].createElement("div",{className:"datepicker"},u["default"].createElement("div",{className:"datepicker__triangle"}),u["default"].createElement("div",{className:"datepicker__header"},u["default"].createElement("a",{className:"datepicker__navigation datepicker__navigation--previous",onClick:this.decreaseMonth}),this.renderCurrentMonth(),this.renderYearDropdown(),u["default"].createElement("a",{className:"datepicker__navigation datepicker__navigation--next",onClick:this.increaseMonth}),u["default"].createElement("div",null,this.header())),u["default"].createElement(d["default"],{day:this.state.date,onDayClick:this.handleDayClick,minDate:this.props.minDate,maxDate:this.props.maxDate,excludeDates:this.props.excludeDates,includeDates:this.props.includeDates,filterDate:this.props.filterDate,selected:this.props.selected,startDate:this.props.startDate,endDate:this.props.endDate}),this.renderTodayButton())}});t.exports=h},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}var r=n(4),i=o(r),a=n(9),s=o(a),l=i["default"].createClass({displayName:"YearDropdown",propTypes:{year:i["default"].PropTypes.number.isRequired,onChange:i["default"].PropTypes.func.isRequired},getInitialState:function(){return{dropdownVisible:!1}},renderReadView:function(){return i["default"].createElement("div",{className:"datepicker__year-read-view",onClick:this.toggleDropdown},i["default"].createElement("span",{className:"datepicker__year-read-view--selected-year"},this.props.year),i["default"].createElement("span",{className:"datepicker__year-read-view--down-arrow"}))},renderDropdown:function(){return i["default"].createElement(s["default"],{ref:"options",year:this.props.year,onChange:this.onChange,onCancel:this.toggleDropdown})},onChange:function(t){this.toggleDropdown(),t!==this.props.year&&this.props.onChange(t)},toggleDropdown:function(){this.setState({dropdownVisible:!this.state.dropdownVisible})},render:function(){return i["default"].createElement("div",null,this.state.dropdownVisible?this.renderDropdown():this.renderReadView())}});t.exports=l},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t){for(var e=[],n=0;5>n;n++)e.push(t-n);return e}var i=n(4),a=o(i),s=a["default"].createClass({displayName:"YearDropdownOptions",mixins:[n(10)],propTypes:{year:a["default"].PropTypes.number.isRequired,onChange:a["default"].PropTypes.func.isRequired,onCancel:a["default"].PropTypes.func.isRequired},getInitialState:function(){return{yearsList:r(this.props.year)}},render:function(){return a["default"].createElement("div",{className:"datepicker__year-dropdown"},this.renderOptions())},renderOptions:function(){var t=this,e=this.props.year,n=this.state.yearsList.map(function(n){return a["default"].createElement("div",{className:"datepicker__year-option",key:n,onClick:t.onChange.bind(t,n)},e===n?a["default"].createElement("span",{className:"datepicker__year-option--selected"},"✓"):"",n)});return n.unshift(a["default"].createElement("div",{className:"datepicker__year-option",ref:"upcoming",key:"upcoming",onClick:this.incrementYears},a["default"].createElement("a",{className:"datepicker__navigation datepicker__navigation--years datepicker__navigation--years-upcoming"}))),n.push(a["default"].createElement("div",{className:"datepicker__year-option",ref:"previous",key:"previous",onClick:this.decrementYears},a["default"].createElement("a",{className:"datepicker__navigation datepicker__navigation--years datepicker__navigation--years-previous"}))),n},onChange:function(t){this.props.onChange(t)},handleClickOutside:function(){this.props.onCancel()},shiftYears:function(t){var e=this.state.yearsList.map(function(e){return e+t});this.setState({yearsList:e})},incrementYears:function(){return this.shiftYears(1)},decrementYears:function(){return this.shiftYears(-1)}});t.exports=s},function(t,e){t.exports=o},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}var r=n(4),i=o(r),a=n(12),s=o(a),l=i["default"].createClass({displayName:"Month",propTypes:{day:i["default"].PropTypes.object.isRequired,onDayClick:i["default"].PropTypes.func,minDate:i["default"].PropTypes.object,maxDate:i["default"].PropTypes.object,excludeDates:i["default"].PropTypes.array,includeDates:i["default"].PropTypes.array,filterDate:i["default"].PropTypes.func,selected:i["default"].PropTypes.object,startDate:i["default"].PropTypes.object,endDate:i["default"].PropTypes.object},handleDayClick:function(t){this.props.onDayClick&&this.props.onDayClick(t)},isWeekInMonth:function(t){var e=this.props.day,n=t.clone().add(6,"days");return t.isSame(e,"month")||n.isSame(e,"month")},renderWeeks:function(){var t=this,e=this.props.day.clone().startOf("month").startOf("week");return[0,1,2,3,4,5].map(function(t){return e.clone().add(t,"weeks")}).filter(function(e){return t.isWeekInMonth(e)}).map(function(e,n){return i["default"].createElement(s["default"],{key:n,day:e,month:t.props.day.month(),onDayClick:t.handleDayClick,minDate:t.props.minDate,maxDate:t.props.maxDate,excludeDates:t.props.excludeDates,includeDates:t.props.includeDates,filterDate:t.props.filterDate,selected:t.props.selected,startDate:t.props.startDate,endDate:t.props.endDate})})},render:function(){return i["default"].createElement("div",{className:"datepicker__month"},this.renderWeeks())}});t.exports=l},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}var r=n(4),i=o(r),a=n(13),s=o(a),l=i["default"].createClass({displayName:"Week",propTypes:{day:i["default"].PropTypes.object.isRequired,month:i["default"].PropTypes.number,onDayClick:i["default"].PropTypes.func,minDate:i["default"].PropTypes.object,maxDate:i["default"].PropTypes.object,excludeDates:i["default"].PropTypes.array,includeDates:i["default"].PropTypes.array,filterDate:i["default"].PropTypes.func,selected:i["default"].PropTypes.object,startDate:i["default"].PropTypes.object,endDate:i["default"].PropTypes.object},handleDayClick:function(t){this.props.onDayClick&&this.props.onDayClick(t)},renderDays:function(){var t=this,e=this.props.day.clone().startOf("week");return[0,1,2,3,4,5,6].map(function(n){var o=e.clone().add(n,"days");return i["default"].createElement(s["default"],{key:n,day:o,month:t.props.month,onClick:t.handleDayClick.bind(t,o),minDate:t.props.minDate,maxDate:t.props.maxDate,excludeDates:t.props.excludeDates,includeDates:t.props.includeDates,filterDate:t.props.filterDate,selected:t.props.selected,startDate:t.props.startDate,endDate:t.props.endDate})})},render:function(){return i["default"].createElement("div",{className:"datepicker__week"},this.renderDays())}});t.exports=l},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}var r=n(2),i=o(r),a=n(4),s=o(a),l=n(5),d=o(l),p=n(6),u=s["default"].createClass({displayName:"Day",propTypes:{day:s["default"].PropTypes.object.isRequired,month:s["default"].PropTypes.number,onClick:s["default"].PropTypes.func,minDate:s["default"].PropTypes.object,maxDate:s["default"].PropTypes.object,excludeDates:s["default"].PropTypes.array,includeDates:s["default"].PropTypes.array,filterDate:s["default"].PropTypes.func,selected:s["default"].PropTypes.object,startDate:s["default"].PropTypes.object,endDate:s["default"].PropTypes.object},handleClick:function(t){!this.isDisabled()&&this.props.onClick&&this.props.onClick(t)},isSameDay:function(t){return(0,p.isSameDay)(this.props.day,t)},isDisabled:function(){return(0,p.isDayDisabled)(this.props.day,this.props)},isInRange:function(){var t=this.props,e=t.day,n=t.startDate,o=t.endDate;if(!n||!o)return!1;var r=n.clone().startOf("day").subtract(1,"seconds"),i=o.clone().startOf("day").add(1,"seconds");return e.clone().startOf("day").isBetween(r,i)},isWeekend:function(){var t=this.props.day.day();return 0===t||6===t},isOutsideMonth:function(){return void 0!==this.props.month&&this.props.month!==this.props.day.month()},getClassNames:function(){return(0,d["default"])("datepicker__day",{"datepicker__day--disabled":this.isDisabled(),"datepicker__day--selected":this.isSameDay(this.props.selected),"datepicker__day--in-range":this.isInRange(),"datepicker__day--today":this.isSameDay((0,i["default"])()),"datepicker__day--weekend":this.isWeekend(),"datepicker__day--outside-month":this.isOutsideMonth()})},render:function(){return s["default"].createElement("div",{className:this.getClassNames(),onClick:this.handleClick},this.props.day.date())}});t.exports=u},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var r=n(15),i=o(r);e["default"]=i["default"],t.exports=e["default"]},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){var n={};for(var o in t)e.indexOf(o)>=0||Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t},l=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),d=function(t,e,n){for(var o=!0;o;){var r=t,i=e,a=n;s=d=l=void 0,o=!1,null===r&&(r=Function.prototype);var s=Object.getOwnPropertyDescriptor(r,i);if(void 0!==s){if("value"in s)return s.value;var l=s.get;if(void 0===l)return;return l.call(a)}var d=Object.getPrototypeOf(r);if(null===d)return;t=d,e=i,n=a,o=!0}},p=n(4),u=(o(p),n(3)),f=o(u),h=n(16),c=o(h),m=function(t,e,n){var o=t.children,r=p.Children.count(o);return 0>=r?new Error(n+" expects at least one child to use as the target element."):r>2?new Error("Only a max of two children allowed in "+n+"."):void 0},y=["top left","top center","top right","middle left","middle center","middle right","bottom left","bottom center","bottom right"],g=function(t){function e(){i(this,e),d(Object.getPrototypeOf(e.prototype),"constructor",this).apply(this,arguments),this._targetNode=null,this._elementParentNode=null,this._tether=!1}return a(e,t),l(e,[{key:"componentDidMount",value:function(){this._targetNode=f["default"].findDOMNode(this),this._update()}},{key:"componentDidUpdate",value:function(){this._update()}},{key:"componentWillUnmount",value:function(){this._destroy()}},{key:"disable",value:function(){this._tether.disable()}},{key:"enable",value:function(){this._tether.enable()}},{key:"position",value:function(){this._tether.position()}},{key:"_destroy",value:function(){f["default"].unmountComponentAtNode(this._elementParentNode),this._elementParentNode.parentNode.removeChild(this._elementParentNode),this._tether&&this._tether.destroy(),this._elementParentNode=null,this._tether=null}},{key:"_update",value:function(){var t=this,e=this.props,n=e.children,o=e.renderElementTag,r=e.renderElementTo,i=n[1];return i?(this._elementParentNode||(this._elementParentNode=document.createElement(o),r.appendChild(this._elementParentNode)),void f["default"].unstable_renderSubtreeIntoContainer(this,i,this._elementParentNode,function(){t._updateTether()})):void(this._tether&&this._destroy())}},{key:"_updateTether",value:function(){var t=this.props,e=(t.children,t.renderElementTag,t.renderElementTo,r(t,["children","renderElementTag","renderElementTo"])),n=s({target:this._targetNode,element:this._elementParentNode},e);this._tether?this._tether.setOptions(n):this._tether=new c["default"](n),this._tether.position()}},{key:"render",value:function(){var t=this.props.children,e=null;return p.Children.forEach(t,function(t,n){return 0===n?void(e=t):void 0}),e}}],[{key:"propTypes",value:{children:m,renderElementTag:p.PropTypes.string,renderElementTo:p.PropTypes.any,attachment:p.PropTypes.oneOf(y).isRequired,targetAttachment:p.PropTypes.oneOf(y),offset:p.PropTypes.string,targetOffset:p.PropTypes.string,targetModifier:p.PropTypes.string,enabled:p.PropTypes.bool,classes:p.PropTypes.object,classPrefix:p.PropTypes.string,optimizations:p.PropTypes.object,constraints:p.PropTypes.array},enumerable:!0},{key:"defaultProps",value:{renderElementTag:"div",renderElementTo:document.body},enumerable:!0}]),e}(p.Component);e["default"]=g,t.exports=e["default"]},function(t,e,n){var o,r;/*! tether 1.1.0 */
!function(i,a){o=a,r="function"==typeof o?o.call(e,n,e,t):o,!(void 0!==r&&(t.exports=r))}(this,function(t,e,n){"use strict";function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t){var e=getComputedStyle(t),n=e.position;if("fixed"===n)return t;for(var o=t;o=o.parentNode;){var r=void 0;try{r=getComputedStyle(o)}catch(i){}if("undefined"==typeof r||null===r)return o;var a=r,s=a.overflow,l=a.overflowX,d=a.overflowY;if(/(auto|scroll)/.test(s+d+l)&&("absolute"!==n||["relative","absolute","fixed"].indexOf(r.position)>=0))return o}return document.body}function i(t){var e=void 0;t===document?(e=document,t=document.documentElement):e=t.ownerDocument;var n=e.documentElement,o={},r=t.getBoundingClientRect();for(var i in r)o[i]=r[i];var a=T(e);return o.top-=a.top,o.left-=a.left,"undefined"==typeof o.width&&(o.width=document.body.scrollWidth-o.left-o.right),"undefined"==typeof o.height&&(o.height=document.body.scrollHeight-o.top-o.bottom),o.top=o.top-n.clientTop,o.left=o.left-n.clientLeft,o.right=e.body.clientWidth-o.width-o.left,o.bottom=e.body.clientHeight-o.height-o.top,o}function a(t){return t.offsetParent||document.documentElement}function s(){var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");l(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e);var n=t.offsetWidth;e.style.overflow="scroll";var o=t.offsetWidth;n===o&&(o=e.clientWidth),document.body.removeChild(e);var r=n-o;return{width:r,height:r}}function l(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=[];return Array.prototype.push.apply(e,arguments),e.slice(1).forEach(function(e){if(e)for(var n in e)({}).hasOwnProperty.call(e,n)&&(t[n]=e[n])}),t}function d(t,e){if("undefined"!=typeof t.classList)e.split(" ").forEach(function(e){e.trim()&&t.classList.remove(e)});else{var n=new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi"),o=f(t).replace(n," ");h(t,o)}}function p(t,e){if("undefined"!=typeof t.classList)e.split(" ").forEach(function(e){e.trim()&&t.classList.add(e)});else{d(t,e);var n=f(t)+(" "+e);h(t,n)}}function u(t,e){if("undefined"!=typeof t.classList)return t.classList.contains(e);var n=f(t);return new RegExp("(^| )"+e+"( |$)","gi").test(n)}function f(t){return t.className instanceof SVGAnimatedString?t.className.baseVal:t.className}function h(t,e){t.setAttribute("class",e)}function c(t,e,n){n.forEach(function(n){-1===e.indexOf(n)&&u(t,n)&&d(t,n)}),e.forEach(function(e){u(t,e)||p(t,e)})}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function m(t,e){var n=arguments.length<=2||void 0===arguments[2]?1:arguments[2];return t+n>=e&&e>=t-n}function y(){return"undefined"!=typeof performance&&"undefined"!=typeof performance.now?performance.now():+new Date}function g(){for(var t={top:0,left:0},e=arguments.length,n=Array(e),o=0;e>o;o++)n[o]=arguments[o];return n.forEach(function(e){var n=e.top,o=e.left;"string"==typeof n&&(n=parseFloat(n,10)),"string"==typeof o&&(o=parseFloat(o,10)),t.top+=n,t.left+=o}),t}function v(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/100*e.height),t}function b(t,e){return"scrollParent"===e?e=t.scrollParent:"window"===e&&(e=[pageXOffset,pageYOffset,innerWidth+pageXOffset,innerHeight+pageYOffset]),e===document&&(e=e.documentElement),"undefined"!=typeof e.nodeType&&!function(){var t=i(e),n=t,o=getComputedStyle(e);e=[n.left,n.top,t.width+n.left,t.height+n.top],L.forEach(function(t,n){t=t[0].toUpperCase()+t.substr(1),"Top"===t||"Left"===t?e[n]+=parseFloat(o["border"+t+"Width"]):e[n]-=parseFloat(o["border"+t+"Width"])})}(),e}var D=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}(),C=void 0;"undefined"==typeof C&&(C={modules:[]});var w=function(){var t=0;return function(){return++t}}(),_={},T=function(t){var e=t._tetherZeroElement;"undefined"==typeof e&&(e=t.createElement("div"),e.setAttribute("data-tether-id",w()),l(e.style,{top:0,left:0,position:"absolute"}),t.body.appendChild(e),t._tetherZeroElement=e);var n=e.getAttribute("data-tether-id");if("undefined"==typeof _[n]){_[n]={};var o=e.getBoundingClientRect();for(var r in o)_[n][r]=o[r];P(function(){delete _[n]})}return _[n]},k=[],P=function(t){k.push(t)},x=function(){for(var t=void 0;t=k.pop();)t()},O=function(){function t(){o(this,t)}return D(t,[{key:"on",value:function(t,e,n){var o=arguments.length<=3||void 0===arguments[3]?!1:arguments[3];"undefined"==typeof this.bindings&&(this.bindings={}),"undefined"==typeof this.bindings[t]&&(this.bindings[t]=[]),this.bindings[t].push({handler:e,ctx:n,once:o})}},{key:"once",value:function(t,e,n){this.on(t,e,n,!0)}},{key:"off",value:function(t,e){if("undefined"==typeof this.bindings||"undefined"==typeof this.bindings[t])if("undefined"==typeof e)delete this.bindings[t];else for(var n=0;n<this.bindings[t].length;)this.bindings[t][n].handler===e?this.bindings[t].splice(n,1):++n}},{key:"trigger",value:function(t){if("undefined"!=typeof this.bindings&&this.bindings[t]){for(var e=0,n=arguments.length,o=Array(n>1?n-1:0),r=1;n>r;r++)o[r-1]=arguments[r];for(;e<this.bindings[t].length;){var i=this.bindings[t][e],a=i.handler,s=i.ctx,l=i.once,d=s;"undefined"==typeof d&&(d=this),a.apply(d,o),l?this.bindings[t].splice(e,1):++e}}}}]),t}();C.Utils={getScrollParent:r,getBounds:i,getOffsetParent:a,extend:l,addClass:p,removeClass:d,hasClass:u,updateClasses:c,defer:P,flush:x,uniqueId:w,Evented:O,getScrollBarSize:s};var E=function(){function t(t,e){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);o=!0);}catch(l){r=!0,i=l}finally{try{!o&&s["return"]&&s["return"]()}finally{if(r)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),D=function(){function t(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(e,n,o){return n&&t(e.prototype,n),o&&t(e,o),e}}();if("undefined"==typeof C)throw new Error("You must include the utils.js file before tether.js");var S=C.Utils,r=S.getScrollParent,i=S.getBounds,a=S.getOffsetParent,l=S.extend,p=S.addClass,d=S.removeClass,c=S.updateClasses,P=S.defer,x=S.flush,s=S.getScrollBarSize,N=function(){if("undefined"==typeof document)return"";for(var t=document.createElement("div"),e=["transform","webkitTransform","OTransform","MozTransform","msTransform"],n=0;n<e.length;++n){var o=e[n];if(void 0!==t.style[o])return o}}(),M=[],j=function(){M.forEach(function(t){t.position(!1)}),x()};!function(){var t=null,e=null,n=null,o=function r(){return"undefined"!=typeof e&&e>16?(e=Math.min(e-16,250),void(n=setTimeout(r,250))):void("undefined"!=typeof t&&y()-t<10||("undefined"!=typeof n&&(clearTimeout(n),n=null),t=y(),j(),e=y()-t))};"undefined"!=typeof window&&["resize","scroll","touchmove"].forEach(function(t){window.addEventListener(t,o)})}();var A={center:"center",left:"right",right:"left"},Y={middle:"middle",top:"bottom",bottom:"top"},B={top:0,left:0,middle:"50%",center:"50%",bottom:"100%",right:"100%"},F=function(t,e){var n=t.left,o=t.top;return"auto"===n&&(n=A[e.left]),"auto"===o&&(o=Y[e.top]),{left:n,top:o}},W=function(t){var e=t.left,n=t.top;return"undefined"!=typeof B[t.left]&&(e=B[t.left]),"undefined"!=typeof B[t.top]&&(n=B[t.top]),{left:e,top:n}},q=function(t){var e=t.split(" "),n=E(e,2),o=n[0],r=n[1];return{top:o,left:r}},I=q,R=function(){function t(e){var n=this;o(this,t),this.position=this.position.bind(this),M.push(this),this.history=[],this.setOptions(e,!1),C.modules.forEach(function(t){"undefined"!=typeof t.initialize&&t.initialize.call(n)}),this.position()}return D(t,[{key:"getClass",value:function(){var t=arguments.length<=0||void 0===arguments[0]?"":arguments[0],e=this.options.classes;return"undefined"!=typeof e&&e[t]?this.options.classes[t]:this.options.classPrefix?this.options.classPrefix+"-"+t:t}},{key:"setOptions",value:function(t){var e=this,n=arguments.length<=1||void 0===arguments[1]?!0:arguments[1],o={offset:"0 0",targetOffset:"0 0",targetAttachment:"auto auto",classPrefix:"tether"};this.options=l(o,t);var i=this.options,a=i.element,s=i.target,d=i.targetModifier;if(this.element=a,this.target=s,this.targetModifier=d,"viewport"===this.target?(this.target=document.body,this.targetModifier="visible"):"scroll-handle"===this.target&&(this.target=document.body,this.targetModifier="scroll-handle"),["element","target"].forEach(function(t){if("undefined"==typeof e[t])throw new Error("Tether Error: Both element and target must be defined");"undefined"!=typeof e[t].jquery?e[t]=e[t][0]:"string"==typeof e[t]&&(e[t]=document.querySelector(e[t]))}),p(this.element,this.getClass("element")),this.options.addTargetClasses!==!1&&p(this.target,this.getClass("target")),!this.options.attachment)throw new Error("Tether Error: You must provide an attachment");this.targetAttachment=I(this.options.targetAttachment),this.attachment=I(this.options.attachment),this.offset=q(this.options.offset),this.targetOffset=q(this.options.targetOffset),"undefined"!=typeof this.scrollParent&&this.disable(),"scroll-handle"===this.targetModifier?this.scrollParent=this.target:this.scrollParent=r(this.target),this.options.enabled!==!1&&this.enable(n)}},{key:"getTargetBounds",value:function(){if("undefined"==typeof this.targetModifier)return i(this.target);if("visible"===this.targetModifier){if(this.target===document.body)return{top:pageYOffset,left:pageXOffset,height:innerHeight,width:innerWidth};var t=i(this.target),e={height:t.height,width:t.width,top:t.top,left:t.left};return e.height=Math.min(e.height,t.height-(pageYOffset-t.top)),e.height=Math.min(e.height,t.height-(t.top+t.height-(pageYOffset+innerHeight))),e.height=Math.min(innerHeight,e.height),e.height-=2,e.width=Math.min(e.width,t.width-(pageXOffset-t.left)),e.width=Math.min(e.width,t.width-(t.left+t.width-(pageXOffset+innerWidth))),e.width=Math.min(innerWidth,e.width),e.width-=2,e.top<pageYOffset&&(e.top=pageYOffset),e.left<pageXOffset&&(e.left=pageXOffset),e}if("scroll-handle"===this.targetModifier){var t=void 0,n=this.target;n===document.body?(n=document.documentElement,t={left:pageXOffset,top:pageYOffset,height:innerHeight,width:innerWidth}):t=i(n);var o=getComputedStyle(n),r=n.scrollWidth>n.clientWidth||[o.overflow,o.overflowX].indexOf("scroll")>=0||this.target!==document.body,a=0;r&&(a=15);var s=t.height-parseFloat(o.borderTopWidth)-parseFloat(o.borderBottomWidth)-a,e={width:15,height:.975*s*(s/n.scrollHeight),left:t.left+t.width-parseFloat(o.borderLeftWidth)-15},l=0;408>s&&this.target===document.body&&(l=-11e-5*Math.pow(s,2)-.00727*s+22.58),this.target!==document.body&&(e.height=Math.max(e.height,24));var d=this.target.scrollTop/(n.scrollHeight-s);return e.top=d*(s-e.height-l)+t.top+parseFloat(o.borderTopWidth),this.target===document.body&&(e.height=Math.max(e.height,24)),e}}},{key:"clearCache",value:function(){this._cache={}}},{key:"cache",value:function(t,e){return"undefined"==typeof this._cache&&(this._cache={}),"undefined"==typeof this._cache[t]&&(this._cache[t]=e.call(this)),this._cache[t]}},{key:"enable",value:function(){var t=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];this.options.addTargetClasses!==!1&&p(this.target,this.getClass("enabled")),p(this.element,this.getClass("enabled")),this.enabled=!0,this.scrollParent!==document&&this.scrollParent.addEventListener("scroll",this.position),t&&this.position()}},{key:"disable",value:function(){d(this.target,this.getClass("enabled")),d(this.element,this.getClass("enabled")),this.enabled=!1,"undefined"!=typeof this.scrollParent&&this.scrollParent.removeEventListener("scroll",this.position)}},{key:"destroy",value:function(){var t=this;this.disable(),M.forEach(function(e,n){return e===t?void M.splice(n,1):void 0})}},{key:"updateAttachClasses",value:function(t,e){var n=this;t=t||this.attachment,e=e||this.targetAttachment;var o=["left","top","bottom","right","middle","center"];"undefined"!=typeof this._addAttachClasses&&this._addAttachClasses.length&&this._addAttachClasses.splice(0,this._addAttachClasses.length),"undefined"==typeof this._addAttachClasses&&(this._addAttachClasses=[]);var r=this._addAttachClasses;t.top&&r.push(this.getClass("element-attached")+"-"+t.top),t.left&&r.push(this.getClass("element-attached")+"-"+t.left),e.top&&r.push(this.getClass("target-attached")+"-"+e.top),e.left&&r.push(this.getClass("target-attached")+"-"+e.left);var i=[];o.forEach(function(t){i.push(n.getClass("element-attached")+"-"+t),i.push(n.getClass("target-attached")+"-"+t)}),P(function(){"undefined"!=typeof n._addAttachClasses&&(c(n.element,n._addAttachClasses,i),n.options.addTargetClasses!==!1&&c(n.target,n._addAttachClasses,i),delete n._addAttachClasses)})}},{key:"position",value:function(){var t=this,e=arguments.length<=0||void 0===arguments[0]?!0:arguments[0];if(this.enabled){this.clearCache();var n=F(this.targetAttachment,this.attachment);this.updateAttachClasses(this.attachment,n);var o=this.cache("element-bounds",function(){return i(t.element)}),r=o.width,l=o.height;if(0===r&&0===l&&"undefined"!=typeof this.lastSize){var d=this.lastSize;r=d.width,l=d.height}else this.lastSize={width:r,height:l};var p=this.cache("target-bounds",function(){return t.getTargetBounds()}),u=p,f=v(W(this.attachment),{width:r,height:l}),h=v(W(n),u),c=v(this.offset,{width:r,height:l}),m=v(this.targetOffset,u);f=g(f,c),h=g(h,m);for(var y=p.left+h.left-f.left,b=p.top+h.top-f.top,D=0;D<C.modules.length;++D){var w=C.modules[D],_=w.position.call(this,{left:y,top:b,targetAttachment:n,targetPos:p,elementPos:o,offset:f,targetOffset:h,manualOffset:c,manualTargetOffset:m,scrollbarSize:k,attachment:this.attachment});if(_===!1)return!1;"undefined"!=typeof _&&"object"==typeof _&&(b=_.top,y=_.left)}var T={page:{top:b,left:y},viewport:{top:b-pageYOffset,bottom:pageYOffset-b-l+innerHeight,left:y-pageXOffset,right:pageXOffset-y-r+innerWidth}},k=void 0;return document.body.scrollWidth>window.innerWidth&&(k=this.cache("scrollbar-size",s),T.viewport.bottom-=k.height),document.body.scrollHeight>window.innerHeight&&(k=this.cache("scrollbar-size",s),T.viewport.right-=k.width),(-1===["","static"].indexOf(document.body.style.position)||-1===["","static"].indexOf(document.body.parentElement.style.position))&&(T.page.bottom=document.body.scrollHeight-b-l,T.page.right=document.body.scrollWidth-y-r),"undefined"!=typeof this.options.optimizations&&this.options.optimizations.moveElement!==!1&&"undefined"==typeof this.targetModifier&&!function(){var e=t.cache("target-offsetparent",function(){return a(t.target)}),n=t.cache("target-offsetparent-bounds",function(){return i(e)}),o=getComputedStyle(e),r=n,s={};if(["Top","Left","Bottom","Right"].forEach(function(t){s[t.toLowerCase()]=parseFloat(o["border"+t+"Width"])}),n.right=document.body.scrollWidth-n.left-r.width+s.right,n.bottom=document.body.scrollHeight-n.top-r.height+s.bottom,T.page.top>=n.top+s.top&&T.page.bottom>=n.bottom&&T.page.left>=n.left+s.left&&T.page.right>=n.right){var l=e.scrollTop,d=e.scrollLeft;T.offset={top:T.page.top-n.top+l-s.top,left:T.page.left-n.left+d-s.left}}}(),this.move(T),this.history.unshift(T),this.history.length>3&&this.history.pop(),e&&x(),!0}}},{key:"move",value:function(t){var e=this;if("undefined"!=typeof this.element.parentNode){var n={};for(var o in t){n[o]={};for(var r in t[o]){for(var i=!1,s=0;s<this.history.length;++s){var d=this.history[s];if("undefined"!=typeof d[o]&&!m(d[o][r],t[o][r])){i=!0;break}}i||(n[o][r]=!0)}}var p={top:"",left:"",right:"",bottom:""},u=function(t,n){var o="undefined"!=typeof e.options.optimizations,r=o?e.options.optimizations.gpu:null;if(r!==!1){var i=void 0,a=void 0;t.top?(p.top=0,i=n.top):(p.bottom=0,i=-n.bottom),t.left?(p.left=0,a=n.left):(p.right=0,a=-n.right),p[N]="translateX("+Math.round(a)+"px) translateY("+Math.round(i)+"px)","msTransform"!==N&&(p[N]+=" translateZ(0)")}else t.top?p.top=n.top+"px":p.bottom=n.bottom+"px",t.left?p.left=n.left+"px":p.right=n.right+"px"},f=!1;if((n.page.top||n.page.bottom)&&(n.page.left||n.page.right)?(p.position="absolute",u(n.page,t.page)):(n.viewport.top||n.viewport.bottom)&&(n.viewport.left||n.viewport.right)?(p.position="fixed",u(n.viewport,t.viewport)):"undefined"!=typeof n.offset&&n.offset.top&&n.offset.left?!function(){p.position="absolute";var o=e.cache("target-offsetparent",function(){return a(e.target)});a(e.element)!==o&&P(function(){e.element.parentNode.removeChild(e.element),o.appendChild(e.element)}),u(n.offset,t.offset),f=!0}():(p.position="absolute",u({top:!0,left:!0},t.page)),!f){for(var h=!0,c=this.element.parentNode;c&&"BODY"!==c.tagName;){if("static"!==getComputedStyle(c).position){h=!1;break}c=c.parentNode}h||(this.element.parentNode.removeChild(this.element),document.body.appendChild(this.element))}var y={},g=!1;for(var r in p){var v=p[r],b=this.element.style[r];""!==b&&""!==v&&["top","left","bottom","right"].indexOf(r)>=0&&(b=parseFloat(b),v=parseFloat(v)),b!==v&&(g=!0,y[r]=v)}g&&P(function(){l(e.element.style,y)})}}}]),t}();R.modules=[],C.position=j;var z=l(R,C),E=function(){function t(t,e){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);o=!0);}catch(l){r=!0,i=l}finally{try{!o&&s["return"]&&s["return"]()}finally{if(r)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),S=C.Utils,i=S.getBounds,l=S.extend,c=S.updateClasses,P=S.defer,L=["left","top","right","bottom"];C.modules.push({position:function(t){var e=this,n=t.top,o=t.left,r=t.targetAttachment;if(!this.options.constraints)return!0;var a=this.cache("element-bounds",function(){return i(e.element)}),s=a.height,d=a.width;if(0===d&&0===s&&"undefined"!=typeof this.lastSize){var p=this.lastSize;d=p.width,s=p.height}var u=this.cache("target-bounds",function(){return e.getTargetBounds()}),f=u.height,h=u.width,m=[this.getClass("pinned"),this.getClass("out-of-bounds")];this.options.constraints.forEach(function(t){var e=t.outOfBoundsClass,n=t.pinnedClass;e&&m.push(e),n&&m.push(n)}),m.forEach(function(t){["left","top","right","bottom"].forEach(function(e){m.push(t+"-"+e)})});var y=[],g=l({},r),v=l({},this.attachment);return this.options.constraints.forEach(function(t){var i=t.to,a=t.attachment,l=t.pin;"undefined"==typeof a&&(a="");var p=void 0,u=void 0;if(a.indexOf(" ")>=0){var c=a.split(" "),m=E(c,2);u=m[0],p=m[1]}else p=u=a;var D=b(e,i);("target"===u||"both"===u)&&(n<D[1]&&"top"===g.top&&(n+=f,g.top="bottom"),n+s>D[3]&&"bottom"===g.top&&(n-=f,g.top="top")),"together"===u&&(n<D[1]&&"top"===g.top&&("bottom"===v.top?(n+=f,g.top="bottom",n+=s,v.top="top"):"top"===v.top&&(n+=f,g.top="bottom",n-=s,v.top="bottom")),n+s>D[3]&&"bottom"===g.top&&("top"===v.top?(n-=f,g.top="top",n-=s,v.top="bottom"):"bottom"===v.top&&(n-=f,g.top="top",n+=s,v.top="top")),"middle"===g.top&&(n+s>D[3]&&"top"===v.top?(n-=s,v.top="bottom"):n<D[1]&&"bottom"===v.top&&(n+=s,v.top="top"))),("target"===p||"both"===p)&&(o<D[0]&&"left"===g.left&&(o+=h,g.left="right"),o+d>D[2]&&"right"===g.left&&(o-=h,g.left="left")),"together"===p&&(o<D[0]&&"left"===g.left?"right"===v.left?(o+=h,g.left="right",o+=d,v.left="left"):"left"===v.left&&(o+=h,g.left="right",o-=d,v.left="right"):o+d>D[2]&&"right"===g.left?"left"===v.left?(o-=h,g.left="left",o-=d,v.left="right"):"right"===v.left&&(o-=h,g.left="left",o+=d,v.left="left"):"center"===g.left&&(o+d>D[2]&&"left"===v.left?(o-=d,v.left="right"):o<D[0]&&"right"===v.left&&(o+=d,v.left="left"))),("element"===u||"both"===u)&&(n<D[1]&&"bottom"===v.top&&(n+=s,v.top="top"),n+s>D[3]&&"top"===v.top&&(n-=s,v.top="bottom")),("element"===p||"both"===p)&&(o<D[0]&&"right"===v.left&&(o+=d,v.left="left"),o+d>D[2]&&"left"===v.left&&(o-=d,v.left="right")),"string"==typeof l?l=l.split(",").map(function(t){return t.trim()}):l===!0&&(l=["top","left","right","bottom"]),l=l||[];var C=[],w=[];n<D[1]&&(l.indexOf("top")>=0?(n=D[1],C.push("top")):w.push("top")),n+s>D[3]&&(l.indexOf("bottom")>=0?(n=D[3]-s,C.push("bottom")):w.push("bottom")),o<D[0]&&(l.indexOf("left")>=0?(o=D[0],C.push("left")):w.push("left")),o+d>D[2]&&(l.indexOf("right")>=0?(o=D[2]-d,C.push("right")):w.push("right")),C.length&&!function(){var t=void 0;t="undefined"!=typeof e.options.pinnedClass?e.options.pinnedClass:e.getClass("pinned"),y.push(t),C.forEach(function(e){y.push(t+"-"+e)})}(),w.length&&!function(){var t=void 0;t="undefined"!=typeof e.options.outOfBoundsClass?e.options.outOfBoundsClass:e.getClass("out-of-bounds"),y.push(t),w.forEach(function(e){y.push(t+"-"+e)})}(),(C.indexOf("left")>=0||C.indexOf("right")>=0)&&(v.left=g.left=!1),(C.indexOf("top")>=0||C.indexOf("bottom")>=0)&&(v.top=g.top=!1),(g.top!==r.top||g.left!==r.left||v.top!==e.attachment.top||v.left!==e.attachment.left)&&e.updateAttachClasses(v,g)}),P(function(){e.options.addTargetClasses!==!1&&c(e.target,y,m),c(e.element,y,m)}),{top:n,left:o}}});var S=C.Utils,i=S.getBounds,c=S.updateClasses,P=S.defer;C.modules.push({position:function(t){var e=this,n=t.top,o=t.left,r=this.cache("element-bounds",function(){return i(e.element)}),a=r.height,s=r.width,l=this.getTargetBounds(),d=n+a,p=o+s,u=[];n<=l.bottom&&d>=l.top&&["left","right"].forEach(function(t){var e=l[t];(e===o||e===p)&&u.push(t)}),o<=l.right&&p>=l.left&&["top","bottom"].forEach(function(t){var e=l[t];(e===n||e===d)&&u.push(t)});var f=[],h=[],m=["left","top","right","bottom"];return f.push(this.getClass("abutted")),m.forEach(function(t){f.push(e.getClass("abutted")+"-"+t)}),u.length&&h.push(this.getClass("abutted")),u.forEach(function(t){h.push(e.getClass("abutted")+"-"+t)}),P(function(){e.options.addTargetClasses!==!1&&c(e.target,h,f),c(e.element,h,f)}),!0}});var E=function(){function t(t,e){var n=[],o=!0,r=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(o=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);o=!0);}catch(l){r=!0,i=l}finally{try{!o&&s["return"]&&s["return"]()}finally{if(r)throw i}}return n}return function(e,n){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return t(e,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();return C.modules.push({position:function(t){var e=t.top,n=t.left;if(this.options.shift){var o=this.options.shift;"function"==typeof this.options.shift&&(o=this.options.shift.call(this,{top:e,left:n}));var r=void 0,i=void 0;if("string"==typeof o){o=o.split(" "),o[1]=o[1]||o[0];var a=o,s=E(a,2);r=s[0],i=s[1],r=parseFloat(r,10),i=parseFloat(i,10)}else r=o.top,i=o.left;return e+=r,n+=i,{top:e,left:n}}}}),z})}])});
|
src/svg-icons/notification/sms-failed.js
|
nathanmarks/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let NotificationSmsFailed = (props) => (
<SvgIcon {...props}>
<path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"/>
</SvgIcon>
);
NotificationSmsFailed = pure(NotificationSmsFailed);
NotificationSmsFailed.displayName = 'NotificationSmsFailed';
NotificationSmsFailed.muiName = 'SvgIcon';
export default NotificationSmsFailed;
|
modules/genomic_browser/jsx/tabs_content/snp.js
|
driusan/Loris
|
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import FilterableDataTable from 'jsx/FilterableDataTable';
import Loader from 'jsx/Loader';
/**
* SNP Component.
*
* @description Genomic Browser SNP tab.
*
* @author Alizée Wickenheiser
* @version 1.0.0
*
*/
class SNP extends Component {
/**
* Constructor of component
* @param {object} props - the component properties.
*/
constructor(props) {
super(props);
this.state = {
data: {},
fieldOptions: {},
error: false,
isLoaded: false,
};
this.fetchData = this.fetchData.bind(this);
this.formatColumn = this.formatColumn.bind(this);
}
/**
* Fetch data when component mounts.
*/
componentDidMount() {
this.fetchData();
}
/**
* Retrieve data from the provided URL and save it in state.
*/
fetchData() {
fetch(
this.props.baseURL + '/genomic_browser/SnpBrowser',
{
method: 'GET',
credentials: 'same-origin',
headers: {
'Content-Type': 'application/json',
},
}
).then((resp) => {
if (resp.ok) {
resp.json().then((json) => {
const data = {
fieldOptions: json.fieldOptions,
Data: json.data.map((e) => Object.values(e)),
subprojects: json.subprojects,
};
this.setState({
data,
isLoaded: true,
});
});
} else {
this.setState({error: true});
console.error(resp.statusText);
}
}).catch((error) => {
this.setState({error: true});
console.error(error);
});
}
/**
* Modify behaviour of specified column cells in the Data Table component
*
* @param {string} column - column name
* @param {string} cell - cell content
* @param {array} rowData - array of cell contents for a specific row
* @param {array} rowHeaders - array of table headers (column names)
*
* @return {*} a formatted table cell for a given column
*/
formatColumn(column, cell, rowData, rowHeaders) {
let reactElement;
switch (column) {
case 'PSCID':
const url = `${this.props.baseURL}/${rowData.DCCID}/`;
reactElement = <td><a href={url}>{rowData.PSCID}</a></td>;
break;
case 'Subproject':
reactElement = <td>{this.state.data.subprojects[parseInt(cell)]}</td>;
break;
default:
reactElement = <td>{cell}</td>;
break;
}
return reactElement;
}
/**
* @return {DOMRect}
*/
render() {
// Waiting for async data to load.
if (!this.state.isLoaded) {
return <Loader/>;
}
// The filter options
const options = this.state.data.fieldOptions;
// The fields configured for display/hide.
let fields = [
{
label: 'Site',
show: false,
filter: {
name: 'Site',
type: 'select',
options: options.Sites,
},
},
{
label: 'DCCID',
show: false,
filter: {
name: 'DCCID',
type: 'text',
},
},
{
label: 'PSCID',
show: true,
filter: {
name: 'PSCID',
type: 'text',
},
},
{
label: 'Sex',
show: true,
filter: {
name: 'Sex',
type: 'select',
options: {
Male: 'Male',
Female: 'Female',
},
},
},
{
label: 'Subproject',
show: true,
filter: {
name: 'Subproject',
type: 'select',
options: options.Subproject,
},
},
{
label: 'Date of Birth',
show: false,
},
{
label: 'External ID',
show: false,
filter: {
name: 'External ID',
type: 'text',
},
},
{
label: 'Build',
show: true,
filter: {
name: 'Build',
type: 'select',
options: {
37: 'GRCh37',
},
},
},
{
label: 'Strand',
show: false,
filter: {
name: 'Strand',
type: 'select',
options: {
F: 'Forward',
R: 'Reverse',
},
},
},
{
label: 'Start Loc',
show: false,
},
{
label: 'End Loc',
show: false,
},
{
label: 'Gene',
show: false,
},
{
label: 'Name',
show: false,
filter: {
name: 'Name',
type: 'text',
},
},
{
label: 'Platform',
show: true,
filter: {
name: 'Platform',
type: 'select',
options: options.Platform,
},
},
{
label: 'rsID',
show: false,
filter: {
name: 'rsID',
type: 'text',
},
},
{
label: 'Name',
show: false,
filter: {
name: 'Name',
type: 'text',
},
},
{
label: 'Description',
show: false,
filter: {
name: 'Description',
type: 'text',
},
},
{
label: 'External Source',
show: false,
filter: {
name: 'External Source',
type: 'text',
},
},
{
label: 'Allele A',
show: true,
filter: {
name: 'Allele A',
type: 'select',
options: {
A: 'A',
C: 'C',
T: 'T',
G: 'G',
},
},
},
{
label: 'Allele B',
show: true,
filter: {
name: 'Allele B',
type: 'select',
options: {
A: 'A',
C: 'C',
T: 'T',
G: 'G',
},
},
},
{
label: 'Reference Base',
show: true,
filter: {
name: 'Reference Base',
type: 'select',
options: {
A: 'A',
C: 'C',
T: 'T',
G: 'G',
},
},
},
{
label: 'Minor Allele',
show: true,
filter: {
name: 'Minor Allele',
type: 'select',
options: {
A: 'A',
C: 'C',
T: 'T',
G: 'G',
},
},
},
{
label: 'Array Report',
show: false,
filter: {
name: 'Array Report',
type: 'select',
options: {
Abnormal: 'Abnormal',
Normal: 'Normal',
Pending: 'Pending',
Uncertain: 'Uncertain',
},
},
},
{
label: 'Markers',
show: false,
},
{
label: 'Validation Method',
show: false,
},
{
label: 'Validated',
show: false,
filter: {
name: 'Validated',
type: 'select',
options: {
0: '0',
1: '1',
},
},
},
{
label: 'Function Prediction',
show: true,
filter: {
name: 'Function Prediction',
type: 'select',
options: {
exonic: 'exonic',
ncRNAexonic: 'ncRNAexonic',
splicing: 'splicing',
UTR3: 'UTR3',
UTR5: 'UTR5',
},
},
},
{
label: 'Damaging',
show: true,
filter: {
name: 'Damaging',
type: 'select',
options: {
D: 'D',
NA: 'NA',
},
},
},
{
label: 'Genotype Quality',
show: true,
},
{
label: 'Exonic Function',
show: false,
filter: {
name: 'Exonic Function',
type: 'text',
},
},
{
label: 'Genomic Range',
show: false,
filter: {
name: 'Genomic Range',
type: 'text',
},
},
];
return (
<FilterableDataTable
name={'filterableDataTableSNP'}
data={this.state.data.Data}
fields={fields}
getFormattedCell={this.formatColumn}
/>
);
}
}
SNP.defaultProps = {
display: false,
data: null,
};
SNP.propTypes = {
display: PropTypes.bool,
data: PropTypes.object,
baseURL: PropTypes.string.isRequired,
};
export default SNP;
|
src/entypo/Share.js
|
cox-auto-kc/react-entypo
|
import React from 'react';
import EntypoIcon from '../EntypoIcon';
const iconClass = 'entypo-svgicon entypo--Share';
let EntypoShare = (props) => (
<EntypoIcon propClass={iconClass} {...props}>
<path d="M15,13.442c-0.633,0-1.204,0.246-1.637,0.642l-5.938-3.463C7.471,10.433,7.5,10.237,7.5,10.037S7.471,9.642,7.425,9.454L13.3,6.025C13.746,6.442,14.342,6.7,15,6.7c1.379,0,2.5-1.121,2.5-2.5S16.379,1.7,15,1.7s-2.5,1.121-2.5,2.5c0,0.2,0.029,0.396,0.075,0.583L6.7,8.212C6.254,7.796,5.658,7.537,5,7.537c-1.379,0-2.5,1.121-2.5,2.5s1.121,2.5,2.5,2.5c0.658,0,1.254-0.258,1.7-0.675l5.938,3.463c-0.042,0.175-0.067,0.358-0.067,0.546c0,1.342,1.087,2.429,2.429,2.429s2.429-1.088,2.429-2.429S16.342,13.442,15,13.442z"/>
</EntypoIcon>
);
export default EntypoShare;
|
react/src/components/flag/SprkFlag.js
|
sparkdesignsystem/spark-design-system
|
import React from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
const SprkFlag = (props) => {
// TODO: remove additionalMediaClasses and additionalBodyClasses
// next release
const {
additionalMediaClasses,
additionalBodyClasses,
bodyAdditionalClasses,
mediaAdditionalClasses,
children,
media,
isReversed,
isStacked,
verticalAlignment,
idString,
additionalClasses,
spacing,
...other
} = props;
const flagClassNames = classnames('sprk-o-Flag', additionalClasses, {
'sprk-o-Flag--stacked': isStacked,
'sprk-o-Flag--rev': isReversed,
'sprk-o-Flag--middle': verticalAlignment === 'middle',
'sprk-o-Flag--bottom': verticalAlignment === 'bottom',
'sprk-o-Flag--tiny': spacing === 'tiny',
'sprk-o-Flag--small': spacing === 'small',
'sprk-o-Flag--large': spacing === 'large',
'sprk-o-Flag--huge': spacing === 'huge',
});
return (
<div className={flagClassNames} data-id={idString} {...other}>
<div
className={classnames(
'sprk-o-Flag__figure',
mediaAdditionalClasses || additionalMediaClasses,
)}
>
{media}
</div>
<div
className={classnames(
'sprk-o-Flag__body',
bodyAdditionalClasses || additionalBodyClasses,
)}
>
{children}
</div>
</div>
);
};
SprkFlag.propTypes = {
/** Content to render inside of the component. */
children: PropTypes.node,
/**
* Receives a component that will
* render media into the Flag component. Required.
*/
media: PropTypes.element.isRequired,
/**
* Reverses the order of the figure and body.
*/
isReversed: PropTypes.bool,
/**
* Stacks elements at `$sprk-flag-stacked-breakpoint`
*/
isStacked: PropTypes.bool,
/**
* Determines how much space between the figure and the body.
*/
spacing: PropTypes.oneOf(['tiny', 'small', 'medium', 'large', 'huge']),
/**
* Determines the vertical alignment of content.
*/
verticalAlignment: PropTypes.oneOf(['top', 'middle', 'bottom']),
/**
* Assigned to the `data-id` attribute serving as
* a unique selector for automated tools.
*/
idString: PropTypes.string,
// TODO: Deprecate on next release
/**
* Deprecated and to be removed next release.
* Replaced with `mediaAdditionalClasses`.
* A space-separated string of classes to add to
* the media container of the component.
* Will be removed at next release.
*/
additionalMediaClasses: PropTypes.string,
/**
* A space-separated string of classes to add to
* the media container of the component.
*/
mediaAdditionalClasses: PropTypes.string,
// TODO: Deprecate on next release
/**
* Deprecated and to be removed next release.
* Replaced with `bodyAdditionalClasses`.
* A space-separated string of classes to add to
* the body container of the component.
* Will be removed at next release.
*/
additionalBodyClasses: PropTypes.string,
/**
* A space-separated string of classes to add to
* the body container of the component.
*/
bodyAdditionalClasses: PropTypes.string,
/**
* A space-separated string of classes to add to
* the outermost container of the component.
*/
additionalClasses: PropTypes.string,
};
export default SprkFlag;
|
ajax/libs/ui-router-extras/0.0.11/ct-ui-router-extras.min.js
|
LeaYeh/cdnjs
|
/*! ui-router-extras - v0.0.11 - 2014-11-21 */!function(a,b,c){function d(a,b){var c=[];for(var d in a.path){if(a.path[d]!==b.path[d])break;c.push(a.path[d])}return c}function e(a){if(Object.keys)return Object.keys(a);var c=[];return b.forEach(a,function(a,b){c.push(b)}),c}function f(a,b){if(Array.prototype.indexOf)return a.indexOf(b,Number(arguments[2])||0);var c=a.length>>>0,d=Number(arguments[2])||0;for(d=0>d?Math.ceil(d):Math.floor(d),0>d&&(d+=c);c>d;d++)if(d in a&&a[d]===b)return d;return-1}function g(a,b,c,g){var h,i=d(c,g),j={},k=[];for(var l in i)if(i[l].params&&(h=r(i[l].params)?i[l].params:e(i[l].params),h.length))for(var m in h)f(k,h[m])>=0||(k.push(h[m]),j[h[m]]=a[h[m]]);return q({},j,b)}function h(a,b){return q(new(q(function(){},{prototype:a})),b)}function i(){n=c}function j(){var a={},c={};this.registerStickyState=function(a){c[a.name]=a},this.enableDebug=function(a){o=a},this.$get=["$rootScope","$state","$stateParams","$injector","$log",function(c,d,e,f,h){function i(){var c={};return b.forEach(a,function(a){for(var b=j(a),d=0;d<b.length;d++){var e=b[d].parent;c[e.name]=c[e.name]||[],c[e.name].push(a)}c[""]&&(c.__inactives=c[""])}),c}function j(a){var b=[];if(!a)return b;do a.sticky&&b.push(a),a=a.parent;while(a);return b.reverse(),b}function k(a,b,c){if(a[c]===b[c])return{from:!1,to:!1};var d=c<a.length&&a[c].self.sticky,e=c<b.length&&b[c].self.sticky;return{from:d,to:e}}function l(b,c,d){if(d)return"updateStateParams";var e=a[b.self.name];if(!e)return"enter";var f=n(c,e.locals.globals.$stateParams,b.ownParams);return f?"reactivate":"updateStateParams"}function m(b,c){var d=a[b.name];if(!d)return null;if(!c)return d;var e=n(c,d.locals.globals.$stateParams,b.ownParams);return e?d:null}function n(a,b,c){if(!c){c=[];for(var d in a)c.push(d)}for(var e=0;e<c.length;e++){var f=c[e];if(a[f]!=b[f])return!1}return!0}var p={getInactiveStates:function(){var c=[];return b.forEach(a,function(a){c.push(a)}),c},getInactiveStatesByParent:function(){return i()},processTransition:function(a){var c={inactives:[],enter:[],exit:[],keep:0},f=a.fromState.path,h=a.fromParams,j=a.toState.path,m=a.toParams,o=a.options,p=0,q=j[p];for(o.inherit&&(m=g(e,m||{},d.$current,a.toState));q&&q===f[p]&&n(m,h,q.ownParams);)q=j[++p];c.keep=p;var r,t,u,v={},w=k(f,j,p),x=!1;for(r=p;r<j.length;r++){var y=w.to?l(j[r],a.toParams,x):"enter";x=x||"updateStateParams"==y,c.enter[r]=y,"reactivate"==y&&(u=v[j[r].name]=j[r]),"updateStateParams"==y&&(t=j[r])}u=u?u.self.name+".":"",t=t?t.self.name+".":"";var z=i(),A=[""].concat(s(f.slice(0,p),function(a){return a.self.name}));for(b.forEach(A,function(a){for(var b=z[a],d=0;b&&d<b.length;d++){var e=b[d];v[e.name]||u&&0===e.self.name.indexOf(u)||t&&0===e.self.name.indexOf(t)||c.inactives.push(e)}}),r=p;r<f.length;r++){var B="exit";w.from&&(c.inactives.push(f[r]),B="inactivate"),c.exit[r]=B}return c},stateInactivated:function(b){a[b.self.name]=b,b.self.status="inactive",b.self.onInactivate&&f.invoke(b.self.onInactivate,b.self,b.locals.globals)},stateReactivated:function(b){a[b.self.name]&&delete a[b.self.name],b.self.status="entered",b.self.onReactivate&&f.invoke(b.self.onReactivate,b.self,b.locals.globals)},stateExiting:function(c,d,e){var g={};b.forEach(d,function(a){g[a.self.name]=!0}),b.forEach(a,function(d,e){!g[e]&&d.includes[c.name]&&(o&&h.debug("Exiting "+e+" because it's a substate of "+c.name+" and wasn't found in ",g),d.self.onExit&&f.invoke(d.self.onExit,d.self,d.locals.globals),b.forEach(d.locals,function(a,b){delete x.locals[b]}),d.locals=null,d.self.status="exited",delete a[e])}),e&&f.invoke(e,c.self,c.locals.globals),c.locals=null,c.self.status="exited",delete a[c.self.name]},stateEntering:function(a,b,c){var d=m(a);if(d&&!m(a,b)){var e=a.locals;this.stateExiting(d),a.locals=e}a.self.status="entered",c&&f.invoke(c,a.self,a.locals.globals)},reset:function(a,b){var e=d.get(a),f=m(e,b);return f?(p.stateExiting(f),c.$broadcast("$viewContentLoading"),!0):!1}};return p}]}function k(a){return{resolve:{},locals:{globals:v&&v.locals&&v.locals.globals},views:{},self:{},params:{},ownParams:A.hasParamSet?{$$equals:function(){return!0}}:[],surrogateType:a}}function l(a,c,d){function e(a,b,c){return a[b]?a[b].toUpperCase()+": "+c.self.name:"("+c.self.name+")"}var f=s(d.inactives,function(a){return a.self.name}),g=s(c.toState.path,function(a,b){return e(d.enter,b,a)}),h=s(c.fromState.path,function(a,b){return e(d.exit,b,a)}),i=c.fromState.self.name+": "+b.toJson(c.fromParams)+": -> "+c.toState.self.name+": "+b.toJson(c.toParams);a.debug(" Current transition: ",i),a.debug("Before transition, inactives are: : ",s(u.getInactiveStates(),function(a){return a.self.name})),a.debug("After transition, inactives will be: ",f),a.debug("Transition will exit: ",h),a.debug("Transition will enter: ",g)}function m(a,b,c){a.debug("Current state: "+b.self.name+", inactive states: ",s(u.getInactiveStates(),function(a){return a.self.name}));for(var d=function(a,b){return"'"+b+"' ("+a.$$state.name+")"},e=function(a,b){return"globals"!=b&&"resolve"!=b},f=function(a){var b=s(t(a.locals,e),d).join(", ");return"("+(a.self.name?a.self.name:"root")+".locals"+(b.length?": "+b:"")+")"},g=f(b),h=b.parent;h&&h!==b;)""===h.self.name&&(g=f(c.$current.path[0])+" / "+g),g=f(h)+" / "+g,b=h,h=b.parent;a.debug("Views: "+g)}b.module("ct.ui.router.extras",["ui.router"]);var n,o=!1,p=b.forEach,q=b.extend,r=b.isArray,s=function(a,b){"use strict";var c=[];return p(a,function(a,d){c.push(b(a,d))}),c},t=function(a,b){"use strict";var c={};return p(a,function(a,d){b(a,d)&&(c[d]=a)}),c};b.module("ct.ui.router.extras").config(["$provide",function(a){var b;a.decorator("$state",["$delegate","$q",function(a,c){return b=a.transitionTo,a.transitionTo=function(d,e,f){return f.ignoreDsr&&(n=f.ignoreDsr),b.apply(a,arguments).then(function(a){return i(),a},function(a){return i(),c.reject(a)})},a}])}]),b.module("ct.ui.router.extras").service("$deepStateRedirect",["$rootScope","$state","$injector",function(a,d,e){function f(a){var b=a.name;return k.hasOwnProperty(b)?k[b]:void h(b)}function g(a){var c=a.deepStateRedirect;if(!c)return{dsr:!1};var d={dsr:!0};return b.isFunction(c)?d.fn=c:b.isObject(c)&&(d=b.extend(d,c)),d.fn||(d.fn=["$dsr$",function(a){return a.redirect.state!=a.to.state}]),d}function h(a){var b=d.get(a);if(!b)return!1;var e=g(b);e.dsr&&(k[b.name]=l,j[a]===c&&(j[a]={}));var f=b.$$state&&b.$$state().parent;if(f){var i=h(f.self.name);i&&k[b.name]===c&&(k[b.name]=m)}return k[b.name]||!1}function i(a,d){function e(a){return a?a.toString():a}d===!0&&(d=Object.keys(a)),(null===d||d===c)&&(d=[]);var f={};return b.forEach(d.sort(),function(b){f[b]=e(a[b])}),b.toJson(f)}var j={},k={},l="Redirect",m="AncestorRedirect";return a.$on("$stateChangeStart",function(a,b,c){if(!n&&f(b)===l){var h=g(b),k=i(c,h.params),m=j[b.name][k];if(m){var o={redirect:{state:m.state,params:m.params},to:{state:b.name,params:c}},p=e.invoke(h.fn,b,{$dsr$:o});p&&(p.state&&(m=p),a.preventDefault(),d.go(m.state,m.params))}}}),a.$on("$stateChangeSuccess",function(a,c,e){var h=f(c);if(h){var k=c.name;b.forEach(j,function(a,c){var f=g(d.get(c)),h=i(e,f.params);(k==c||-1!=k.indexOf(c+"."))&&(j[c][h]={state:k,params:b.copy(e)})})}}),{reset:function(a){if(a){var c=d.get(a);if(!c)throw new Error("Unknown state: "+a);j[c.name]&&(j[c.name]={})}else b.forEach(j,function(a,b){j[b]={}})}}}]),b.module("ct.ui.router.extras").run(["$deepStateRedirect",function(){}]),j.$inject=["$stateProvider"],b.module("ct.ui.router.extras").provider("$stickyState",j);var u,v,w,x,y={},z=[],A={hasParamSet:!1};b.module("ct.ui.router.extras").run(["$stickyState",function(a){u=a}]),b.module("ct.ui.router.extras").config(["$provide","$stateProvider","$stickyStateProvider","$urlMatcherFactoryProvider",function(a,d,e,f){A.hasParamSet=!!f.ParamSet,x=b.extend(new k("__inactives"),{self:{name:"__inactives"}}),v=w=c,z=[],d.decorator("parent",function(a,b){return y[a.self.name]=a,a.self.$$state=function(){return y[a.self.name]},a.self.sticky===!0&&e.registerStickyState(a.self),b(a)});var g;a.decorator("$state",["$delegate","$log","$q",function(a,d,e){return v=a.$current,y[""]=v,v.parent=x,x.parent=c,v.locals=h(x.locals,v.locals),delete x.locals.globals,g=a.transitionTo,a.transitionTo=function(c,f,h){function i(a){var c=b.extend(new k("reactivate_phase1"),{locals:a.locals});return c.self=b.extend({},a.self),c}function j(a){var c=b.extend(new k("reactivate_phase2"),a),d=c.self.onEnter;return c.resolve={},c.views={},c.self.onEnter=function(){c.locals=a.locals,u.stateReactivated(a)},K.addRestoreFunction(function(){a.self.onEnter=d}),c}function n(a){var b=new k("inactivate");b.self=a.self;var c=a.self.onExit;return b.self.onExit=function(){u.stateInactivated(a)},K.addRestoreFunction(function(){a.self.onExit=c}),b}function p(a,b){var c=a.self.onEnter;return a.self.onEnter=function(){u.stateEntering(a,b,c)},K.addRestoreFunction(function(){a.self.onEnter=c}),a}function q(a){var b=a.self.onExit;return a.self.onExit=function(){u.stateExiting(a,I,b)},K.addRestoreFunction(function(){a.self.onExit=b}),a}x.locals||(x.locals=v.locals);var r=z.length;w&&(w(),o&&d.debug("Restored paths from pending transition"));var t,A,B,C,D=a.$current,E=a.params,F=h&&h.relative||a.$current,G=a.get(c,F),H=[],I=[],J=function(){},K=function(){t&&(L.path=t,t=null),A&&(D.path=A,A=null),b.forEach(K.restoreFunctions,function(a){a()}),K=J,w=null,z.splice(r,1)};if(K.restoreFunctions=[],K.addRestoreFunction=function(a){this.restoreFunctions.push(a)},G){var L=y[G.name];if(L){t=L.path,A=D.path;var M={toState:L,toParams:f||{},fromState:D,fromParams:E||{},options:h};z.push(M),w=K,B=u.processTransition(M),o&&l(d,M,B);var N=L.path.slice(0,B.keep),O=D.path.slice(0,B.keep);b.forEach(x.locals,function(a,b){-1!=b.indexOf("@")&&delete x.locals[b]});for(var P=0;P<B.inactives.length;P++){var Q=B.inactives[P].locals;b.forEach(Q,function(a,b){Q.hasOwnProperty(b)&&-1!=b.indexOf("@")&&(x.locals[b]=a)})}if(b.forEach(B.enter,function(a,b){var c;"reactivate"===a?(c=i(L.path[b]),N.push(c),O.push(c),H.push(j(L.path[b])),C=c):"updateStateParams"===a?(c=p(L.path[b]),N.push(c),C=c):"enter"===a&&N.push(p(L.path[b]))}),b.forEach(B.exit,function(a,b){var c=D.path[b];"inactivate"===a?(O.push(n(c)),I.push(c)):"exit"===a&&(O.push(q(c)),I.push(c))}),H.length&&b.forEach(H,function(a){N.push(a)}),C){var R=C.self.name+".",S=u.getInactiveStates(),T=[];S.forEach(function(a){0===a.self.name.indexOf(R)&&T.push(a)}),T.sort(),T.reverse(),O=O.concat(s(T,function(a){return q(a)})),I=I.concat(T)}L.path=N,D.path=O;var U=function(a){return(a.surrogateType?a.surrogateType+":":"")+a.self.name};o&&d.debug("SurrogateFromPath: ",s(O,U)),o&&d.debug("SurrogateToPath: ",s(N,U))}}var V=g.apply(a,arguments);return V.then(function(b){return K(),o&&m(d,y[b.name],a),b.status="active",b},function(a){return K(),o&&"transition prevented"!==a.message&&"transition aborted"!==a.message&&"transition superseded"!==a.message&&(d.debug("transition failed",a),console.log(a.stack)),e.reject(a)})},a}])}]),b.module("ct.ui.router.extras").provider("$futureState",["$stateProvider","$urlRouterProvider","$urlMatcherFactoryProvider",function(a,c,d){function e(a,c){var d=b.isObject(a)?a.name:a;return c?k[d]:y[d]}function f(a,b){if(b.name){var c=b.name.split(/\./);for("."===b.name.charAt(0)&&(c[0]=a.current.name);c.length;){var d=c.join(".");if(a.get(d,{relative:a.current}))return null;if(k[d])return k[d];c.pop()}}if(b.url){var e=[];for(var f in k)k[f].urlMatcher.exec(b.url)&&e.push(k[f]);for(var g=e.slice(0),h=e.length-1;h>=0;h--)for(var i=0;i<g.length;i++)e[h]===g[i].parentFutureState&&e.splice(h,1);return e[0]}}function g(a,b){var c=a.get("$q");if(!b){var d=c.defer();return d.reject("No lazyState passed in "+b),d.promise}var e=c.when([]),f=b.parentFutureState;f&&k[f.name]&&(e=g(a,k[f.name]));var h=b.type,i=j[h];if(!i)throw Error("No state factory for futureState.type: "+(b&&b.type));return e.then(function(c){var d=a.invoke(i,i,{futureState:b});return d.then(function(a){return a&&c.push(a),c})})["finally"](function(){delete k[b.name]})}function h(b,c){var d=!1,e=["$rootScope","$urlRouter","$state",function(e,h,j){if(!n)return i().then(function(){d=!0,h.sync(),d=!1}),void(n=!0);var k=f(j,{url:c.path()});return k?(l=!0,void g(b,k).then(function(b){b.forEach(function(b){b&&(!j.get(b)||b.name&&!j.get(b.name))&&a.state(b)}),d=!0,h.sync(),d=!1,l=!1},function(){return l=!1,b.invoke(p)})):b.invoke(p)}];if(!l){var h=d?p:e;return b.invoke(h)}}var i,j={},k={},l=!1,m=[],n=!1,o=this;this.addResolve=function(a){m.push(a)},this.stateFactory=function(a,b){j[a]=b},this.futureState=function(a){a.stateName&&(a.name=a.stateName),a.urlPrefix&&(a.url="^"+a.urlPrefix),k[a.name]=a;var c,f=a.name.split(/\./).slice(0,-1).join("."),g=e(a.parent||f);if(g)c=g.navigable.url;else if(""===f)c=d.compile("");else{var h=e(a.parent||f,!0);if(!h)throw new Error("Couldn't determine parent state of future state. FutureState:"+b.toJson(a));var i=h.urlMatcher.source.replace(/\*rest$/,"");c=d.compile(i),a.parentFutureState=h}a.urlMatcher="^"===a.url.charAt(0)?d.compile(a.url.substring(1)+"*rest"):c.concat(a.url+"*rest")},this.get=function(){return b.extend({},k)};var p=["$log","$location",function(a,b){a.debug("Unable to map "+b.path())}];c.otherwise(h),c.otherwise=function(a){if(b.isString(a)){var d=a;a=function(){return d}}else if(!b.isFunction(a))throw new Error("'rule' must be a function");return p=a,c};var q={getResolvePromise:function(){return i()}};this.$get=["$injector","$state","$q","$rootScope","$urlRouter","$timeout","$log",function(c,d,e,h,j,k,n){function p(){if(h.$on("$stateNotFound",function(b,e,h,i){if(!l){n.debug("event, unfoundState, fromState, fromParams",b,e,h,i);var j=f(d,{name:e.to});if(j){b.preventDefault(),l=!0;var k=g(c,j);k.then(function(b){b.forEach(function(b){b&&(!d.get(b)||b.name&&!d.get(b.name))&&a.state(b)}),d.go(e.to,e.toParams),l=!1},function(a){console.log("failed to lazy load state ",a),d.go(h,i),l=!1})}}}),!i){var o=[];b.forEach(m,function(a){o.push(c.invoke(a))}),i=function(){return e.all(o)}}i().then(function(){k(function(){d.transition?d.transition.then(j.sync,j.sync):j.sync()})})}return p(),q.state=a.state,q.futureState=o.futureState,q.get=o.get,q}]}]),b.module("ct.ui.router.extras").run(["$futureState",function(){}]),b.module("ct.ui.router.extras").service("$previousState",["$rootScope","$state",function(a,b){var c=null,d={},e=null;a.$on("$stateChangeStart",function(a,b,d,f,g){e=c,c={state:f,params:g}}),a.$on("$stateChangeError",function(){c=e,e=null}),a.$on("$stateChangeSuccess",function(){e=null});var f={get:function(a){return a?d[a]:c},go:function(a,c){var d=f.get(a);return b.go(d.state,d.params,c)},memo:function(a,e,f){d[a]=c||{state:b.get(e),params:f}},forget:function(a){delete d[a]}};return f}]),b.module("ct.ui.router.extras").run(["$previousState",function(){}]),b.module("ct.ui.router.extras").config(["$provide",function(a){a.decorator("$state",["$delegate","$rootScope","$q","$injector",function(a,c,d,e){function f(a){var c=e.invoke,d=e.instantiate;return e.invoke=function(d,e,f){return c(d,e,b.extend({$transition$:a},f))},e.instantiate=function(c,e){return d(c,b.extend({$transition$:a},e))},function(){e.invoke=c,e.instantiate=d}}function g(){m.pop()(),l.pop(),k--}function h(a,b){return function(d){return g(),c.$broadcast("$transitionSuccess",b),a.resolve(d)}}function i(a,b){return function(d){return g(),c.$broadcast("$transitionError",b,d),a.reject(d)}}var j=a.transitionTo,k=-1,l=[],m=[];return a.transitionTo=function(){var b=d.defer(),c=l[++k]={promise:b.promise};m[k]=function(){};var e=j.apply(a,arguments);return e.then(h(b,c),i(b,c))},c.$on("$stateChangeStart",function(a,d,e,g,h){var i=k,j=b.extend(l[i],{to:{state:d,params:e},from:{state:g,params:h}}),n=f(j);m[i]=n,c.$broadcast("$transitionStart",j)}),a}])}])}(window,window.angular);
|
app/components/compass.js
|
joeyschroeder/speedometer-app
|
import React, { Component } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import PropTypes from 'prop-types';
import { Svg } from 'expo';
import { Variables } from '../assets/styles/variables';
import { convertHeadingToPercent } from '../util/convert-heading-to-percent';
import eases from 'eases';
const styles = StyleSheet.create({
container: {
alignItems: 'center',
justifyContent: 'center',
position: 'relative'
},
circle: { transform: [ { rotate: '-90deg' }] },
directionContainer: { position: 'relative' },
direction: {
backgroundColor: 'transparent',
fontFamily: Variables.fonts.digital.regular,
fontSize: Variables.fontSizes.medium * 2,
lineHeight: Variables.fontSizes.medium * 2,
textAlign: 'center'
},
directionBackground: { opacity: 0.2 },
directionForeground: {
position: 'absolute',
},
valueContainer: {
position: 'absolute',
transform: [{ translateY: -Math.round(Variables.fontSizes.medium * 2 / 2) }]
}
});
export class Compass extends Component {
constructor(props) {
super(props);
this.state = {
currentHeadingPercentage: 0,
previousHeadingPercentage: 0
};
this.renderDirectionValue = this.renderDirectionValue.bind(this);
this.renderSegments = this.renderSegments.bind(this);
this.updateHeadingPercentage = this.updateHeadingPercentage.bind(this);
}
componentWillReceiveProps(nextProps) {
const { currentHeadingPercentage } = this.state;
const { heading } = this.props;
if (nextProps.heading === heading) return;
this.setState({ previousHeadingPercentage: currentHeadingPercentage });
this.startAnimationTime = (new Date()).getTime();
this.updateHeadingPercentage();
}
shouldComponentUpdate(nextState) {
return nextState.currentHeadingPercentage !== this.state.currentHeadingPercentage;
}
componentWillUnmount() {
clearTimeout(this.timeout);
}
updateHeadingPercentage() {
const { ease, speed, heading } = this.props;
const { previousHeadingPercentage } = this.state;
const value = convertHeadingToPercent(heading);
const now = (new Date()).getTime();
const elapsedTime = Math.min(speed, (now - this.startAnimationTime));
const progress = eases[ease](elapsedTime / speed);
const currentDisplayValue = Math.round((value - previousHeadingPercentage) * progress + previousHeadingPercentage);
this.setState({ currentHeadingPercentage: currentDisplayValue });
if (elapsedTime < speed) {
this.timeout = setTimeout(this.updateHeadingPercentage, 16);
} else {
this.setState({ previousHeadingPercentage: value });
}
}
renderDirectionValue() {
const { heading } = this.props;
let result;
switch(true) {
case heading > 0 && heading <= 22.5: result = ' N'; break;
case heading > 22.5 && heading <= 67.5: result = 'NE'; break;
case heading > 67.5 && heading <= 112.5: result = ' E'; break;
case heading > 112.5 && heading <= 157.5: result = 'SE'; break;
case heading > 157.7 && heading <= 202.5: result = ' S'; break;
case heading > 202.5 && heading <= 247.5: result = 'SW'; break;
case heading > 247.5 && heading <= 292.5: result = ' W'; break;
case heading > 292.5 && heading <= 337.5: result = 'NW'; break;
case heading > 337.5 && heading <= 360: result = ' N'; break;
default: result = '--';
}
return result;
}
renderSegments() {
const { color, diameter, strokeWidth, heading } = this.props;
const { currentHeadingPercentage } = this.state;
const radius = diameter / 2;
const radiusAdjusted = radius - (strokeWidth * 2);
const circumfrenceAdjusted = Math.PI * (radiusAdjusted * 2);
const radiusShift = circumfrenceAdjusted / diameter;
const min = currentHeadingPercentage - 10;
const max = currentHeadingPercentage + 10;
const results = [];
for (let index = 0; index < diameter; index++) {
if (!(index % 2)) {
let strokeColor = Variables.colors.white.fade(0.9);
if (heading > -1) {
if (index > min && index < max
|| max - 100 > 0 && (index < max - 100 || index > min)
|| min < 0 && index > diameter + min) {
strokeColor = color;
}
}
results.push(
<Svg.Circle
cx={'50%'}
cy={'50%'}
key={index}
fill={'none'}
r={radiusAdjusted}
stroke={strokeColor.string()}
strokeDasharray={[radiusShift, circumfrenceAdjusted]}
strokeDashoffset={-radiusShift * index}
strokeWidth={strokeWidth}
/>
);
}
}
return results;
}
render() {
const { diameter, style, color } = this.props;
return (
<View style={[styles.container, style]}>
<Svg height={diameter} width={diameter} style={styles.circle}>
{this.renderSegments()}
</Svg>
<Text></Text>
<View style={[styles.valueContainer, { top: diameter / 2 }]}>
<View style={styles.directionContainer}>
<Text style={[styles.direction, styles.directionBackground, { color }]}>88</Text>
<Text style={[styles.direction, styles.directionForeground, { color }]}>{this.renderDirectionValue()}</Text>
</View>
</View>
</View>
);
}
}
Compass.defaultProps = {
color: Variables.colors.secondary,
diameter: 100,
ease: 'quintInOut',
heading: -1, // set to -1 to prevent flash of 0 degrees of ('N') on the compass on load,
speed: 500,
strokeWidth: 9
};
Compass.propTypes = {
color: PropTypes.object,
diameter: PropTypes.number,
ease: PropTypes.string,
heading: PropTypes.number,
speed: PropTypes.number,
strokeWidth: PropTypes.number,
style: PropTypes.oneOfType([ PropTypes.number, PropTypes.object ])
};
|
docs/app/Examples/modules/Rating/Types/index.js
|
vageeshb/Semantic-UI-React
|
import React from 'react'
import ComponentExample from 'docs/app/Components/ComponentDoc/ComponentExample'
import ExampleSection from 'docs/app/Components/ComponentDoc/ExampleSection'
const RatingTypesExamples = () => (
<ExampleSection title='Types'>
<ComponentExample
title='Rating'
description='A basic rating.'
examplePath='modules/Rating/Types/RatingExampleRating'
/>
<ComponentExample
title='Star'
description='A rating can use a set of star icons.'
examplePath='modules/Rating/Types/RatingExampleStar'
/>
<ComponentExample
title='Heart'
description='A rating can use a set of heart icons.'
examplePath='modules/Rating/Types/RatingExampleHeart'
/>
<ComponentExample
title='Clearable'
description='A rating can be cleared by clicking again.'
examplePath='modules/Rating/Types/RatingExampleClearable'
/>
<ComponentExample
title='Disabled'
description='A rating can be disabled.'
examplePath='modules/Rating/Types/RatingExampleDisabled'
/>
<ComponentExample
title='Controlled'
description='A rating can be a controlled component.'
examplePath='modules/Rating/Types/RatingExampleControlled'
/>
<ComponentExample
title='onRate Callback'
description='A rating calls back when the rating changes.'
examplePath='modules/Rating/Types/RatingExampleOnRate'
/>
</ExampleSection>
)
export default RatingTypesExamples
|
src/containers/Asians/TabControls/ParticipantsTeamsDebaters/ExistingTable/index.js
|
westoncolemanl/tabbr-web
|
import React from 'react'
import { connect } from 'react-redux'
import Instance from './Instance'
export default connect(mapStateToProps)(({
teams,
institutionsById
}) => {
teams.sort((a, b) => {
if (a.institution && b.institution) {
if (institutionsById[a.institution].name > institutionsById[b.institution].name) return 1
if (institutionsById[a.institution].name < institutionsById[b.institution].name) return -1
}
if (a.name > b.name) return 1
if (a.name < b.name) return -1
return 0
})
return (
<div>
{teams.map(team =>
<Instance
key={team._id}
team={team}
/>
)}
</div>
)
})
function mapStateToProps (state, ownProps) {
return {
teams: Object.values(state.teams.data),
institutionsById: state.institutions.data
}
}
|
app/packs/src/components/report/Serials.js
|
ComPlat/chemotion_ELN
|
import React from 'react';
import SVG from 'react-inlinesvg';
import { Panel } from 'react-bootstrap';
import Formula from '../common/Formula';
import CommonInput from '../common/CommonInput';
import ReportActions from '../actions/ReportActions';
const Serial = ({ serial, counter }) => {
if (!serial) return null;
const mol = serial.mol;
const oddClass = counter % 2 === 1 ? 'order-even' : null;
const onCompleteEdit = val => ReportActions.updMSVal(mol.id, val);
return (
<Panel eventKey={counter} key={counter} >
<Panel.Body>
<div className="report-serial">
<div className={`order ${oddClass}`}>{counter + 1}</div>
<div className="svg">
<SVG src={mol.svgPath} key={mol.svgPath} />
</div>
<div className="info">
<p><Formula formula={mol.sumFormula} /></p>
<p>{mol.iupacName}</p>
</div>
<div className="input">
<CommonInput
value={serial.value}
key={mol.id}
placeholder="xx"
onCompleteEdit={onCompleteEdit}
/>
</div>
</div>
</Panel.Body>
</Panel>
);
};
const stdSerials = () => (<h5>Not applicable.</h5>);
const suiSerials = (props) => {
const { selMolSerials, template } = props;
const contents = selMolSerials.map((molSer, i) => (
<Serial id={i} key={`ms-${molSer.mol.id}`} serial={molSer} counter={i} />
));
return <div className="report-serials">{contents}</div>;
};
const spcSerials = props => suiSerials(props);
const rxlSerials = props => suiSerials(props);
const Serials = (props) => {
switch (props.template.value) {
case 'standard':
return stdSerials();
case 'spectrum':
return spcSerials(props);
case 'supporting_information':
case 'supporting_information_std_rxn':
return suiSerials(props);
case 'rxn_list_xlsx':
case 'rxn_list_csv':
case 'rxn_list_html':
return rxlSerials(props);
default:
return stdSerials();
}
};
export default Serials;
|
stories/components/socialMedia/index.js
|
tskuse/operationcode_frontend
|
import React from 'react';
import { storiesOf } from '@storybook/react';
import SocialMedia from 'shared/components/socialMedia/socialMedia';
storiesOf('shared/components/socialMedia', module)
.add('Default', () => (
<SocialMedia />
));
|
src/components/Header/CloseIcon.js
|
evandromacedo/evandromacedo.com
|
import React from 'react'
const CloseIcon = () => (
<svg width={24} height={24}>
<title>Close</title>
<path
d="M1.713.294L12 10.58 22.287.294c.362-.362.931-.39 1.325-.084l.094.084c.362.362.39.93.084 1.324l-.084.095L13.42 12l10.287 10.287a1.003 1.003 0 01-1.419 1.42L12 13.418 1.713 23.706c-.362.362-.931.39-1.325.084l-.094-.084a1.004 1.004 0 01-.084-1.324l.084-.095L10.58 12 .294 1.713A1.003 1.003 0 011.713.293z"
fill="currentColor"
fillRule="evenodd"
/>
</svg>
)
export default CloseIcon
|
lib/components/MapView.js
|
pjamrozowicz/react-native-maps
|
import PropTypes from 'prop-types';
import React from 'react';
import {
EdgeInsetsPropType,
Platform,
Animated,
requireNativeComponent,
NativeModules,
ColorPropType,
findNodeHandle,
ViewPropTypes,
View,
} from 'react-native';
import MapMarker from './MapMarker';
import MapPolyline from './MapPolyline';
import MapPolygon from './MapPolygon';
import MapCircle from './MapCircle';
import MapCallout from './MapCallout';
import MapOverlay from './MapOverlay';
import MapUrlTile from './MapUrlTile';
import MapHeatmap from './MapHeatmap';
import MapLocalTile from './MapLocalTile';
import AnimatedRegion from './AnimatedRegion';
import {
contextTypes as childContextTypes,
getAirMapName,
googleMapIsInstalled,
createNotSupportedComponent,
} from './decorateMapComponent';
import * as ProviderConstants from './ProviderConstants';
const MAP_TYPES = {
STANDARD: 'standard',
SATELLITE: 'satellite',
HYBRID: 'hybrid',
TERRAIN: 'terrain',
NONE: 'none',
MUTEDSTANDARD: 'mutedStandard',
};
const GOOGLE_MAPS_ONLY_TYPES = [
MAP_TYPES.TERRAIN,
MAP_TYPES.NONE,
];
const viewConfig = {
uiViewClassName: 'AIR<provider>Map',
validAttributes: {
region: true,
},
};
// if ViewPropTypes is not defined fall back to View.propType (to support RN < 0.44)
const viewPropTypes = ViewPropTypes || View.propTypes;
const propTypes = {
...viewPropTypes,
/**
* When provider is "google", we will use GoogleMaps.
* Any value other than "google" will default to using
* MapKit in iOS or GoogleMaps in android as the map provider.
*/
provider: PropTypes.oneOf([
'google',
]),
/**
* Used to style and layout the `MapView`. See `StyleSheet.js` and
* `ViewStylePropTypes.js` for more info.
*/
style: viewPropTypes.style,
/**
* A json object that describes the style of the map. This is transformed to a string
* and saved in mayStyleString to be sent to android and ios
* https://developers.google.com/maps/documentation/ios-sdk/styling#use_a_string_resource
* https://developers.google.com/maps/documentation/android-api/styling
*/
customMapStyle: PropTypes.array,
/**
* A json string that describes the style of the map
* https://developers.google.com/maps/documentation/ios-sdk/styling#use_a_string_resource
* https://developers.google.com/maps/documentation/android-api/styling
*/
customMapStyleString: PropTypes.string,
/**
* If `true` the app will ask for the user's location.
* Default value is `false`.
*
* **NOTE**: You need to add NSLocationWhenInUseUsageDescription key in
* Info.plist to enable geolocation, otherwise it is going
* to *fail silently*!
*/
showsUserLocation: PropTypes.bool,
/**
* The title of the annotation for current user location. This only works if
* `showsUserLocation` is true.
* There is a default value `My Location` set by MapView.
*
* @platform ios
*/
userLocationAnnotationTitle: PropTypes.string,
/**
* If `false` hide the button to move map to the current user's location.
* Default value is `true`.
*
* @platform android
*/
showsMyLocationButton: PropTypes.bool,
/**
* If `true` the map will focus on the user's location. This only works if
* `showsUserLocation` is true and the user has shared their location.
* Default value is `false`.
*
* @platform ios
*/
followsUserLocation: PropTypes.bool,
/**
* If `false` points of interest won't be displayed on the map.
* Default value is `true`.
*
*/
showsPointsOfInterest: PropTypes.bool,
/**
* If `false` compass won't be displayed on the map.
* Default value is `true`.
*
* @platform ios
*/
showsCompass: PropTypes.bool,
/**
* If `false` the user won't be able to pinch/zoom the map.
* Default value is `true`.
*
*/
zoomEnabled: PropTypes.bool,
/**
*If `false` the user won't be able to zoom the map
* Default value is `true`.
*
*@platform android
*/
zoomControlEnabled: PropTypes.bool,
/**
* If `false` the user won't be able to pinch/rotate the map.
* Default value is `true`.
*
*/
rotateEnabled: PropTypes.bool,
/**
* If `true` the map will be cached to an Image for performance
* Default value is `false`.
*
*/
cacheEnabled: PropTypes.bool,
/**
* If `true` the map will be showing a loading indicator
* Default value is `false`.
*
*/
loadingEnabled: PropTypes.bool,
/**
* Loading background color while generating map cache image or loading the map
* Default color is light gray.
*
*/
loadingBackgroundColor: ColorPropType,
/**
* Loading indicator color while generating map cache image or loading the map
* Default color is gray color for iOS, theme color for Android.
*
*/
loadingIndicatorColor: ColorPropType,
/**
* If `false` the user won't be able to change the map region being displayed.
* Default value is `true`.
*
*/
scrollEnabled: PropTypes.bool,
/**
* If `false` the user won't be able to adjust the camera’s pitch angle.
* Default value is `true`.
*
*/
pitchEnabled: PropTypes.bool,
/**
* If `false` will hide 'Navigate' and 'Open in Maps' buttons on marker press
* Default value is `true`.
*
* @platform android
*/
toolbarEnabled: PropTypes.bool,
/**
* A Boolean indicating whether on marker press the map will move to the pressed marker
* Default value is `true`
*
* @platform android
*/
moveOnMarkerPress: PropTypes.bool,
/**
* A Boolean indicating whether the map shows scale information.
* Default value is `false`
*
*/
showsScale: PropTypes.bool,
/**
* A Boolean indicating whether the map displays extruded building information.
* Default value is `true`.
*/
showsBuildings: PropTypes.bool,
/**
* A Boolean value indicating whether the map displays traffic information.
* Default value is `false`.
*/
showsTraffic: PropTypes.bool,
/**
* A Boolean indicating whether indoor maps should be enabled.
* Default value is `false`
*
* @platform android
*/
showsIndoors: PropTypes.bool,
/**
* A Boolean indicating whether indoor level picker should be enabled.
* Default value is `false`
*
* @platform android
*/
showsIndoorLevelPicker: PropTypes.bool,
/**
* The map type to be displayed.
*
* - standard: standard road map (default)
* - satellite: satellite view
* - hybrid: satellite view with roads and points of interest overlayed
* - terrain: topographic view
* - none: no base map
*/
mapType: PropTypes.oneOf(Object.values(MAP_TYPES)),
/**
* The region to be displayed by the map.
*
* The region is defined by the center coordinates and the span of
* coordinates to display.
*/
region: PropTypes.shape({
/**
* Coordinates for the center of the map.
*/
latitude: PropTypes.number.isRequired,
longitude: PropTypes.number.isRequired,
/**
* Difference between the minimun and the maximum latitude/longitude
* to be displayed.
*/
latitudeDelta: PropTypes.number.isRequired,
longitudeDelta: PropTypes.number.isRequired,
}),
/**
* The initial region to be displayed by the map. Use this prop instead of `region`
* only if you don't want to control the viewport of the map besides the initial region.
*
* Changing this prop after the component has mounted will not result in a region change.
*
* This is similar to the `initialValue` prop of a text input.
*/
initialRegion: PropTypes.shape({
/**
* Coordinates for the center of the map.
*/
latitude: PropTypes.number.isRequired,
longitude: PropTypes.number.isRequired,
/**
* Difference between the minimun and the maximum latitude/longitude
* to be displayed.
*/
latitudeDelta: PropTypes.number.isRequired,
longitudeDelta: PropTypes.number.isRequired,
}),
/**
* A Boolean indicating whether to use liteMode for android
* Default value is `false`
*
* @platform android
*/
liteMode: PropTypes.bool,
/**
* (Google Maps only)
*
* Padding that is used by the Google Map View to position
* the camera, legal labels and buttons
*
*/
mapPadding: EdgeInsetsPropType,
/**
* Maximum size of area that can be displayed.
*
* @platform ios
*/
maxDelta: PropTypes.number,
/**
* Minimum size of area that can be displayed.
*
* @platform ios
*/
minDelta: PropTypes.number,
/**
* Insets for the map's legal label, originally at bottom left of the map.
* See `EdgeInsetsPropType.js` for more information.
*/
legalLabelInsets: EdgeInsetsPropType,
/**
* Callback that is called once the map is fully loaded.
*/
onMapReady: PropTypes.func,
/**
* Callback that is called continuously when the user is dragging the map.
*/
onRegionChange: PropTypes.func,
/**
* Callback that is called once, when the user is done moving the map.
*/
onRegionChangeComplete: PropTypes.func,
/**
* Callback that is called when user taps on the map.
*/
onPress: PropTypes.func,
/**
* Callback that is called when user makes a "long press" somewhere on the map.
*/
onLongPress: PropTypes.func,
/**
* Callback that is called when user makes a "drag" somewhere on the map
*/
onPanDrag: PropTypes.func,
/**
* Callback that is called when a marker on the map is tapped by the user.
*/
onMarkerPress: PropTypes.func,
/**
* Callback that is called when a marker on the map becomes selected. This will be called when
* the callout for that marker is about to be shown.
*
* @platform ios
*/
onMarkerSelect: PropTypes.func,
/**
* Callback that is called when a marker on the map becomes deselected. This will be called when
* the callout for that marker is about to be hidden.
*
* @platform ios
*/
onMarkerDeselect: PropTypes.func,
/**
* Callback that is called when a callout is tapped by the user.
*/
onCalloutPress: PropTypes.func,
/**
* Callback that is called when the user initiates a drag on a marker (if it is draggable)
*/
onMarkerDragStart: PropTypes.func,
/**
* Callback called continuously as a marker is dragged
*/
onMarkerDrag: PropTypes.func,
/**
* Callback that is called when a drag on a marker finishes. This is usually the point you
* will want to setState on the marker's coordinate again
*/
onMarkerDragEnd: PropTypes.func,
/**
* Minimum zoom value for the map, must be between 0 and 20
*/
minZoomLevel: PropTypes.number,
/**
* Maximum zoom value for the map, must be between 0 and 20
*/
maxZoomLevel: PropTypes.number,
};
class MapView extends React.Component {
constructor(props) {
super(props);
this.state = {
isReady: Platform.OS === 'ios',
};
this._onMapReady = this._onMapReady.bind(this);
this._onMarkerPress = this._onMarkerPress.bind(this);
this._onChange = this._onChange.bind(this);
this._onLayout = this._onLayout.bind(this);
}
getChildContext() {
return { provider: this.props.provider };
}
componentWillUpdate(nextProps) {
const a = this.__lastRegion;
const b = nextProps.region;
if (!a || !b) return;
if (
a.latitude !== b.latitude ||
a.longitude !== b.longitude ||
a.latitudeDelta !== b.latitudeDelta ||
a.longitudeDelta !== b.longitudeDelta
) {
this.map.setNativeProps({ region: b });
}
}
componentDidMount() {
const { isReady } = this.state;
if (isReady) {
this._updateStyle();
}
}
_updateStyle() {
const { customMapStyle } = this.props;
this.map.setNativeProps({ customMapStyleString: JSON.stringify(customMapStyle) });
}
_onMapReady() {
const { region, initialRegion, onMapReady } = this.props;
if (region) {
this.map.setNativeProps({ region });
} else if (initialRegion) {
this.map.setNativeProps({ initialRegion });
}
this._updateStyle();
this.setState({ isReady: true }, () => {
if (onMapReady) onMapReady();
});
}
_onLayout(e) {
const { layout } = e.nativeEvent;
if (!layout.width || !layout.height) return;
if (this.state.isReady && !this.__layoutCalled) {
const { region, initialRegion } = this.props;
if (region) {
this.__layoutCalled = true;
this.map.setNativeProps({ region });
} else if (initialRegion) {
this.__layoutCalled = true;
this.map.setNativeProps({ initialRegion });
}
}
if (this.props.onLayout) {
this.props.onLayout(e);
}
}
_onMarkerPress(event) {
if (this.props.onMarkerPress) {
this.props.onMarkerPress(event.nativeEvent);
}
}
_onChange(event) {
this.__lastRegion = event.nativeEvent.region;
if (event.nativeEvent.continuous) {
if (this.props.onRegionChange) {
this.props.onRegionChange(event.nativeEvent.region);
}
} else if (this.props.onRegionChangeComplete) {
this.props.onRegionChangeComplete(event.nativeEvent.region);
}
}
animateToRegion(region, duration) {
this._runCommand('animateToRegion', [region, duration || 500]);
}
animateToCoordinate(latLng, duration) {
this._runCommand('animateToCoordinate', [latLng, duration || 500]);
}
animateToBearing(bearing, duration) {
this._runCommand('animateToBearing', [bearing, duration || 500]);
}
animateToViewingAngle(angle, duration) {
this._runCommand('animateToViewingAngle', [angle, duration || 500]);
}
fitToElements(animated) {
this._runCommand('fitToElements', [animated]);
}
fitToSuppliedMarkers(markers, animated) {
this._runCommand('fitToSuppliedMarkers', [markers, animated]);
}
fitToCoordinates(coordinates = [], options = {}) {
const {
edgePadding = { top: 0, right: 0, bottom: 0, left: 0 },
animated = true,
} = options;
this._runCommand('fitToCoordinates', [coordinates, edgePadding, animated]);
}
setMapBoundaries(northEast, southWest) {
this._runCommand('setMapBoundaries', [northEast, southWest]);
}
/**
* Takes a snapshot of the map and saves it to a picture
* file or returns the image as a base64 encoded string.
*
* @param config Configuration options
* @param [config.width] Width of the rendered map-view (when omitted actual view width is used).
* @param [config.height] Height of the rendered map-view (when omitted actual height is used).
* @param [config.region] Region to render (Only supported on iOS).
* @param [config.format] Encoding format ('png', 'jpg') (default: 'png').
* @param [config.quality] Compression quality (only used for jpg) (default: 1.0).
* @param [config.result] Result format ('file', 'base64') (default: 'file').
*
* @return Promise Promise with either the file-uri or base64 encoded string
*/
takeSnapshot(args) {
// For the time being we support the legacy API on iOS.
// This will be removed in a future release and only the
// new Promise style API shall be supported.
if (Platform.OS === 'ios' && (arguments.length === 4)) {
console.warn('Old takeSnapshot API has been deprecated; will be removed in the near future'); //eslint-disable-line
const width = arguments[0]; // eslint-disable-line
const height = arguments[1]; // eslint-disable-line
const region = arguments[2]; // eslint-disable-line
const callback = arguments[3]; // eslint-disable-line
this._runCommand('takeSnapshot', [
width || 0,
height || 0,
region || {},
'png',
1,
'legacy',
callback,
]);
return undefined;
}
// Sanitize inputs
const config = {
width: args.width || 0,
height: args.height || 0,
region: args.region || {},
format: args.format || 'png',
quality: args.quality || 1.0,
result: args.result || 'file',
};
if ((config.format !== 'png') &&
(config.format !== 'jpg')) throw new Error('Invalid format specified');
if ((config.result !== 'file') &&
(config.result !== 'base64')) throw new Error('Invalid result specified');
// Call native function
if (Platform.OS === 'android') {
return NativeModules.AirMapModule.takeSnapshot(this._getHandle(), config);
} else if (Platform.OS === 'ios') {
return new Promise((resolve, reject) => {
this._runCommand('takeSnapshot', [
config.width,
config.height,
config.region,
config.format,
config.quality,
config.result,
(err, snapshot) => {
if (err) {
reject(err);
} else {
resolve(snapshot);
}
},
]);
});
}
return Promise.reject('takeSnapshot not supported on this platform');
}
/**
* Convert a map coordinate to user-space point
*
* @param coordinate Coordinate
* @param [coordinate.latitude] Latitude
* @param [coordinate.longitude] Longitude
*
* @return Promise Promise with the point ({ x: Number, y: Number })
*/
pointForCoordinate(coordinate) {
if (Platform.OS === 'android') {
return NativeModules.AirMapModule.pointForCoordinate(this._getHandle(), coordinate);
} else if (Platform.OS === 'ios') {
return new Promise((resolve, reject) => {
this._runCommand('pointForCoordinate', [
coordinate,
(err, snapshot) => {
if (err) {
reject(err);
} else {
resolve(snapshot);
}
},
]);
});
}
return Promise.reject('pointForCoordinate not supported on this platform');
}
/**
* Convert a user-space point to a map coordinate
*
* @param point Point
* @param [point.x] X
* @param [point.x] Y
*
* @return Promise Promise with the coordinate ({ latitude: Number, longitude: Number })
*/
coordinateFromPoint(point) {
if (Platform.OS === 'android') {
return NativeModules.AirMapModule.coordinateFromPoint(this._getHandle(), point);
} else if (Platform.OS === 'ios') {
return new Promise((resolve, reject) => {
this._runCommand('coordinateFromPoint', [
point,
(err, snapshot) => {
if (err) {
reject(err);
} else {
resolve(snapshot);
}
},
]);
});
}
return Promise.reject('coordinateFromPoint not supported on this platform');
}
_uiManagerCommand(name) {
return NativeModules.UIManager[getAirMapName(this.props.provider)].Commands[name];
}
_mapManagerCommand(name) {
return NativeModules[`${getAirMapName(this.props.provider)}Manager`][name];
}
_getHandle() {
return findNodeHandle(this.map);
}
_runCommand(name, args) {
switch (Platform.OS) {
case 'android':
NativeModules.UIManager.dispatchViewManagerCommand(
this._getHandle(),
this._uiManagerCommand(name),
args
);
break;
case 'ios':
this._mapManagerCommand(name)(this._getHandle(), ...args);
break;
default:
break;
}
}
render() {
let props;
if (this.state.isReady) {
props = {
region: null,
initialRegion: null,
onMarkerPress: this._onMarkerPress,
onChange: this._onChange,
onMapReady: this._onMapReady,
onLayout: this._onLayout,
...this.props,
};
if (Platform.OS === 'ios' && props.provider === ProviderConstants.PROVIDER_DEFAULT
&& GOOGLE_MAPS_ONLY_TYPES.includes(props.mapType)) {
props.mapType = MAP_TYPES.standard;
}
props.handlePanDrag = !!props.onPanDrag;
} else {
props = {
style: this.props.style,
region: null,
initialRegion: null,
onMarkerPress: this._onMarkerPress,
onChange: this._onChange,
onMapReady: this._onMapReady,
onLayout: this._onLayout,
};
}
if (Platform.OS === 'android' && this.props.liteMode) {
return (
<AIRMapLite
ref={ref => { this.map = ref; }}
{...props}
/>
);
}
const AIRMap = getAirMapComponent(this.props.provider);
return (
<AIRMap
ref={ref => { this.map = ref; }}
{...props}
/>
);
}
}
MapView.propTypes = propTypes;
MapView.viewConfig = viewConfig;
MapView.childContextTypes = childContextTypes;
MapView.MAP_TYPES = MAP_TYPES;
const nativeComponent = Component => requireNativeComponent(Component, MapView, {
nativeOnly: {
onChange: true,
onMapReady: true,
handlePanDrag: true,
},
});
const airMaps = {
default: nativeComponent('AIRMap'),
};
if (Platform.OS === 'android') {
airMaps.google = airMaps.default;
} else {
airMaps.google = googleMapIsInstalled ? nativeComponent('AIRGoogleMap') :
createNotSupportedComponent('react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.'); // eslint-disable-line max-len
}
const getAirMapComponent = provider => airMaps[provider || 'default'];
const AIRMapLite = NativeModules.UIManager.AIRMapLite &&
requireNativeComponent('AIRMapLite', MapView, {
nativeOnly: {
onChange: true,
onMapReady: true,
handlePanDrag: true,
},
});
MapView.Marker = MapMarker;
MapView.Polyline = MapPolyline;
MapView.Polygon = MapPolygon;
MapView.Circle = MapCircle;
MapView.UrlTile = MapUrlTile;
MapView.LocalTile = MapLocalTile;
MapView.Overlay = MapOverlay;
MapView.Callout = MapCallout;
MapView.Heatmap = MapHeatmap;
Object.assign(MapView, ProviderConstants);
MapView.ProviderPropType = PropTypes.oneOf(Object.values(ProviderConstants));
MapView.Animated = Animated.createAnimatedComponent(MapView);
MapView.AnimatedRegion = AnimatedRegion;
module.exports = MapView;
|
admin/client/App/screens/Item/components/FooterBar.js
|
xyzteam2016/keystone
|
import React from 'react';
import blacklist from 'blacklist';
import assign from 'object-assign';
var FooterBar = React.createClass({
propTypes: {
style: React.PropTypes.object,
},
getDefaultProps () {
return {
style: {},
};
},
getInitialState () {
return {
position: 'relative',
width: 'auto',
height: 'auto',
top: 0,
};
},
componentDidMount () {
// Bail in IE8 because React doesn't support the onScroll event in that browser
// Conveniently (!) IE8 doesn't have window.getComputedStyle which we also use here
if (!window.getComputedStyle) return;
var footer = this.refs.footer;
this.windowSize = this.getWindowSize();
var footerStyle = window.getComputedStyle(footer);
this.footerSize = {
x: footer.offsetWidth,
y: footer.offsetHeight + parseInt(footerStyle.marginTop || '0'),
};
window.addEventListener('scroll', this.recalcPosition, false);
window.addEventListener('resize', this.recalcPosition, false);
this.recalcPosition();
},
componentWillUnmount () {
window.removeEventListener('scroll', this.recalcPosition, false);
window.removeEventListener('resize', this.recalcPosition, false);
},
getWindowSize () {
return {
x: window.innerWidth,
y: window.innerHeight,
};
},
recalcPosition () {
var wrapper = this.refs.wrapper;
this.footerSize.x = wrapper.offsetWidth;
var offsetTop = 0;
var offsetEl = wrapper;
while (offsetEl) {
offsetTop += offsetEl.offsetTop;
offsetEl = offsetEl.offsetParent;
}
var maxY = offsetTop + this.footerSize.y;
var viewY = window.scrollY + window.innerHeight;
var newSize = this.getWindowSize();
var sizeChanged = (newSize.x !== this.windowSize.x || newSize.y !== this.windowSize.y);
this.windowSize = newSize;
var newState = {
width: this.footerSize.x,
height: this.footerSize.y,
};
if (viewY > maxY && (sizeChanged || this.mode !== 'inline')) {
this.mode = 'inline';
newState.top = 0;
newState.position = 'absolute';
this.setState(newState);
} else if (viewY <= maxY && (sizeChanged || this.mode !== 'fixed')) {
this.mode = 'fixed';
newState.top = window.innerHeight - this.footerSize.y;
newState.position = 'fixed';
this.setState(newState);
}
},
render () {
var wrapperStyle = {
height: this.state.height,
marginTop: 60,
position: 'relative',
};
var footerProps = blacklist(this.props, 'children', 'style');
var footerStyle = assign({}, this.props.style, {
position: this.state.position,
top: this.state.top,
width: this.state.width,
height: this.state.height,
});
return (
<div ref="wrapper" style={wrapperStyle}>
<div ref="footer" style={footerStyle} {...footerProps}>{this.props.children}</div>
</div>
);
},
});
module.exports = FooterBar;
|
client/src/SearchResults.js
|
chi-bumblebees-2017/gnomad
|
import React, { Component } from 'react';
import UserListItemContainer from './UserListItemContainer'
class SearchResults extends Component {
render() {
if (this.props.results.length === 0) {
return (
<div className="search-results ui comments container">
<p className="margin-none">No localhosts found that</p>
<p className="margin-none">share your interests...</p>
</div>
);
} else {
return (
<div className="ui centered container search-results ui comments top-margin-10">
<ul className="max-width left-pad-0">
{this.props.results.map((localhost) =>
<UserListItemContainer key={localhost.id} user={localhost} snippet={localhost.bio} linkto={`/users/${localhost.first_name}/${localhost.id}`} />
)}
</ul>
</div>
);
}
}
}
export default SearchResults;
|
src/components/Resume/EducationsPage.js
|
angeloocana/angeloocana
|
import React from 'react';
import PropTypes from 'prop-types';
import ResumeContainer from './ResumeContainer';
import Educations from './Educations';
const EducationsPage = (props) => {
const { educations, menu } = props.data.site.siteMetadata.resume;
const { langKey } = props.pathContext;
return (
<ResumeContainer
menu={menu}
selectedPage="/resume/education/"
>
<Educations
educations={educations}
langKey={langKey}
/>
</ResumeContainer>
);
};
EducationsPage.propTypes = {
data: PropTypes.object.isRequired,
pathContext: PropTypes.object.isRequired
};
export default EducationsPage;
|
packages/babel-core/test/fixtures/transformation/optimisation.react.constant-elements/inline-elements/expected.js
|
jeffmo/babel
|
var _typeofReactElement = typeof Symbol === "function" && Symbol.for && Symbol.for("react.element") || 0xeac7;
var _ref = {
$$typeof: _typeofReactElement,
type: "foo",
key: null,
ref: null,
props: {},
_owner: null
};
function render() {
return _ref;
}
function render() {
var text = getText();
var _ref2 = {
$$typeof: _typeofReactElement,
type: "foo",
key: null,
ref: null,
props: {
children: text
},
_owner: null
};
return function () {
return _ref2;
};
}
|
files/rxjs/2.3.7/rx.js
|
anilanar/jsdelivr
|
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
;(function (undefined) {
var objectTypes = {
'boolean': false,
'function': true,
'object': true,
'number': false,
'string': false,
'undefined': false
};
var root = (objectTypes[typeof window] && window) || this,
freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports,
freeModule = objectTypes[typeof module] && module && !module.nodeType && module,
moduleExports = freeModule && freeModule.exports === freeExports && freeExports,
freeGlobal = objectTypes[typeof global] && global;
if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) {
root = freeGlobal;
}
var Rx = {
internals: {},
config: {
Promise: root.Promise // Detect if promise exists
},
helpers: { }
};
// Defaults
var noop = Rx.helpers.noop = function () { },
notDefined = Rx.helpers.notDefined = function (x) { return typeof x === 'undefined'; },
isScheduler = Rx.helpers.isScheduler = function (x) { return x instanceof Rx.Scheduler; },
identity = Rx.helpers.identity = function (x) { return x; },
pluck = Rx.helpers.pluck = function (property) { return function (x) { return x[property]; }; },
just = Rx.helpers.just = function (value) { return function () { return value; }; },
defaultNow = Rx.helpers.defaultNow = Date.now,
defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); },
defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); },
defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); },
defaultError = Rx.helpers.defaultError = function (err) { throw err; },
isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.then === 'function'; },
asArray = Rx.helpers.asArray = function () { return Array.prototype.slice.call(arguments); },
not = Rx.helpers.not = function (a) { return !a; };
// Errors
var sequenceContainsNoElements = 'Sequence contains no elements.';
var argumentOutOfRange = 'Argument out of range';
var objectDisposed = 'Object has been disposed';
function checkDisposed() { if (this.isDisposed) { throw new Error(objectDisposed); } }
// Shim in iterator support
var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) ||
'_es6shim_iterator_';
// Bug for mozilla version
if (root.Set && typeof new root.Set()['@@iterator'] === 'function') {
$iterator$ = '@@iterator';
}
var doneEnumerator = { done: true, value: undefined };
/** `Object#toString` result shortcuts */
var argsClass = '[object Arguments]',
arrayClass = '[object Array]',
boolClass = '[object Boolean]',
dateClass = '[object Date]',
errorClass = '[object Error]',
funcClass = '[object Function]',
numberClass = '[object Number]',
objectClass = '[object Object]',
regexpClass = '[object RegExp]',
stringClass = '[object String]';
var toString = Object.prototype.toString,
hasOwnProperty = Object.prototype.hasOwnProperty,
supportsArgsClass = toString.call(arguments) == argsClass, // For less <IE9 && FF<4
suportNodeClass,
errorProto = Error.prototype,
objectProto = Object.prototype,
propertyIsEnumerable = objectProto.propertyIsEnumerable;
try {
suportNodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + ''));
} catch(e) {
suportNodeClass = true;
}
var shadowedProps = [
'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf'
];
var nonEnumProps = {};
nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true };
nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true };
nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true };
nonEnumProps[objectClass] = { 'constructor': true };
var support = {};
(function () {
var ctor = function() { this.x = 1; },
props = [];
ctor.prototype = { 'valueOf': 1, 'y': 1 };
for (var key in new ctor) { props.push(key); }
for (key in arguments) { }
// Detect if `name` or `message` properties of `Error.prototype` are enumerable by default.
support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name');
// Detect if `prototype` properties are enumerable by default.
support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype');
// Detect if `arguments` object indexes are non-enumerable
support.nonEnumArgs = key != 0;
// Detect if properties shadowing those on `Object.prototype` are non-enumerable.
support.nonEnumShadows = !/valueOf/.test(props);
}(1));
function isObject(value) {
// check if the value is the ECMAScript language type of Object
// http://es5.github.io/#x8
// and avoid a V8 bug
// https://code.google.com/p/v8/issues/detail?id=2291
var type = typeof value;
return value && (type == 'function' || type == 'object') || false;
}
function keysIn(object) {
var result = [];
if (!isObject(object)) {
return result;
}
if (support.nonEnumArgs && object.length && isArguments(object)) {
object = slice.call(object);
}
var skipProto = support.enumPrototypes && typeof object == 'function',
skipErrorProps = support.enumErrorProps && (object === errorProto || object instanceof Error);
for (var key in object) {
if (!(skipProto && key == 'prototype') &&
!(skipErrorProps && (key == 'message' || key == 'name'))) {
result.push(key);
}
}
if (support.nonEnumShadows && object !== objectProto) {
var ctor = object.constructor,
index = -1,
length = shadowedProps.length;
if (object === (ctor && ctor.prototype)) {
var className = object === stringProto ? stringClass : object === errorProto ? errorClass : toString.call(object),
nonEnum = nonEnumProps[className];
}
while (++index < length) {
key = shadowedProps[index];
if (!(nonEnum && nonEnum[key]) && hasOwnProperty.call(object, key)) {
result.push(key);
}
}
}
return result;
}
function internalFor(object, callback, keysFunc) {
var index = -1,
props = keysFunc(object),
length = props.length;
while (++index < length) {
var key = props[index];
if (callback(object[key], key, object) === false) {
break;
}
}
return object;
}
function internalForIn(object, callback) {
return internalFor(object, callback, keysIn);
}
function isNode(value) {
// IE < 9 presents DOM nodes as `Object` objects except they have `toString`
// methods that are `typeof` "string" and still can coerce nodes to strings
return typeof value.toString != 'function' && typeof (value + '') == 'string';
}
function isArguments(value) {
return (value && typeof value == 'object') ? toString.call(value) == argsClass : false;
}
// fallback for browsers that can't detect `arguments` objects by [[Class]]
if (!supportsArgsClass) {
isArguments = function(value) {
return (value && typeof value == 'object') ? hasOwnProperty.call(value, 'callee') : false;
};
}
function isFunction(value) {
return typeof value == 'function' || false;
}
// fallback for older versions of Chrome and Safari
if (isFunction(/x/)) {
isFunction = function(value) {
return typeof value == 'function' && toString.call(value) == funcClass;
};
}
var isEqual = Rx.internals.isEqual = function (x, y) {
return deepEquals(x, y, [], []);
};
/** @private
* Used for deep comparison
**/
function deepEquals(a, b, stackA, stackB) {
// exit early for identical values
if (a === b) {
// treat `+0` vs. `-0` as not equal
return a !== 0 || (1 / a == 1 / b);
}
var type = typeof a,
otherType = typeof b;
// exit early for unlike primitive values
if (a === a && (a == null || b == null ||
(type != 'function' && type != 'object' && otherType != 'function' && otherType != 'object'))) {
return false;
}
// compare [[Class]] names
var className = toString.call(a),
otherClass = toString.call(b);
if (className == argsClass) {
className = objectClass;
}
if (otherClass == argsClass) {
otherClass = objectClass;
}
if (className != otherClass) {
return false;
}
switch (className) {
case boolClass:
case dateClass:
// coerce dates and booleans to numbers, dates to milliseconds and booleans
// to `1` or `0` treating invalid dates coerced to `NaN` as not equal
return +a == +b;
case numberClass:
// treat `NaN` vs. `NaN` as equal
return (a != +a)
? b != +b
// but treat `-0` vs. `+0` as not equal
: (a == 0 ? (1 / a == 1 / b) : a == +b);
case regexpClass:
case stringClass:
// coerce regexes to strings (http://es5.github.io/#x15.10.6.4)
// treat string primitives and their corresponding object instances as equal
return a == String(b);
}
var isArr = className == arrayClass;
if (!isArr) {
// exit for functions and DOM nodes
if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) {
return false;
}
// in older versions of Opera, `arguments` objects have `Array` constructors
var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor,
ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor;
// non `Object` object instances with different constructors are not equal
if (ctorA != ctorB &&
!(hasOwnProperty.call(a, 'constructor') && hasOwnProperty.call(b, 'constructor')) &&
!(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) &&
('constructor' in a && 'constructor' in b)
) {
return false;
}
}
// assume cyclic structures are equal
// the algorithm for detecting cyclic structures is adapted from ES 5.1
// section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3)
var initedStack = !stackA;
stackA || (stackA = []);
stackB || (stackB = []);
var length = stackA.length;
while (length--) {
if (stackA[length] == a) {
return stackB[length] == b;
}
}
var size = 0;
result = true;
// add `a` and `b` to the stack of traversed objects
stackA.push(a);
stackB.push(b);
// recursively compare objects and arrays (susceptible to call stack limits)
if (isArr) {
// compare lengths to determine if a deep comparison is necessary
length = a.length;
size = b.length;
result = size == length;
if (result) {
// deep compare the contents, ignoring non-numeric properties
while (size--) {
var index = length,
value = b[size];
if (!(result = deepEquals(a[size], value, stackA, stackB))) {
break;
}
}
}
}
else {
// deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys`
// which, in this case, is more costly
internalForIn(b, function(value, key, b) {
if (hasOwnProperty.call(b, key)) {
// count the number of properties.
size++;
// deep compare each property value.
return (result = hasOwnProperty.call(a, key) && deepEquals(a[key], value, stackA, stackB));
}
});
if (result) {
// ensure both objects have the same number of properties
internalForIn(a, function(value, key, a) {
if (hasOwnProperty.call(a, key)) {
// `size` will be `-1` if `a` has more properties than `b`
return (result = --size > -1);
}
});
}
}
stackA.pop();
stackB.pop();
return result;
}
var slice = Array.prototype.slice;
function argsOrArray(args, idx) {
return args.length === 1 && Array.isArray(args[idx]) ?
args[idx] :
slice.call(args);
}
var hasProp = {}.hasOwnProperty;
/** @private */
var inherits = this.inherits = Rx.internals.inherits = function (child, parent) {
function __() { this.constructor = child; }
__.prototype = parent.prototype;
child.prototype = new __();
};
/** @private */
var addProperties = Rx.internals.addProperties = function (obj) {
var sources = slice.call(arguments, 1);
for (var i = 0, len = sources.length; i < len; i++) {
var source = sources[i];
for (var prop in source) {
obj[prop] = source[prop];
}
}
};
// Rx Utils
var addRef = Rx.internals.addRef = function (xs, r) {
return new AnonymousObservable(function (observer) {
return new CompositeDisposable(r.getDisposable(), xs.subscribe(observer));
});
};
// Collection polyfills
function arrayInitialize(count, factory) {
var a = new Array(count);
for (var i = 0; i < count; i++) {
a[i] = factory();
}
return a;
}
// Collections
var IndexedItem = function (id, value) {
this.id = id;
this.value = value;
};
IndexedItem.prototype.compareTo = function (other) {
var c = this.value.compareTo(other.value);
if (c === 0) {
c = this.id - other.id;
}
return c;
};
// Priority Queue for Scheduling
var PriorityQueue = Rx.internals.PriorityQueue = function (capacity) {
this.items = new Array(capacity);
this.length = 0;
};
var priorityProto = PriorityQueue.prototype;
priorityProto.isHigherPriority = function (left, right) {
return this.items[left].compareTo(this.items[right]) < 0;
};
priorityProto.percolate = function (index) {
if (index >= this.length || index < 0) {
return;
}
var parent = index - 1 >> 1;
if (parent < 0 || parent === index) {
return;
}
if (this.isHigherPriority(index, parent)) {
var temp = this.items[index];
this.items[index] = this.items[parent];
this.items[parent] = temp;
this.percolate(parent);
}
};
priorityProto.heapify = function (index) {
if (index === undefined) {
index = 0;
}
if (index >= this.length || index < 0) {
return;
}
var left = 2 * index + 1,
right = 2 * index + 2,
first = index;
if (left < this.length && this.isHigherPriority(left, first)) {
first = left;
}
if (right < this.length && this.isHigherPriority(right, first)) {
first = right;
}
if (first !== index) {
var temp = this.items[index];
this.items[index] = this.items[first];
this.items[first] = temp;
this.heapify(first);
}
};
priorityProto.peek = function () { return this.items[0].value; };
priorityProto.removeAt = function (index) {
this.items[index] = this.items[--this.length];
delete this.items[this.length];
this.heapify();
};
priorityProto.dequeue = function () {
var result = this.peek();
this.removeAt(0);
return result;
};
priorityProto.enqueue = function (item) {
var index = this.length++;
this.items[index] = new IndexedItem(PriorityQueue.count++, item);
this.percolate(index);
};
priorityProto.remove = function (item) {
for (var i = 0; i < this.length; i++) {
if (this.items[i].value === item) {
this.removeAt(i);
return true;
}
}
return false;
};
PriorityQueue.count = 0;
/**
* Represents a group of disposable resources that are disposed together.
* @constructor
*/
var CompositeDisposable = Rx.CompositeDisposable = function () {
this.disposables = argsOrArray(arguments, 0);
this.isDisposed = false;
this.length = this.disposables.length;
};
var CompositeDisposablePrototype = CompositeDisposable.prototype;
/**
* Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.
* @param {Mixed} item Disposable to add.
*/
CompositeDisposablePrototype.add = function (item) {
if (this.isDisposed) {
item.dispose();
} else {
this.disposables.push(item);
this.length++;
}
};
/**
* Removes and disposes the first occurrence of a disposable from the CompositeDisposable.
* @param {Mixed} item Disposable to remove.
* @returns {Boolean} true if found; false otherwise.
*/
CompositeDisposablePrototype.remove = function (item) {
var shouldDispose = false;
if (!this.isDisposed) {
var idx = this.disposables.indexOf(item);
if (idx !== -1) {
shouldDispose = true;
this.disposables.splice(idx, 1);
this.length--;
item.dispose();
}
}
return shouldDispose;
};
/**
* Disposes all disposables in the group and removes them from the group.
*/
CompositeDisposablePrototype.dispose = function () {
if (!this.isDisposed) {
this.isDisposed = true;
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
}
};
/**
* Removes and disposes all disposables from the CompositeDisposable, but does not dispose the CompositeDisposable.
*/
CompositeDisposablePrototype.clear = function () {
var currentDisposables = this.disposables.slice(0);
this.disposables = [];
this.length = 0;
for (var i = 0, len = currentDisposables.length; i < len; i++) {
currentDisposables[i].dispose();
}
};
/**
* Determines whether the CompositeDisposable contains a specific disposable.
* @param {Mixed} item Disposable to search for.
* @returns {Boolean} true if the disposable was found; otherwise, false.
*/
CompositeDisposablePrototype.contains = function (item) {
return this.disposables.indexOf(item) !== -1;
};
/**
* Converts the existing CompositeDisposable to an array of disposables
* @returns {Array} An array of disposable objects.
*/
CompositeDisposablePrototype.toArray = function () {
return this.disposables.slice(0);
};
/**
* Provides a set of static methods for creating Disposables.
*
* @constructor
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
*/
var Disposable = Rx.Disposable = function (action) {
this.isDisposed = false;
this.action = action || noop;
};
/** Performs the task of cleaning up resources. */
Disposable.prototype.dispose = function () {
if (!this.isDisposed) {
this.action();
this.isDisposed = true;
}
};
/**
* Creates a disposable object that invokes the specified action when disposed.
* @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once.
* @return {Disposable} The disposable object that runs the given action upon disposal.
*/
var disposableCreate = Disposable.create = function (action) { return new Disposable(action); };
/**
* Gets the disposable that does nothing when disposed.
*/
var disposableEmpty = Disposable.empty = { dispose: noop };
var BooleanDisposable = (function () {
function BooleanDisposable (isSingle) {
this.isSingle = isSingle;
this.isDisposed = false;
this.current = null;
}
var booleanDisposablePrototype = BooleanDisposable.prototype;
/**
* Gets the underlying disposable.
* @return The underlying disposable.
*/
booleanDisposablePrototype.getDisposable = function () {
return this.current;
};
/**
* Sets the underlying disposable.
* @param {Disposable} value The new underlying disposable.
*/
booleanDisposablePrototype.setDisposable = function (value) {
if (this.current && this.isSingle) {
throw new Error('Disposable has already been assigned');
}
var shouldDispose = this.isDisposed, old;
if (!shouldDispose) {
old = this.current;
this.current = value;
}
old && old.dispose();
shouldDispose && value && value.dispose();
};
/**
* Disposes the underlying disposable as well as all future replacements.
*/
booleanDisposablePrototype.dispose = function () {
var old;
if (!this.isDisposed) {
this.isDisposed = true;
old = this.current;
this.current = null;
}
old && old.dispose();
};
return BooleanDisposable;
}());
/**
* Represents a disposable resource which only allows a single assignment of its underlying disposable resource.
* If an underlying disposable resource has already been set, future attempts to set the underlying disposable resource will throw an Error.
*/
var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = (function (super_) {
inherits(SingleAssignmentDisposable, super_);
function SingleAssignmentDisposable() {
super_.call(this, true);
}
return SingleAssignmentDisposable;
}(BooleanDisposable));
/**
* Represents a disposable resource whose underlying disposable resource can be replaced by another disposable resource, causing automatic disposal of the previous underlying disposable resource.
*/
var SerialDisposable = Rx.SerialDisposable = (function (super_) {
inherits(SerialDisposable, super_);
function SerialDisposable() {
super_.call(this, false);
}
return SerialDisposable;
}(BooleanDisposable));
/**
* Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed.
*/
var RefCountDisposable = Rx.RefCountDisposable = (function () {
function InnerDisposable(disposable) {
this.disposable = disposable;
this.disposable.count++;
this.isInnerDisposed = false;
}
InnerDisposable.prototype.dispose = function () {
if (!this.disposable.isDisposed) {
if (!this.isInnerDisposed) {
this.isInnerDisposed = true;
this.disposable.count--;
if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) {
this.disposable.isDisposed = true;
this.disposable.underlyingDisposable.dispose();
}
}
}
};
/**
* Initializes a new instance of the RefCountDisposable with the specified disposable.
* @constructor
* @param {Disposable} disposable Underlying disposable.
*/
function RefCountDisposable(disposable) {
this.underlyingDisposable = disposable;
this.isDisposed = false;
this.isPrimaryDisposed = false;
this.count = 0;
}
/**
* Disposes the underlying disposable only when all dependent disposables have been disposed
*/
RefCountDisposable.prototype.dispose = function () {
if (!this.isDisposed) {
if (!this.isPrimaryDisposed) {
this.isPrimaryDisposed = true;
if (this.count === 0) {
this.isDisposed = true;
this.underlyingDisposable.dispose();
}
}
}
};
/**
* Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable.
* @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime.
*/
RefCountDisposable.prototype.getDisposable = function () {
return this.isDisposed ? disposableEmpty : new InnerDisposable(this);
};
return RefCountDisposable;
})();
function ScheduledDisposable(scheduler, disposable) {
this.scheduler = scheduler;
this.disposable = disposable;
this.isDisposed = false;
}
ScheduledDisposable.prototype.dispose = function () {
var parent = this;
this.scheduler.schedule(function () {
if (!parent.isDisposed) {
parent.isDisposed = true;
parent.disposable.dispose();
}
});
};
var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) {
this.scheduler = scheduler;
this.state = state;
this.action = action;
this.dueTime = dueTime;
this.comparer = comparer || defaultSubComparer;
this.disposable = new SingleAssignmentDisposable();
}
ScheduledItem.prototype.invoke = function () {
this.disposable.setDisposable(this.invokeCore());
};
ScheduledItem.prototype.compareTo = function (other) {
return this.comparer(this.dueTime, other.dueTime);
};
ScheduledItem.prototype.isCancelled = function () {
return this.disposable.isDisposed;
};
ScheduledItem.prototype.invokeCore = function () {
return this.action(this.scheduler, this.state);
};
/** Provides a set of static properties to access commonly used schedulers. */
var Scheduler = Rx.Scheduler = (function () {
function Scheduler(now, schedule, scheduleRelative, scheduleAbsolute) {
this.now = now;
this._schedule = schedule;
this._scheduleRelative = scheduleRelative;
this._scheduleAbsolute = scheduleAbsolute;
}
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeAction(scheduler, action) {
action();
return disposableEmpty;
}
var schedulerProto = Scheduler.prototype;
/**
* Schedules an action to be executed.
* @param {Function} action Action to execute.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.schedule = function (action) {
return this._schedule(action, invokeAction);
};
/**
* Schedules an action to be executed.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithState = function (state, action) {
return this._schedule(state, action);
};
/**
* Schedules an action to be executed after the specified relative due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelative = function (dueTime, action) {
return this._scheduleRelative(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed after dueTime.
* @param state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number} dueTime Relative time after which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative(state, dueTime, action);
};
/**
* Schedules an action to be executed at the specified absolute due time.
* @param {Function} action Action to execute.
* @param {Number} dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsolute = function (dueTime, action) {
return this._scheduleAbsolute(action, dueTime, invokeAction);
};
/**
* Schedules an action to be executed at dueTime.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to be executed.
* @param {Number}dueTime Absolute time at which to execute the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute(state, dueTime, action);
};
/** Gets the current time according to the local machine's system clock. */
Scheduler.now = defaultNow;
/**
* Normalizes the specified TimeSpan value to a positive value.
* @param {Number} timeSpan The time span value to normalize.
* @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0
*/
Scheduler.normalize = function (timeSpan) {
timeSpan < 0 && (timeSpan = 0);
return timeSpan;
};
return Scheduler;
}());
var normalizeTime = Scheduler.normalize;
(function (schedulerProto) {
function invokeRecImmediate(scheduler, pair) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2) {
var isAdded = false, isDone = false,
d = scheduler.scheduleWithState(state2, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function invokeRecDate(scheduler, pair, method) {
var state = pair.first, action = pair.second, group = new CompositeDisposable(),
recursiveAction = function (state1) {
action(state1, function (state2, dueTime1) {
var isAdded = false, isDone = false,
d = scheduler[method].call(scheduler, state2, dueTime1, function (scheduler1, state3) {
if (isAdded) {
group.remove(d);
} else {
isDone = true;
}
recursiveAction(state3);
return disposableEmpty;
});
if (!isDone) {
group.add(d);
isAdded = true;
}
});
};
recursiveAction(state);
return group;
}
function scheduleInnerRecursive(action, self) {
action(function(dt) { self(action, dt); });
}
/**
* Schedules an action to be executed recursively.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursive = function (action) {
return this.scheduleRecursiveWithState(action, function (_action, self) {
_action(function () { self(_action); }); });
};
/**
* Schedules an action to be executed recursively.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in recursive invocation state.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithState = function (state, action) {
return this.scheduleWithState({ first: state, second: action }, invokeRecImmediate);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified relative time.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelative = function (dueTime, action) {
return this.scheduleRecursiveWithRelativeAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively after a specified relative due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Relative time after which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithRelativeAndState = function (state, dueTime, action) {
return this._scheduleRelative({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithRelativeAndState');
});
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Function} action Action to execute recursively. The parameter passed to the action is used to trigger recursive scheduling of the action at the specified absolute time.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsolute = function (dueTime, action) {
return this.scheduleRecursiveWithAbsoluteAndState(action, dueTime, scheduleInnerRecursive);
};
/**
* Schedules an action to be executed recursively at a specified absolute due time.
* @param {Mixed} state State passed to the action to be executed.
* @param {Function} action Action to execute recursively. The last parameter passed to the action is used to trigger recursive scheduling of the action, passing in the recursive due time and invocation state.
* @param {Number}dueTime Absolute time at which to execute the action for the first time.
* @returns {Disposable} The disposable object used to cancel the scheduled action (best effort).
*/
schedulerProto.scheduleRecursiveWithAbsoluteAndState = function (state, dueTime, action) {
return this._scheduleAbsolute({ first: state, second: action }, dueTime, function (s, p) {
return invokeRecDate(s, p, 'scheduleWithAbsoluteAndState');
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodic = function (period, action) {
return this.schedulePeriodicWithState(null, period, action);
};
/**
* Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. The periodic task will be scheduled using window.setInterval for the base implementation.
* @param {Mixed} state Initial state passed to the action upon the first iteration.
* @param {Number} period Period for running the work periodically.
* @param {Function} action Action to be executed, potentially updating the state.
* @returns {Disposable} The disposable object used to cancel the scheduled recurring action (best effort).
*/
Scheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var s = state;
var id = setInterval(function () {
s = action(s);
}, period);
return disposableCreate(function () {
clearInterval(id);
});
};
}(Scheduler.prototype));
(function (schedulerProto) {
/**
* Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
* @param {Function} handler Handler that's run if an exception is caught. The exception will be rethrown if the handler returns false.
* @returns {Scheduler} Wrapper around the original scheduler, enforcing exception handling.
*/
schedulerProto.catchError = schedulerProto['catch'] = function (handler) {
return new CatchScheduler(this, handler);
};
}(Scheduler.prototype));
var SchedulePeriodicRecursive = Rx.internals.SchedulePeriodicRecursive = (function () {
function tick(command, recurse) {
recurse(0, this._period);
try {
this._state = this._action(this._state);
} catch (e) {
this._cancel.dispose();
throw e;
}
}
function SchedulePeriodicRecursive(scheduler, state, period, action) {
this._scheduler = scheduler;
this._state = state;
this._period = period;
this._action = action;
}
SchedulePeriodicRecursive.prototype.start = function () {
var d = new SingleAssignmentDisposable();
this._cancel = d;
d.setDisposable(this._scheduler.scheduleRecursiveWithRelativeAndState(0, this._period, tick.bind(this)));
return d;
};
return SchedulePeriodicRecursive;
}());
/**
* Gets a scheduler that schedules work immediately on the current thread.
*/
var immediateScheduler = Scheduler.immediate = (function () {
function scheduleNow(state, action) { return action(this, state); }
function scheduleRelative(state, dueTime, action) {
var dt = normalizeTime(dt);
while (dt - this.now() > 0) { }
return action(this, state);
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}());
/**
* Gets a scheduler that schedules work as soon as possible on the current thread.
*/
var currentThreadScheduler = Scheduler.currentThread = (function () {
var queue;
function runTrampoline (q) {
var item;
while (q.length > 0) {
item = q.dequeue();
if (!item.isCancelled()) {
// Note, do not schedule blocking work!
while (item.dueTime - Scheduler.now() > 0) {
}
if (!item.isCancelled()) {
item.invoke();
}
}
}
}
function scheduleNow(state, action) {
return this.scheduleWithRelativeAndState(state, 0, action);
}
function scheduleRelative(state, dueTime, action) {
var dt = this.now() + Scheduler.normalize(dueTime),
si = new ScheduledItem(this, state, action, dt);
if (!queue) {
queue = new PriorityQueue(4);
queue.enqueue(si);
try {
runTrampoline(queue);
} catch (e) {
throw e;
} finally {
queue = null;
}
} else {
queue.enqueue(si);
}
return si.disposable;
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
var currentScheduler = new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
currentScheduler.scheduleRequired = function () { return !queue; };
currentScheduler.ensureTrampoline = function (action) {
if (!queue) { this.schedule(action); } else { action(); }
};
return currentScheduler;
}());
var scheduleMethod, clearMethod = noop;
(function () {
var reNative = RegExp('^' +
String(toString)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
.replace(/toString| for [^\]]+/g, '.*?') + '$'
);
var setImmediate = typeof (setImmediate = freeGlobal && moduleExports && freeGlobal.setImmediate) == 'function' &&
!reNative.test(setImmediate) && setImmediate,
clearImmediate = typeof (clearImmediate = freeGlobal && moduleExports && freeGlobal.clearImmediate) == 'function' &&
!reNative.test(clearImmediate) && clearImmediate;
function postMessageSupported () {
// Ensure not in a worker
if (!root.postMessage || root.importScripts) { return false; }
var isAsync = false,
oldHandler = root.onmessage;
// Test for async
root.onmessage = function () { isAsync = true; };
root.postMessage('','*');
root.onmessage = oldHandler;
return isAsync;
}
// Use in order, nextTick, setImmediate, postMessage, MessageChannel, script readystatechanged, setTimeout
if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') {
scheduleMethod = process.nextTick;
} else if (typeof setImmediate === 'function') {
scheduleMethod = setImmediate;
clearMethod = clearImmediate;
} else if (postMessageSupported()) {
var MSG_PREFIX = 'ms.rx.schedule' + Math.random(),
tasks = {},
taskId = 0;
function onGlobalPostMessage(event) {
// Only if we're a match to avoid any other global events
if (typeof event.data === 'string' && event.data.substring(0, MSG_PREFIX.length) === MSG_PREFIX) {
var handleId = event.data.substring(MSG_PREFIX.length),
action = tasks[handleId];
action();
delete tasks[handleId];
}
}
if (root.addEventListener) {
root.addEventListener('message', onGlobalPostMessage, false);
} else {
root.attachEvent('onmessage', onGlobalPostMessage, false);
}
scheduleMethod = function (action) {
var currentId = taskId++;
tasks[currentId] = action;
root.postMessage(MSG_PREFIX + currentId, '*');
};
} else if (!!root.MessageChannel) {
var channel = new root.MessageChannel(),
channelTasks = {},
channelTaskId = 0;
channel.port1.onmessage = function (event) {
var id = event.data,
action = channelTasks[id];
action();
delete channelTasks[id];
};
scheduleMethod = function (action) {
var id = channelTaskId++;
channelTasks[id] = action;
channel.port2.postMessage(id);
};
} else if ('document' in root && 'onreadystatechange' in root.document.createElement('script')) {
scheduleMethod = function (action) {
var scriptElement = root.document.createElement('script');
scriptElement.onreadystatechange = function () {
action();
scriptElement.onreadystatechange = null;
scriptElement.parentNode.removeChild(scriptElement);
scriptElement = null;
};
root.document.documentElement.appendChild(scriptElement);
};
} else {
scheduleMethod = function (action) { return setTimeout(action, 0); };
clearMethod = clearTimeout;
}
}());
/**
* Gets a scheduler that schedules work via a timed callback based upon platform.
*/
var timeoutScheduler = Scheduler.timeout = (function () {
function scheduleNow(state, action) {
var scheduler = this,
disposable = new SingleAssignmentDisposable();
var id = scheduleMethod(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
});
return new CompositeDisposable(disposable, disposableCreate(function () {
clearMethod(id);
}));
}
function scheduleRelative(state, dueTime, action) {
var scheduler = this,
dt = Scheduler.normalize(dueTime);
if (dt === 0) {
return scheduler.scheduleWithState(state, action);
}
var disposable = new SingleAssignmentDisposable();
var id = setTimeout(function () {
if (!disposable.isDisposed) {
disposable.setDisposable(action(scheduler, state));
}
}, dt);
return new CompositeDisposable(disposable, disposableCreate(function () {
clearTimeout(id);
}));
}
function scheduleAbsolute(state, dueTime, action) {
return this.scheduleWithRelativeAndState(state, dueTime - this.now(), action);
}
return new Scheduler(defaultNow, scheduleNow, scheduleRelative, scheduleAbsolute);
})();
/** @private */
var CatchScheduler = (function (_super) {
function localNow() {
return this._scheduler.now();
}
function scheduleNow(state, action) {
return this._scheduler.scheduleWithState(state, this._wrap(action));
}
function scheduleRelative(state, dueTime, action) {
return this._scheduler.scheduleWithRelativeAndState(state, dueTime, this._wrap(action));
}
function scheduleAbsolute(state, dueTime, action) {
return this._scheduler.scheduleWithAbsoluteAndState(state, dueTime, this._wrap(action));
}
inherits(CatchScheduler, _super);
/** @private */
function CatchScheduler(scheduler, handler) {
this._scheduler = scheduler;
this._handler = handler;
this._recursiveOriginal = null;
this._recursiveWrapper = null;
_super.call(this, localNow, scheduleNow, scheduleRelative, scheduleAbsolute);
}
/** @private */
CatchScheduler.prototype._clone = function (scheduler) {
return new CatchScheduler(scheduler, this._handler);
};
/** @private */
CatchScheduler.prototype._wrap = function (action) {
var parent = this;
return function (self, state) {
try {
return action(parent._getRecursiveWrapper(self), state);
} catch (e) {
if (!parent._handler(e)) { throw e; }
return disposableEmpty;
}
};
};
/** @private */
CatchScheduler.prototype._getRecursiveWrapper = function (scheduler) {
if (this._recursiveOriginal !== scheduler) {
this._recursiveOriginal = scheduler;
var wrapper = this._clone(scheduler);
wrapper._recursiveOriginal = scheduler;
wrapper._recursiveWrapper = wrapper;
this._recursiveWrapper = wrapper;
}
return this._recursiveWrapper;
};
/** @private */
CatchScheduler.prototype.schedulePeriodicWithState = function (state, period, action) {
var self = this, failed = false, d = new SingleAssignmentDisposable();
d.setDisposable(this._scheduler.schedulePeriodicWithState(state, period, function (state1) {
if (failed) { return null; }
try {
return action(state1);
} catch (e) {
failed = true;
if (!self._handler(e)) { throw e; }
d.dispose();
return null;
}
}));
return d;
};
return CatchScheduler;
}(Scheduler));
/**
* Represents a notification to an observer.
*/
var Notification = Rx.Notification = (function () {
function Notification(kind, hasValue) {
this.hasValue = hasValue == null ? false : hasValue;
this.kind = kind;
}
/**
* Invokes the delegate corresponding to the notification or the observer's method corresponding to the notification and returns the produced result.
*
* @memberOf Notification
* @param {Any} observerOrOnNext Delegate to invoke for an OnNext notification or Observer to invoke the notification on..
* @param {Function} onError Delegate to invoke for an OnError notification.
* @param {Function} onCompleted Delegate to invoke for an OnCompleted notification.
* @returns {Any} Result produced by the observation.
*/
Notification.prototype.accept = function (observerOrOnNext, onError, onCompleted) {
return observerOrOnNext && typeof observerOrOnNext === 'object' ?
this._acceptObservable(observerOrOnNext) :
this._accept(observerOrOnNext, onError, onCompleted);
};
/**
* Returns an observable sequence with a single notification.
*
* @memberOf Notifications
* @param {Scheduler} [scheduler] Scheduler to send out the notification calls on.
* @returns {Observable} The observable sequence that surfaces the behavior of the notification upon subscription.
*/
Notification.prototype.toObservable = function (scheduler) {
var notification = this;
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
notification._acceptObservable(observer);
notification.kind === 'N' && observer.onCompleted();
});
});
};
return Notification;
})();
/**
* Creates an object that represents an OnNext notification to an observer.
* @param {Any} value The value contained in the notification.
* @returns {Notification} The OnNext notification containing the value.
*/
var notificationCreateOnNext = Notification.createOnNext = (function () {
function _accept (onNext) { return onNext(this.value); }
function _acceptObservable(observer) { return observer.onNext(this.value); }
function toString () { return 'OnNext(' + this.value + ')'; }
return function (value) {
var notification = new Notification('N', true);
notification.value = value;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnError notification to an observer.
* @param {Any} error The exception contained in the notification.
* @returns {Notification} The OnError notification containing the exception.
*/
var notificationCreateOnError = Notification.createOnError = (function () {
function _accept (onNext, onError) { return onError(this.exception); }
function _acceptObservable(observer) { return observer.onError(this.exception); }
function toString () { return 'OnError(' + this.exception + ')'; }
return function (exception) {
var notification = new Notification('E');
notification.exception = exception;
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
/**
* Creates an object that represents an OnCompleted notification to an observer.
* @returns {Notification} The OnCompleted notification.
*/
var notificationCreateOnCompleted = Notification.createOnCompleted = (function () {
function _accept (onNext, onError, onCompleted) { return onCompleted(); }
function _acceptObservable(observer) { return observer.onCompleted(); }
function toString () { return 'OnCompleted()'; }
return function () {
var notification = new Notification('C');
notification._accept = _accept;
notification._acceptObservable = _acceptObservable;
notification.toString = toString;
return notification;
};
}());
var Enumerator = Rx.internals.Enumerator = function (next) {
this._next = next;
};
Enumerator.prototype.next = function () {
return this._next();
};
Enumerator.prototype[$iterator$] = function () { return this; }
var Enumerable = Rx.internals.Enumerable = function (iterator) {
this._iterator = iterator;
};
Enumerable.prototype[$iterator$] = function () {
return this._iterator();
};
Enumerable.prototype.concat = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch(err) {
observer.onError();
return;
}
var isDisposed,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
var currentItem;
if (isDisposed) { return; }
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
observer.onCompleted();
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () { self(); })
);
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
Enumerable.prototype.catchException = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var e;
try {
e = sources[$iterator$]();
} catch(err) {
observer.onError();
return;
}
var isDisposed,
lastException,
subscription = new SerialDisposable();
var cancelable = immediateScheduler.scheduleRecursive(function (self) {
if (isDisposed) { return; }
var currentItem;
try {
currentItem = e.next();
} catch (ex) {
observer.onError(ex);
return;
}
if (currentItem.done) {
if (lastException) {
observer.onError(lastException);
} else {
observer.onCompleted();
}
return;
}
// Check if promise
var currentValue = currentItem.value;
isPromise(currentValue) && (currentValue = observableFromPromise(currentValue));
var d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(currentValue.subscribe(
observer.onNext.bind(observer),
function (exn) {
lastException = exn;
self();
},
observer.onCompleted.bind(observer)));
});
return new CompositeDisposable(subscription, cancelable, disposableCreate(function () {
isDisposed = true;
}));
});
};
var enumerableRepeat = Enumerable.repeat = function (value, repeatCount) {
if (repeatCount == null) { repeatCount = -1; }
return new Enumerable(function () {
var left = repeatCount;
return new Enumerator(function () {
if (left === 0) { return doneEnumerator; }
if (left > 0) { left--; }
return { done: false, value: value };
});
});
};
var enumerableFor = Enumerable.forEach = function (source, selector, thisArg) {
selector || (selector = identity);
return new Enumerable(function () {
var index = -1;
return new Enumerator(
function () {
return ++index < source.length ?
{ done: false, value: selector.call(thisArg, source[index], index, source) } :
doneEnumerator;
});
});
};
/**
* Supports push-style iteration over an observable sequence.
*/
var Observer = Rx.Observer = function () { };
/**
* Creates a notification callback from an observer.
*
* @param observer Observer object.
* @returns The action that forwards its input notification to the underlying observer.
*/
Observer.prototype.toNotifier = function () {
var observer = this;
return function (n) {
return n.accept(observer);
};
};
/**
* Hides the identity of an observer.
* @returns An observer that hides the identity of the specified observer.
*/
Observer.prototype.asObserver = function () {
return new AnonymousObserver(this.onNext.bind(this), this.onError.bind(this), this.onCompleted.bind(this));
};
/**
* Checks access to the observer for grammar violations. This includes checking for multiple OnError or OnCompleted calls, as well as reentrancy in any of the observer methods.
* If a violation is detected, an Error is thrown from the offending observer method call.
*
* @returns An observer that checks callbacks invocations against the observer grammar and, if the checks pass, forwards those to the specified observer.
*/
Observer.prototype.checked = function () { return new CheckedObserver(this); };
/**
* Creates an observer from the specified OnNext, along with optional OnError, and OnCompleted actions.
*
* @static
* @memberOf Observer
* @param {Function} [onNext] Observer's OnNext action implementation.
* @param {Function} [onError] Observer's OnError action implementation.
* @param {Function} [onCompleted] Observer's OnCompleted action implementation.
* @returns {Observer} The observer object implemented using the given actions.
*/
var observerCreate = Observer.create = function (onNext, onError, onCompleted) {
onNext || (onNext = noop);
onError || (onError = defaultError);
onCompleted || (onCompleted = noop);
return new AnonymousObserver(onNext, onError, onCompleted);
};
/**
* Creates an observer from a notification callback.
*
* @static
* @memberOf Observer
* @param {Function} handler Action that handles a notification.
* @returns The observer object that invokes the specified handler using a notification corresponding to each message it receives.
*/
Observer.fromNotifier = function (handler) {
return new AnonymousObserver(function (x) {
return handler(notificationCreateOnNext(x));
}, function (exception) {
return handler(notificationCreateOnError(exception));
}, function () {
return handler(notificationCreateOnCompleted());
});
};
/**
* Schedules the invocation of observer methods on the given scheduler.
* @param {Scheduler} scheduler Scheduler to schedule observer messages on.
* @returns {Observer} Observer whose messages are scheduled on the given scheduler.
*/
Observer.notifyOn = function (scheduler) {
return new ObserveOnObserver(scheduler, this);
};
/**
* Abstract base class for implementations of the Observer class.
* This base class enforces the grammar of observers where OnError and OnCompleted are terminal messages.
*/
var AbstractObserver = Rx.internals.AbstractObserver = (function (_super) {
inherits(AbstractObserver, _super);
/**
* Creates a new observer in a non-stopped state.
*
* @constructor
*/
function AbstractObserver() {
this.isStopped = false;
_super.call(this);
}
/**
* Notifies the observer of a new element in the sequence.
*
* @memberOf AbstractObserver
* @param {Any} value Next element in the sequence.
*/
AbstractObserver.prototype.onNext = function (value) {
if (!this.isStopped) {
this.next(value);
}
};
/**
* Notifies the observer that an exception has occurred.
*
* @memberOf AbstractObserver
* @param {Any} error The error that has occurred.
*/
AbstractObserver.prototype.onError = function (error) {
if (!this.isStopped) {
this.isStopped = true;
this.error(error);
}
};
/**
* Notifies the observer of the end of the sequence.
*/
AbstractObserver.prototype.onCompleted = function () {
if (!this.isStopped) {
this.isStopped = true;
this.completed();
}
};
/**
* Disposes the observer, causing it to transition to the stopped state.
*/
AbstractObserver.prototype.dispose = function () {
this.isStopped = true;
};
AbstractObserver.prototype.fail = function (e) {
if (!this.isStopped) {
this.isStopped = true;
this.error(e);
return true;
}
return false;
};
return AbstractObserver;
}(Observer));
/**
* Class to create an Observer instance from delegate-based implementations of the on* methods.
*/
var AnonymousObserver = Rx.AnonymousObserver = (function (_super) {
inherits(AnonymousObserver, _super);
/**
* Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
* @param {Any} onNext Observer's OnNext action implementation.
* @param {Any} onError Observer's OnError action implementation.
* @param {Any} onCompleted Observer's OnCompleted action implementation.
*/
function AnonymousObserver(onNext, onError, onCompleted) {
_super.call(this);
this._onNext = onNext;
this._onError = onError;
this._onCompleted = onCompleted;
}
/**
* Calls the onNext action.
* @param {Any} value Next element in the sequence.
*/
AnonymousObserver.prototype.next = function (value) {
this._onNext(value);
};
/**
* Calls the onError action.
* @param {Any} error The error that has occurred.
*/
AnonymousObserver.prototype.error = function (exception) {
this._onError(exception);
};
/**
* Calls the onCompleted action.
*/
AnonymousObserver.prototype.completed = function () {
this._onCompleted();
};
return AnonymousObserver;
}(AbstractObserver));
var CheckedObserver = (function (_super) {
inherits(CheckedObserver, _super);
function CheckedObserver(observer) {
_super.call(this);
this._observer = observer;
this._state = 0; // 0 - idle, 1 - busy, 2 - done
}
var CheckedObserverPrototype = CheckedObserver.prototype;
CheckedObserverPrototype.onNext = function (value) {
this.checkAccess();
try {
this._observer.onNext(value);
} catch (e) {
throw e;
} finally {
this._state = 0;
}
};
CheckedObserverPrototype.onError = function (err) {
this.checkAccess();
try {
this._observer.onError(err);
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.onCompleted = function () {
this.checkAccess();
try {
this._observer.onCompleted();
} catch (e) {
throw e;
} finally {
this._state = 2;
}
};
CheckedObserverPrototype.checkAccess = function () {
if (this._state === 1) { throw new Error('Re-entrancy detected'); }
if (this._state === 2) { throw new Error('Observer completed'); }
if (this._state === 0) { this._state = 1; }
};
return CheckedObserver;
}(Observer));
var ScheduledObserver = Rx.internals.ScheduledObserver = (function (_super) {
inherits(ScheduledObserver, _super);
function ScheduledObserver(scheduler, observer) {
_super.call(this);
this.scheduler = scheduler;
this.observer = observer;
this.isAcquired = false;
this.hasFaulted = false;
this.queue = [];
this.disposable = new SerialDisposable();
}
ScheduledObserver.prototype.next = function (value) {
var self = this;
this.queue.push(function () {
self.observer.onNext(value);
});
};
ScheduledObserver.prototype.error = function (exception) {
var self = this;
this.queue.push(function () {
self.observer.onError(exception);
});
};
ScheduledObserver.prototype.completed = function () {
var self = this;
this.queue.push(function () {
self.observer.onCompleted();
});
};
ScheduledObserver.prototype.ensureActive = function () {
var isOwner = false, parent = this;
if (!this.hasFaulted && this.queue.length > 0) {
isOwner = !this.isAcquired;
this.isAcquired = true;
}
if (isOwner) {
this.disposable.setDisposable(this.scheduler.scheduleRecursive(function (self) {
var work;
if (parent.queue.length > 0) {
work = parent.queue.shift();
} else {
parent.isAcquired = false;
return;
}
try {
work();
} catch (ex) {
parent.queue = [];
parent.hasFaulted = true;
throw ex;
}
self();
}));
}
};
ScheduledObserver.prototype.dispose = function () {
_super.prototype.dispose.call(this);
this.disposable.dispose();
};
return ScheduledObserver;
}(AbstractObserver));
/** @private */
var ObserveOnObserver = (function (_super) {
inherits(ObserveOnObserver, _super);
/** @private */
function ObserveOnObserver() {
_super.apply(this, arguments);
}
/** @private */
ObserveOnObserver.prototype.next = function (value) {
_super.prototype.next.call(this, value);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.error = function (e) {
_super.prototype.error.call(this, e);
this.ensureActive();
};
/** @private */
ObserveOnObserver.prototype.completed = function () {
_super.prototype.completed.call(this);
this.ensureActive();
};
return ObserveOnObserver;
})(ScheduledObserver);
var observableProto;
/**
* Represents a push-style collection.
*/
var Observable = Rx.Observable = (function () {
function Observable(subscribe) {
this._subscribe = subscribe;
}
observableProto = Observable.prototype;
/**
* Subscribes an observer to the observable sequence.
*
* @example
* 1 - source.subscribe();
* 2 - source.subscribe(observer);
* 3 - source.subscribe(function (x) { console.log(x); });
* 4 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); });
* 5 - source.subscribe(function (x) { console.log(x); }, function (err) { console.log(err); }, function () { console.log('done'); });
* @param {Mixed} [observerOrOnNext] The object that is to receive notifications or an action to invoke for each element in the observable sequence.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence.
* @returns {Diposable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribe = observableProto.forEach = function (observerOrOnNext, onError, onCompleted) {
var subscriber = typeof observerOrOnNext === 'object' ?
observerOrOnNext :
observerCreate(observerOrOnNext, onError, onCompleted);
return this._subscribe(subscriber);
};
return Observable;
})();
/**
* Wraps the source sequence in order to run its observer callbacks on the specified scheduler.
*
* This only invokes observer callbacks on a scheduler. In case the subscription and/or unsubscription actions have side-effects
* that require to be run on a scheduler, use subscribeOn.
*
* @param {Scheduler} scheduler Scheduler to notify observers on.
* @returns {Observable} The source sequence whose observations happen on the specified scheduler.
*/
observableProto.observeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(new ObserveOnObserver(scheduler, observer));
});
};
/**
* Wraps the source sequence in order to run its subscription and unsubscription logic on the specified scheduler. This operation is not commonly used;
* see the remarks section for more information on the distinction between subscribeOn and observeOn.
* This only performs the side-effects of subscription and unsubscription on the specified scheduler. In order to invoke observer
* callbacks on a scheduler, use observeOn.
* @param {Scheduler} scheduler Scheduler to perform subscription and unsubscription actions on.
* @returns {Observable} The source sequence whose subscriptions and unsubscriptions happen on the specified scheduler.
*/
observableProto.subscribeOn = function (scheduler) {
var source = this;
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(), d = new SerialDisposable();
d.setDisposable(m);
m.setDisposable(scheduler.schedule(function () {
d.setDisposable(new ScheduledDisposable(scheduler, source.subscribe(observer)));
}));
return d;
});
};
/**
* Converts a Promise to an Observable sequence
* @param {Promise} An ES6 Compliant promise.
* @returns {Observable} An Observable sequence which wraps the existing promise success and failure.
*/
var observableFromPromise = Observable.fromPromise = function (promise) {
return new AnonymousObservable(function (observer) {
promise.then(
function (value) {
observer.onNext(value);
observer.onCompleted();
},
function (reason) {
observer.onError(reason);
});
return function () {
if (promise && promise.abort) {
promise.abort();
}
}
});
};
/*
* Converts an existing observable sequence to an ES6 Compatible Promise
* @example
* var promise = Rx.Observable.return(42).toPromise(RSVP.Promise);
*
* // With config
* Rx.config.Promise = RSVP.Promise;
* var promise = Rx.Observable.return(42).toPromise();
* @param {Function} [promiseCtor] The constructor of the promise. If not provided, it looks for it in Rx.config.Promise.
* @returns {Promise} An ES6 compatible promise with the last value from the observable sequence.
*/
observableProto.toPromise = function (promiseCtor) {
promiseCtor || (promiseCtor = Rx.config.Promise);
if (!promiseCtor) {
throw new Error('Promise type not provided nor in Rx.config.Promise');
}
var source = this;
return new promiseCtor(function (resolve, reject) {
// No cancellation can be done
var value, hasValue = false;
source.subscribe(function (v) {
value = v;
hasValue = true;
}, function (err) {
reject(err);
}, function () {
if (hasValue) {
resolve(value);
}
});
});
};
/**
* Creates a list from an observable sequence.
* @returns An observable sequence containing a single element with a list containing all the elements of the source sequence.
*/
observableProto.toArray = function () {
var self = this;
return new AnonymousObservable(function(observer) {
var arr = [];
return self.subscribe(
arr.push.bind(arr),
observer.onError.bind(observer),
function () {
observer.onNext(arr);
observer.onCompleted();
});
});
};
/**
* Creates an observable sequence from a specified subscribe method implementation.
*
* @example
* var res = Rx.Observable.create(function (observer) { return function () { } );
* var res = Rx.Observable.create(function (observer) { return Rx.Disposable.empty; } );
* var res = Rx.Observable.create(function (observer) { } );
*
* @param {Function} subscribe Implementation of the resulting observable sequence's subscribe method, returning a function that will be wrapped in a Disposable.
* @returns {Observable} The observable sequence with the specified implementation for the Subscribe method.
*/
Observable.create = Observable.createWithDisposable = function (subscribe) {
return new AnonymousObservable(subscribe);
};
/**
* Returns an observable sequence that invokes the specified factory function whenever a new observer subscribes.
*
* @example
* var res = Rx.Observable.defer(function () { return Rx.Observable.fromArray([1,2,3]); });
* @param {Function} observableFactory Observable factory function to invoke for each observer that subscribes to the resulting sequence or Promise.
* @returns {Observable} An observable sequence whose observers trigger an invocation of the given observable factory function.
*/
var observableDefer = Observable.defer = function (observableFactory) {
return new AnonymousObservable(function (observer) {
var result;
try {
result = observableFactory();
} catch (e) {
return observableThrow(e).subscribe(observer);
}
isPromise(result) && (result = observableFromPromise(result));
return result.subscribe(observer);
});
};
/**
* Returns an empty observable sequence, using the specified scheduler to send out the single OnCompleted message.
*
* @example
* var res = Rx.Observable.empty();
* var res = Rx.Observable.empty(Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to send the termination call on.
* @returns {Observable} An observable sequence with no elements.
*/
var observableEmpty = Observable.empty = function (scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onCompleted();
});
});
};
var maxSafeInteger = Math.pow(2, 53) - 1;
function numberIsFinite(value) {
return typeof value === 'number' && root.isFinite(value);
}
function isNan(n) {
return n !== n;
}
function isIterable(o) {
return o[$iterator$] !== undefined;
}
function sign(value) {
var number = +value;
if (number === 0) { return number; }
if (isNaN(number)) { return number; }
return number < 0 ? -1 : 1;
}
function toLength(o) {
var len = +o.length;
if (isNaN(len)) { return 0; }
if (len === 0 || !numberIsFinite(len)) { return len; }
len = sign(len) * Math.floor(Math.abs(len));
if (len <= 0) { return 0; }
if (len > maxSafeInteger) { return maxSafeInteger; }
return len;
}
function isCallable(f) {
return Object.prototype.toString.call(f) === '[object Function]' && typeof f === 'function';
}
/**
* This method creates a new Observable sequence from an array-like or iterable object.
* @param {Any} arrayLike An array-like or iterable object to convert to an Observable sequence.
* @param {Function} [mapFn] Map function to call on every element of the array.
* @param {Any} [thisArg] The context to use calling the mapFn if provided.
* @param {Scheduler} [scheduler] Optional scheduler to use for scheduling. If not provided, defaults to Scheduler.currentThread.
*/
Observable.from = function (iterable, mapFn, thisArg, scheduler) {
if (iterable == null) {
throw new Error('iterable cannot be null.')
}
if (mapFn && !isCallable(mapFn)) {
throw new Error('mapFn when provided must be a function');
}
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var list = Object(iterable),
objIsIterable = isIterable(list),
len = objIsIterable ? 0 : toLength(list),
it = objIsIterable ? list[$iterator$]() : null,
i = 0;
return scheduler.scheduleRecursive(function (self) {
if (i < len || objIsIterable) {
var result;
if (objIsIterable) {
var next = it.next();
if (next.done) {
observer.onCompleted();
return;
}
result = next.value;
} else {
result = list[i];
}
if (mapFn && isCallable(mapFn)) {
try {
result = thisArg ? mapFn.call(thisArg, result, i) : mapFn(result, i);
} catch (e) {
observer.onError(e);
return;
}
}
observer.onNext(result);
i++;
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Converts an array to an observable sequence, using an optional scheduler to enumerate the array.
*
* @example
* var res = Rx.Observable.fromArray([1,2,3]);
* var res = Rx.Observable.fromArray([1,2,3], Rx.Scheduler.timeout);
* @param {Scheduler} [scheduler] Scheduler to run the enumeration of the input sequence on.
* @returns {Observable} The observable sequence whose elements are pulled from the given enumerable sequence.
*/
var observableFromArray = Observable.fromArray = function (array, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var count = 0, len = array.length;
return scheduler.scheduleRecursive(function (self) {
if (count < len) {
observer.onNext(array[count++]);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence by running a state-driven loop producing the sequence's elements, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; });
* var res = Rx.Observable.generate(0, function (x) { return x < 10; }, function (x) { return x + 1; }, function (x) { return x; }, Rx.Scheduler.timeout);
* @param {Mixed} initialState Initial state.
* @param {Function} condition Condition to terminate generation (upon returning false).
* @param {Function} iterate Iteration step function.
* @param {Function} resultSelector Selector function for results produced in the sequence.
* @param {Scheduler} [scheduler] Scheduler on which to run the generator loop. If not provided, defaults to Scheduler.currentThread.
* @returns {Observable} The generated sequence.
*/
Observable.generate = function (initialState, condition, iterate, resultSelector, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
var first = true, state = initialState;
return scheduler.scheduleRecursive(function (self) {
var hasResult, result;
try {
if (first) {
first = false;
} else {
state = iterate(state);
}
hasResult = condition(state);
if (hasResult) {
result = resultSelector(state);
}
} catch (exception) {
observer.onError(exception);
return;
}
if (hasResult) {
observer.onNext(result);
self();
} else {
observer.onCompleted();
}
});
});
};
/**
* Returns a non-terminating observable sequence, which can be used to denote an infinite duration (e.g. when using reactive joins).
* @returns {Observable} An observable sequence whose observers will never get called.
*/
var observableNever = Observable.never = function () {
return new AnonymousObservable(function () {
return disposableEmpty;
});
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @example
* var res = Rx.Observable.of(1,2,3);
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
Observable.of = function () {
var len = arguments.length, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i]; }
return observableFromArray(args);
};
/**
* This method creates a new Observable instance with a variable number of arguments, regardless of number or type of the arguments.
* @example
* var res = Rx.Observable.of(1,2,3);
* @param {Scheduler} scheduler A scheduler to use for scheduling the arguments.
* @returns {Observable} The observable sequence whose elements are pulled from the given arguments.
*/
var observableOf = Observable.ofWithScheduler = function (scheduler) {
var len = arguments.length - 1, args = new Array(len);
for(var i = 0; i < len; i++) { args[i] = arguments[i + 1]; }
return observableFromArray(args, scheduler);
};
/**
* Generates an observable sequence of integral numbers within a specified range, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.range(0, 10);
* var res = Rx.Observable.range(0, 10, Rx.Scheduler.timeout);
* @param {Number} start The value of the first integer in the sequence.
* @param {Number} count The number of sequential integers to generate.
* @param {Scheduler} [scheduler] Scheduler to run the generator loop on. If not specified, defaults to Scheduler.currentThread.
* @returns {Observable} An observable sequence that contains a range of sequential integral numbers.
*/
Observable.range = function (start, count, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.scheduleRecursiveWithState(0, function (i, self) {
if (i < count) {
observer.onNext(start + i);
self(i + 1);
} else {
observer.onCompleted();
}
});
});
};
/**
* Generates an observable sequence that repeats the given element the specified number of times, using the specified scheduler to send out observer messages.
*
* @example
* var res = Rx.Observable.repeat(42);
* var res = Rx.Observable.repeat(42, 4);
* 3 - res = Rx.Observable.repeat(42, 4, Rx.Scheduler.timeout);
* 4 - res = Rx.Observable.repeat(42, null, Rx.Scheduler.timeout);
* @param {Mixed} value Element to repeat.
* @param {Number} repeatCount [Optiona] Number of times to repeat the element. If not specified, repeats indefinitely.
* @param {Scheduler} scheduler Scheduler to run the producer loop on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence that repeats the given element the specified number of times.
*/
Observable.repeat = function (value, repeatCount, scheduler) {
isScheduler(scheduler) || (scheduler = currentThreadScheduler);
return observableReturn(value, scheduler).repeat(repeatCount == null ? -1 : repeatCount);
};
/**
* Returns an observable sequence that contains a single element, using the specified scheduler to send out observer messages.
* There is an alias called 'just', and 'returnValue' for browsers <IE9.
*
* @example
* var res = Rx.Observable.return(42);
* var res = Rx.Observable.return(42, Rx.Scheduler.timeout);
* @param {Mixed} value Single element in the resulting observable sequence.
* @param {Scheduler} scheduler Scheduler to send the single element on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} An observable sequence containing the single specified element.
*/
var observableReturn = Observable['return'] = Observable.returnValue = Observable.just = function (value, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onNext(value);
observer.onCompleted();
});
});
};
/**
* Returns an observable sequence that terminates with an exception, using the specified scheduler to send out the single onError message.
* There is an alias to this method called 'throwException' for browsers <IE9.
*
* @example
* var res = Rx.Observable.throw(new Error('Error'));
* var res = Rx.Observable.throw(new Error('Error'), Rx.Scheduler.timeout);
* @param {Mixed} exception An object used for the sequence's termination.
* @param {Scheduler} scheduler Scheduler to send the exceptional termination call on. If not specified, defaults to Scheduler.immediate.
* @returns {Observable} The observable sequence that terminates exceptionally with the specified exception object.
*/
var observableThrow = Observable['throw'] = Observable.throwException = function (exception, scheduler) {
isScheduler(scheduler) || (scheduler = immediateScheduler);
return new AnonymousObservable(function (observer) {
return scheduler.schedule(function () {
observer.onError(exception);
});
});
};
/**
* Constructs an observable sequence that depends on a resource object, whose lifetime is tied to the resulting observable sequence's lifetime.
*
* @example
* var res = Rx.Observable.using(function () { return new AsyncSubject(); }, function (s) { return s; });
* @param {Function} resourceFactory Factory function to obtain a resource object.
* @param {Function} observableFactory Factory function to obtain an observable sequence that depends on the obtained resource.
* @returns {Observable} An observable sequence whose lifetime controls the lifetime of the dependent resource object.
*/
Observable.using = function (resourceFactory, observableFactory) {
return new AnonymousObservable(function (observer) {
var disposable = disposableEmpty, resource, source;
try {
resource = resourceFactory();
if (resource) {
disposable = resource;
}
source = observableFactory(resource);
} catch (exception) {
return new CompositeDisposable(observableThrow(exception).subscribe(observer), disposable);
}
return new CompositeDisposable(source.subscribe(observer), disposable);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
* @param {Observable} rightSource Second observable sequence or Promise.
* @returns {Observable} {Observable} An observable sequence that surfaces either of the given sequences, whichever reacted first.
*/
observableProto.amb = function (rightSource) {
var leftSource = this;
return new AnonymousObservable(function (observer) {
var choice,
leftChoice = 'L', rightChoice = 'R',
leftSubscription = new SingleAssignmentDisposable(),
rightSubscription = new SingleAssignmentDisposable();
isPromise(rightSource) && (rightSource = observableFromPromise(rightSource));
function choiceL() {
if (!choice) {
choice = leftChoice;
rightSubscription.dispose();
}
}
function choiceR() {
if (!choice) {
choice = rightChoice;
leftSubscription.dispose();
}
}
leftSubscription.setDisposable(leftSource.subscribe(function (left) {
choiceL();
if (choice === leftChoice) {
observer.onNext(left);
}
}, function (err) {
choiceL();
if (choice === leftChoice) {
observer.onError(err);
}
}, function () {
choiceL();
if (choice === leftChoice) {
observer.onCompleted();
}
}));
rightSubscription.setDisposable(rightSource.subscribe(function (right) {
choiceR();
if (choice === rightChoice) {
observer.onNext(right);
}
}, function (err) {
choiceR();
if (choice === rightChoice) {
observer.onError(err);
}
}, function () {
choiceR();
if (choice === rightChoice) {
observer.onCompleted();
}
}));
return new CompositeDisposable(leftSubscription, rightSubscription);
});
};
/**
* Propagates the observable sequence or Promise that reacts first.
*
* @example
* var = Rx.Observable.amb(xs, ys, zs);
* @returns {Observable} An observable sequence that surfaces any of the given sequences, whichever reacted first.
*/
Observable.amb = function () {
var acc = observableNever(),
items = argsOrArray(arguments, 0);
function func(previous, current) {
return previous.amb(current);
}
for (var i = 0, len = items.length; i < len; i++) {
acc = func(acc, items[i]);
}
return acc;
};
function observableCatchHandler(source, handler) {
return new AnonymousObservable(function (observer) {
var d1 = new SingleAssignmentDisposable(), subscription = new SerialDisposable();
subscription.setDisposable(d1);
d1.setDisposable(source.subscribe(observer.onNext.bind(observer), function (exception) {
var d, result;
try {
result = handler(exception);
} catch (ex) {
observer.onError(ex);
return;
}
isPromise(result) && (result = observableFromPromise(result));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(result.subscribe(observer));
}, observer.onCompleted.bind(observer)));
return subscription;
});
}
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
* @example
* 1 - xs.catchException(ys)
* 2 - xs.catchException(function (ex) { return ys(ex); })
* @param {Mixed} handlerOrSecond Exception handler function that returns an observable sequence given the error that occurred in the first sequence, or a second observable sequence used to produce results when an error occurred in the first sequence.
* @returns {Observable} An observable sequence containing the first sequence's elements, followed by the elements of the handler sequence in case an exception occurred.
*/
observableProto['catch'] = observableProto.catchException = function (handlerOrSecond) {
return typeof handlerOrSecond === 'function' ?
observableCatchHandler(this, handlerOrSecond) :
observableCatch([this, handlerOrSecond]);
};
/**
* Continues an observable sequence that is terminated by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.catchException(xs, ys, zs);
* 2 - res = Rx.Observable.catchException([xs, ys, zs]);
* @returns {Observable} An observable sequence containing elements from consecutive source sequences until a source sequence terminates successfully.
*/
var observableCatch = Observable.catchException = Observable['catch'] = function () {
var items = argsOrArray(arguments, 0);
return enumerableFor(items).catchException();
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
* This can be in the form of an argument list of observables or an array.
*
* @example
* 1 - obs = observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.combineLatest = function () {
var args = slice.call(arguments);
if (Array.isArray(args[0])) {
args[0].unshift(this);
} else {
args.unshift(this);
}
return combineLatest.apply(this, args);
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences or Promises produces an element.
*
* @example
* 1 - obs = Rx.Observable.combineLatest(obs1, obs2, obs3, function (o1, o2, o3) { return o1 + o2 + o3; });
* 2 - obs = Rx.Observable.combineLatest([obs1, obs2, obs3], function (o1, o2, o3) { return o1 + o2 + o3; });
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
var combineLatest = Observable.combineLatest = function () {
var args = slice.call(arguments), resultSelector = args.pop();
if (Array.isArray(args[0])) {
args = args[0];
}
return new AnonymousObservable(function (observer) {
var falseFactory = function () { return false; },
n = args.length,
hasValue = arrayInitialize(n, falseFactory),
hasValueAll = false,
isDone = arrayInitialize(n, falseFactory),
values = new Array(n);
function next(i) {
var res;
hasValue[i] = true;
if (hasValueAll || (hasValueAll = hasValue.every(identity))) {
try {
res = resultSelector.apply(null, values);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
}
function done (i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = args[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
values[i] = x;
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
}(idx));
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Concatenates all the observable sequences. This takes in either an array or variable arguments to concatenate.
*
* @example
* 1 - concatenated = xs.concat(ys, zs);
* 2 - concatenated = xs.concat([ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
observableProto.concat = function () {
var items = slice.call(arguments, 0);
items.unshift(this);
return observableConcat.apply(this, items);
};
/**
* Concatenates all the observable sequences.
*
* @example
* 1 - res = Rx.Observable.concat(xs, ys, zs);
* 2 - res = Rx.Observable.concat([xs, ys, zs]);
* @returns {Observable} An observable sequence that contains the elements of each given sequence, in sequential order.
*/
var observableConcat = Observable.concat = function () {
var sources = argsOrArray(arguments, 0);
return enumerableFor(sources).concat();
};
/**
* Concatenates an observable sequence of observable sequences.
* @returns {Observable} An observable sequence that contains the elements of each observed inner sequence, in sequential order.
*/
observableProto.concatObservable = observableProto.concatAll =function () {
return this.merge(1);
};
/**
* Merges an observable sequence of observable sequences into an observable sequence, limiting the number of concurrent subscriptions to inner sequences.
* Or merges two observable sequences into a single observable sequence.
*
* @example
* 1 - merged = sources.merge(1);
* 2 - merged = source.merge(otherSource);
* @param {Mixed} [maxConcurrentOrOther] Maximum number of inner observable sequences being subscribed to concurrently or the second observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.merge = function (maxConcurrentOrOther) {
if (typeof maxConcurrentOrOther !== 'number') {
return observableMerge(this, maxConcurrentOrOther);
}
var sources = this;
return new AnonymousObservable(function (observer) {
var activeCount = 0,
group = new CompositeDisposable(),
isStopped = false,
q = [],
subscribe = function (xs) {
var subscription = new SingleAssignmentDisposable();
group.add(subscription);
// Check for promises support
if (isPromise(xs)) { xs = observableFromPromise(xs); }
subscription.setDisposable(xs.subscribe(observer.onNext.bind(observer), observer.onError.bind(observer), function () {
var s;
group.remove(subscription);
if (q.length > 0) {
s = q.shift();
subscribe(s);
} else {
activeCount--;
if (isStopped && activeCount === 0) {
observer.onCompleted();
}
}
}));
};
group.add(sources.subscribe(function (innerSource) {
if (activeCount < maxConcurrentOrOther) {
activeCount++;
subscribe(innerSource);
} else {
q.push(innerSource);
}
}, observer.onError.bind(observer), function () {
isStopped = true;
if (activeCount === 0) {
observer.onCompleted();
}
}));
return group;
});
};
/**
* Merges all the observable sequences into a single observable sequence.
* The scheduler is optional and if not specified, the immediate scheduler is used.
*
* @example
* 1 - merged = Rx.Observable.merge(xs, ys, zs);
* 2 - merged = Rx.Observable.merge([xs, ys, zs]);
* 3 - merged = Rx.Observable.merge(scheduler, xs, ys, zs);
* 4 - merged = Rx.Observable.merge(scheduler, [xs, ys, zs]);
* @returns {Observable} The observable sequence that merges the elements of the observable sequences.
*/
var observableMerge = Observable.merge = function () {
var scheduler, sources;
if (!arguments[0]) {
scheduler = immediateScheduler;
sources = slice.call(arguments, 1);
} else if (arguments[0].now) {
scheduler = arguments[0];
sources = slice.call(arguments, 1);
} else {
scheduler = immediateScheduler;
sources = slice.call(arguments, 0);
}
if (Array.isArray(sources[0])) {
sources = sources[0];
}
return observableFromArray(sources, scheduler).mergeObservable();
};
/**
* Merges an observable sequence of observable sequences into an observable sequence.
* @returns {Observable} The observable sequence that merges the elements of the inner sequences.
*/
observableProto.mergeObservable = observableProto.mergeAll =function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var group = new CompositeDisposable(),
isStopped = false,
m = new SingleAssignmentDisposable();
group.add(m);
m.setDisposable(sources.subscribe(function (innerSource) {
var innerSubscription = new SingleAssignmentDisposable();
group.add(innerSubscription);
// Check if Promise or Observable
if (isPromise(innerSource)) {
innerSource = observableFromPromise(innerSource);
}
innerSubscription.setDisposable(innerSource.subscribe(function (x) {
observer.onNext(x);
}, observer.onError.bind(observer), function () {
group.remove(innerSubscription);
if (isStopped && group.length === 1) { observer.onCompleted(); }
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (group.length === 1) { observer.onCompleted(); }
}));
return group;
});
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
* @param {Observable} second Second observable sequence used to produce results after the first sequence terminates.
* @returns {Observable} An observable sequence that concatenates the first and second sequence, even if the first sequence terminates exceptionally.
*/
observableProto.onErrorResumeNext = function (second) {
if (!second) {
throw new Error('Second observable is required');
}
return onErrorResumeNext([this, second]);
};
/**
* Continues an observable sequence that is terminated normally or by an exception with the next observable sequence.
*
* @example
* 1 - res = Rx.Observable.onErrorResumeNext(xs, ys, zs);
* 1 - res = Rx.Observable.onErrorResumeNext([xs, ys, zs]);
* @returns {Observable} An observable sequence that concatenates the source sequences, even if a sequence terminates exceptionally.
*/
var onErrorResumeNext = Observable.onErrorResumeNext = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var pos = 0, subscription = new SerialDisposable(),
cancelable = immediateScheduler.scheduleRecursive(function (self) {
var current, d;
if (pos < sources.length) {
current = sources[pos++];
isPromise(current) && (current = observableFromPromise(current));
d = new SingleAssignmentDisposable();
subscription.setDisposable(d);
d.setDisposable(current.subscribe(observer.onNext.bind(observer), function () {
self();
}, function () {
self();
}));
} else {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, cancelable);
});
};
/**
* Returns the values from the source observable sequence only after the other observable sequence produces a value.
* @param {Observable | Promise} other The observable sequence or Promise that triggers propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence starting from the point the other sequence triggered propagation.
*/
observableProto.skipUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
var isOpen = false;
var disposables = new CompositeDisposable(source.subscribe(function (left) {
isOpen && observer.onNext(left);
}, observer.onError.bind(observer), function () {
isOpen && observer.onCompleted();
}));
isPromise(other) && (other = observableFromPromise(other));
var rightSubscription = new SingleAssignmentDisposable();
disposables.add(rightSubscription);
rightSubscription.setDisposable(other.subscribe(function () {
isOpen = true;
rightSubscription.dispose();
}, observer.onError.bind(observer), function () {
rightSubscription.dispose();
}));
return disposables;
});
};
/**
* Transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @returns {Observable} The observable sequence that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto['switch'] = observableProto.switchLatest = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasLatest = false,
innerSubscription = new SerialDisposable(),
isStopped = false,
latest = 0,
subscription = sources.subscribe(function (innerSource) {
var d = new SingleAssignmentDisposable(), id = ++latest;
hasLatest = true;
innerSubscription.setDisposable(d);
// Check if Promise or Observable
if (isPromise(innerSource)) {
innerSource = observableFromPromise(innerSource);
}
d.setDisposable(innerSource.subscribe(function (x) {
if (latest === id) {
observer.onNext(x);
}
}, function (e) {
if (latest === id) {
observer.onError(e);
}
}, function () {
if (latest === id) {
hasLatest = false;
if (isStopped) {
observer.onCompleted();
}
}
}));
}, observer.onError.bind(observer), function () {
isStopped = true;
if (!hasLatest) {
observer.onCompleted();
}
});
return new CompositeDisposable(subscription, innerSubscription);
});
};
/**
* Returns the values from the source observable sequence until the other observable sequence produces a value.
* @param {Observable | Promise} other Observable sequence or Promise that terminates propagation of elements of the source sequence.
* @returns {Observable} An observable sequence containing the elements of the source sequence up to the point the other sequence interrupted further propagation.
*/
observableProto.takeUntil = function (other) {
var source = this;
return new AnonymousObservable(function (observer) {
isPromise(other) && (other = observableFromPromise(other));
return new CompositeDisposable(
source.subscribe(observer),
other.subscribe(observer.onCompleted.bind(observer), observer.onError.bind(observer), noop)
);
});
};
function zipArray(second, resultSelector) {
var first = this;
return new AnonymousObservable(function (observer) {
var index = 0, len = second.length;
return first.subscribe(function (left) {
if (index < len) {
var right = second[index++], result;
try {
result = resultSelector(left, right);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
} else {
observer.onCompleted();
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
}
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences or an array have produced an element at a corresponding index.
* The last element in the arguments must be a function to invoke for each series of elements at corresponding indexes in the sources.
*
* @example
* 1 - res = obs1.zip(obs2, fn);
* 1 - res = x1.zip([1,2,3], fn);
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
observableProto.zip = function () {
if (Array.isArray(arguments[0])) {
return zipArray.apply(this, arguments);
}
var parent = this, sources = slice.call(arguments), resultSelector = sources.pop();
sources.unshift(parent);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
var res, queuedValues;
if (queues.every(function (x) { return x.length > 0; })) {
try {
queuedValues = queues.map(function (x) { return x.shift(); });
res = resultSelector.apply(parent, queuedValues);
} catch (ex) {
observer.onError(ex);
return;
}
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(function (x) { return x; })) {
observer.onCompleted();
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
var source = sources[i], sad = new SingleAssignmentDisposable();
isPromise(source) && (source = observableFromPromise(source));
sad.setDisposable(source.subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
subscriptions[i] = sad;
})(idx);
}
return new CompositeDisposable(subscriptions);
});
};
/**
* Merges the specified observable sequences into one observable sequence by using the selector function whenever all of the observable sequences have produced an element at a corresponding index.
* @param arguments Observable sources.
* @param {Function} resultSelector Function to invoke for each series of elements at corresponding indexes in the sources.
* @returns {Observable} An observable sequence containing the result of combining elements of the sources using the specified result selector function.
*/
Observable.zip = function () {
var args = slice.call(arguments, 0),
first = args.shift();
return first.zip.apply(first, args);
};
/**
* Merges the specified observable sequences into one observable sequence by emitting a list with the elements of the observable sequences at corresponding indexes.
* @param arguments Observable sources.
* @returns {Observable} An observable sequence containing lists of elements at corresponding indexes.
*/
Observable.zipArray = function () {
var sources = argsOrArray(arguments, 0);
return new AnonymousObservable(function (observer) {
var n = sources.length,
queues = arrayInitialize(n, function () { return []; }),
isDone = arrayInitialize(n, function () { return false; });
function next(i) {
if (queues.every(function (x) { return x.length > 0; })) {
var res = queues.map(function (x) { return x.shift(); });
observer.onNext(res);
} else if (isDone.filter(function (x, j) { return j !== i; }).every(identity)) {
observer.onCompleted();
return;
}
};
function done(i) {
isDone[i] = true;
if (isDone.every(identity)) {
observer.onCompleted();
return;
}
}
var subscriptions = new Array(n);
for (var idx = 0; idx < n; idx++) {
(function (i) {
subscriptions[i] = new SingleAssignmentDisposable();
subscriptions[i].setDisposable(sources[i].subscribe(function (x) {
queues[i].push(x);
next(i);
}, observer.onError.bind(observer), function () {
done(i);
}));
})(idx);
}
var compositeDisposable = new CompositeDisposable(subscriptions);
compositeDisposable.add(disposableCreate(function () {
for (var qIdx = 0, qLen = queues.length; qIdx < qLen; qIdx++) {
queues[qIdx] = [];
}
}));
return compositeDisposable;
});
};
/**
* Hides the identity of an observable sequence.
* @returns {Observable} An observable sequence that hides the identity of the source sequence.
*/
observableProto.asObservable = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(observer);
});
};
/**
* Projects each element of an observable sequence into zero or more buffers which are produced based on element count information.
*
* @example
* var res = xs.bufferWithCount(10);
* var res = xs.bufferWithCount(10, 1);
* @param {Number} count Length of each buffer.
* @param {Number} [skip] Number of elements to skip between creation of consecutive buffers. If not provided, defaults to the count.
* @returns {Observable} An observable sequence of buffers.
*/
observableProto.bufferWithCount = function (count, skip) {
if (typeof skip !== 'number') {
skip = count;
}
return this.windowWithCount(count, skip).selectMany(function (x) {
return x.toArray();
}).where(function (x) {
return x.length > 0;
});
};
/**
* Dematerializes the explicit notification values of an observable sequence as implicit notifications.
* @returns {Observable} An observable sequence exhibiting the behavior corresponding to the source sequence's notification values.
*/
observableProto.dematerialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
return x.accept(observer);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns an observable sequence that contains only distinct contiguous elements according to the keySelector and the comparer.
*
* var obs = observable.distinctUntilChanged();
* var obs = observable.distinctUntilChanged(function (x) { return x.id; });
* var obs = observable.distinctUntilChanged(function (x) { return x.id; }, function (x, y) { return x === y; });
*
* @param {Function} [keySelector] A function to compute the comparison key for each element. If not provided, it projects the value.
* @param {Function} [comparer] Equality comparer for computed key values. If not provided, defaults to an equality comparer function.
* @returns {Observable} An observable sequence only containing the distinct contiguous elements, based on a computed key value, from the source sequence.
*/
observableProto.distinctUntilChanged = function (keySelector, comparer) {
var source = this;
keySelector || (keySelector = identity);
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hasCurrentKey = false, currentKey;
return source.subscribe(function (value) {
var comparerEquals = false, key;
try {
key = keySelector(value);
} catch (exception) {
observer.onError(exception);
return;
}
if (hasCurrentKey) {
try {
comparerEquals = comparer(currentKey, key);
} catch (exception) {
observer.onError(exception);
return;
}
}
if (!hasCurrentKey || !comparerEquals) {
hasCurrentKey = true;
currentKey = key;
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Invokes an action for each element in the observable sequence and invokes an action upon graceful or exceptional termination of the observable sequence.
* This method can be used for debugging, logging, etc. of query behavior by intercepting the message stream to run arbitrary actions for messages on the pipeline.
*
* @example
* var res = observable.do(observer);
* var res = observable.do(onNext);
* var res = observable.do(onNext, onError);
* var res = observable.do(onNext, onError, onCompleted);
* @param {Function | Observer} observerOrOnNext Action to invoke for each element in the observable sequence or an observer.
* @param {Function} [onError] Action to invoke upon exceptional termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @param {Function} [onCompleted] Action to invoke upon graceful termination of the observable sequence. Used if only the observerOrOnNext parameter is also a function.
* @returns {Observable} The source sequence with the side-effecting behavior applied.
*/
observableProto['do'] = observableProto.doAction = observableProto.tap = function (observerOrOnNext, onError, onCompleted) {
var source = this, onNextFunc;
if (typeof observerOrOnNext === 'function') {
onNextFunc = observerOrOnNext;
} else {
onNextFunc = observerOrOnNext.onNext.bind(observerOrOnNext);
onError = observerOrOnNext.onError.bind(observerOrOnNext);
onCompleted = observerOrOnNext.onCompleted.bind(observerOrOnNext);
}
return new AnonymousObservable(function (observer) {
return source.subscribe(function (x) {
try {
onNextFunc(x);
} catch (e) {
observer.onError(e);
}
observer.onNext(x);
}, function (err) {
if (!onError) {
observer.onError(err);
} else {
try {
onError(err);
} catch (e) {
observer.onError(e);
}
observer.onError(err);
}
}, function () {
if (!onCompleted) {
observer.onCompleted();
} else {
try {
onCompleted();
} catch (e) {
observer.onError(e);
}
observer.onCompleted();
}
});
});
};
/**
* Invokes a specified action after the source observable sequence terminates gracefully or exceptionally.
*
* @example
* var res = observable.finallyAction(function () { console.log('sequence ended'; });
* @param {Function} finallyAction Action to invoke after the source observable sequence terminates.
* @returns {Observable} Source sequence with the action-invoking termination behavior applied.
*/
observableProto['finally'] = observableProto.finallyAction = function (action) {
var source = this;
return new AnonymousObservable(function (observer) {
var subscription;
try {
subscription = source.subscribe(observer);
} catch (e) {
action();
throw e;
}
return disposableCreate(function () {
try {
subscription.dispose();
} catch (e) {
throw e;
} finally {
action();
}
});
});
};
/**
* Ignores all elements in an observable sequence leaving only the termination messages.
* @returns {Observable} An empty observable sequence that signals termination, successful or exceptional, of the source sequence.
*/
observableProto.ignoreElements = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(noop, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Materializes the implicit notifications of an observable sequence as explicit notification values.
* @returns {Observable} An observable sequence containing the materialized notification values from the source sequence.
*/
observableProto.materialize = function () {
var source = this;
return new AnonymousObservable(function (observer) {
return source.subscribe(function (value) {
observer.onNext(notificationCreateOnNext(value));
}, function (e) {
observer.onNext(notificationCreateOnError(e));
observer.onCompleted();
}, function () {
observer.onNext(notificationCreateOnCompleted());
observer.onCompleted();
});
});
};
/**
* Repeats the observable sequence a specified number of times. If the repeat count is not specified, the sequence repeats indefinitely.
*
* @example
* var res = repeated = source.repeat();
* var res = repeated = source.repeat(42);
* @param {Number} [repeatCount] Number of times to repeat the sequence. If not provided, repeats the sequence indefinitely.
* @returns {Observable} The observable sequence producing the elements of the given sequence repeatedly.
*/
observableProto.repeat = function (repeatCount) {
return enumerableRepeat(this, repeatCount).concat();
};
/**
* Repeats the source observable sequence the specified number of times or until it successfully terminates. If the retry count is not specified, it retries indefinitely.
* Note if you encounter an error and want it to retry once, then you must use .retry(2);
*
* @example
* var res = retried = retry.repeat();
* var res = retried = retry.repeat(2);
* @param {Number} [retryCount] Number of times to retry the sequence. If not provided, retry the sequence indefinitely.
* @returns {Observable} An observable sequence producing the elements of the given sequence repeatedly until it terminates successfully.
*/
observableProto.retry = function (retryCount) {
return enumerableRepeat(this, retryCount).catchException();
};
/**
* Applies an accumulator function over an observable sequence and returns each intermediate result. The optional seed value is used as the initial accumulator value.
* For aggregation behavior with no intermediate results, see Observable.aggregate.
* @example
* var res = source.scan(function (acc, x) { return acc + x; });
* var res = source.scan(0, function (acc, x) { return acc + x; });
* @param {Mixed} [seed] The initial accumulator value.
* @param {Function} accumulator An accumulator function to be invoked on each element.
* @returns {Observable} An observable sequence containing the accumulated values.
*/
observableProto.scan = function () {
var hasSeed = false, seed, accumulator, source = this;
if (arguments.length === 2) {
hasSeed = true;
seed = arguments[0];
accumulator = arguments[1];
} else {
accumulator = arguments[0];
}
return new AnonymousObservable(function (observer) {
var hasAccumulation, accumulation, hasValue;
return source.subscribe (
function (x) {
try {
if (!hasValue) {
hasValue = true;
}
if (hasAccumulation) {
accumulation = accumulator(accumulation, x);
} else {
accumulation = hasSeed ? accumulator(seed, x) : x;
hasAccumulation = true;
}
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(accumulation);
},
observer.onError.bind(observer),
function () {
if (!hasValue && hasSeed) {
observer.onNext(seed);
}
observer.onCompleted();
}
);
});
};
/**
* Bypasses a specified number of elements at the end of an observable sequence.
* @description
* This operator accumulates a queue with a length enough to store the first `count` elements. As more elements are
* received, elements are taken from the front of the queue and produced on the result sequence. This causes elements to be delayed.
* @param count Number of elements to bypass at the end of the source sequence.
* @returns {Observable} An observable sequence containing the source sequence elements except for the bypassed ones at the end.
*/
observableProto.skipLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
if (q.length > count) {
observer.onNext(q.shift());
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Prepends a sequence of values to an observable sequence with an optional scheduler and an argument list of values to prepend.
*
* var res = source.startWith(1, 2, 3);
* var res = source.startWith(Rx.Scheduler.timeout, 1, 2, 3);
*
* @memberOf Observable#
* @returns {Observable} The source sequence prepended with the specified values.
*/
observableProto.startWith = function () {
var values, scheduler, start = 0;
if (!!arguments.length && 'now' in Object(arguments[0])) {
scheduler = arguments[0];
start = 1;
} else {
scheduler = immediateScheduler;
}
values = slice.call(arguments, start);
return enumerableFor([observableFromArray(values, scheduler), this]).concat();
};
/**
* Returns a specified number of contiguous elements from the end of an observable sequence.
*
* @example
* var res = source.takeLast(5);
*
* @description
* This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
* the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing the specified number of elements from the end of the source sequence.
*/
observableProto.takeLast = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
while(q.length > 0) { observer.onNext(q.shift()); }
observer.onCompleted();
});
});
};
/**
* Returns an array with the specified number of contiguous elements from the end of an observable sequence.
*
* @description
* This operator accumulates a buffer with a length enough to store count elements. Upon completion of the
* source sequence, this buffer is produced on the result sequence.
* @param {Number} count Number of elements to take from the end of the source sequence.
* @returns {Observable} An observable sequence containing a single array with the specified number of elements from the end of the source sequence.
*/
observableProto.takeLastBuffer = function (count) {
var source = this;
return new AnonymousObservable(function (observer) {
var q = [];
return source.subscribe(function (x) {
q.push(x);
q.length > count && q.shift();
}, observer.onError.bind(observer), function () {
observer.onNext(q);
observer.onCompleted();
});
});
};
/**
* Projects each element of an observable sequence into zero or more windows which are produced based on element count information.
*
* var res = xs.windowWithCount(10);
* var res = xs.windowWithCount(10, 1);
* @param {Number} count Length of each window.
* @param {Number} [skip] Number of elements to skip between creation of consecutive windows. If not specified, defaults to the count.
* @returns {Observable} An observable sequence of windows.
*/
observableProto.windowWithCount = function (count, skip) {
var source = this;
if (count <= 0) {
throw new Error(argumentOutOfRange);
}
if (arguments.length === 1) {
skip = count;
}
if (skip <= 0) {
throw new Error(argumentOutOfRange);
}
return new AnonymousObservable(function (observer) {
var m = new SingleAssignmentDisposable(),
refCountDisposable = new RefCountDisposable(m),
n = 0,
q = [],
createWindow = function () {
var s = new Subject();
q.push(s);
observer.onNext(addRef(s, refCountDisposable));
};
createWindow();
m.setDisposable(source.subscribe(function (x) {
var s;
for (var i = 0, len = q.length; i < len; i++) {
q[i].onNext(x);
}
var c = n - count + 1;
if (c >= 0 && c % skip === 0) {
s = q.shift();
s.onCompleted();
}
n++;
if (n % skip === 0) {
createWindow();
}
}, function (exception) {
while (q.length > 0) {
q.shift().onError(exception);
}
observer.onError(exception);
}, function () {
while (q.length > 0) {
q.shift().onCompleted();
}
observer.onCompleted();
}));
return refCountDisposable;
});
};
function concatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i);
return isPromise(result) ? observableFromPromise(result) : result;
}).concatAll();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.concatMap(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.concatMap(Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectConcat = observableProto.concatMap = function (selector, resultSelector, thisArg) {
if (resultSelector) {
return this.concatMap(function (x, i) {
var selectorResult = selector(x, i),
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
return result.map(function (y) {
return resultSelector(x, y, i);
});
});
}
return typeof selector === 'function' ?
concatMap(this, selector, thisArg) :
concatMap(this, function () { return selector; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and concats the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.concatMapObserver = observableProto.selectConcatObserver = function(onNext, onError, onCompleted, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNext.call(thisArg, x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onError.call(thisArg, err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompleted.call(thisArg);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}).concatAll();
};
/**
* Returns the elements of the specified sequence or the specified value in a singleton sequence if the sequence is empty.
*
* var res = obs = xs.defaultIfEmpty();
* 2 - obs = xs.defaultIfEmpty(false);
*
* @memberOf Observable#
* @param defaultValue The value to return if the sequence is empty. If not provided, this defaults to null.
* @returns {Observable} An observable sequence that contains the specified default value if the source is empty; otherwise, the elements of the source itself.
*/
observableProto.defaultIfEmpty = function (defaultValue) {
var source = this;
if (defaultValue === undefined) {
defaultValue = null;
}
return new AnonymousObservable(function (observer) {
var found = false;
return source.subscribe(function (x) {
found = true;
observer.onNext(x);
}, observer.onError.bind(observer), function () {
if (!found) {
observer.onNext(defaultValue);
}
observer.onCompleted();
});
});
};
// Swap out for Array.findIndex
function arrayIndexOfComparer(array, item, comparer) {
for (var i = 0, len = array.length; i < len; i++) {
if (comparer(array[i], item)) { return i; }
}
return -1;
}
function HashSet(comparer) {
this.comparer = comparer;
this.set = [];
}
HashSet.prototype.push = function(value) {
var retValue = arrayIndexOfComparer(this.set, value, this.comparer) === -1;
retValue && this.set.push(value);
return retValue;
};
/**
* Returns an observable sequence that contains only distinct elements according to the keySelector and the comparer.
* Usage of this operator should be considered carefully due to the maintenance of an internal lookup structure which can grow large.
*
* @example
* var res = obs = xs.distinct();
* 2 - obs = xs.distinct(function (x) { return x.id; });
* 2 - obs = xs.distinct(function (x) { return x.id; }, function (a,b) { return a === b; });
* @param {Function} [keySelector] A function to compute the comparison key for each element.
* @param {Function} [comparer] Used to compare items in the collection.
* @returns {Observable} An observable sequence only containing the distinct elements, based on a computed key value, from the source sequence.
*/
observableProto.distinct = function (keySelector, comparer) {
var source = this;
comparer || (comparer = defaultComparer);
return new AnonymousObservable(function (observer) {
var hashSet = new HashSet(comparer);
return source.subscribe(function (x) {
var key = x;
if (keySelector) {
try {
key = keySelector(x);
} catch (e) {
observer.onError(e);
return;
}
}
hashSet.push(key) && observer.onNext(x);
},
observer.onError.bind(observer),
observer.onCompleted.bind(observer));
});
};
/**
* Projects each element of an observable sequence into a new form by incorporating the element's index.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source.
*/
observableProto.select = observableProto.map = function (selector, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var result;
try {
result = selector.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
observer.onNext(result);
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Retrieves the value of a specified property from all elements in the Observable sequence.
* @param {String} property The property to pluck.
* @returns {Observable} Returns a new Observable sequence of property values.
*/
observableProto.pluck = function (property) {
return this.select(function (x) { return x[property]; });
};
/**
* Projects each notification of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
* @param {Function} onNext A transform function to apply to each element; the second parameter of the function represents the index of the source element.
* @param {Function} onError A transform function to apply when an error occurs in the source sequence.
* @param {Function} onCompleted A transform function to apply when the end of the source sequence is reached.
* @param {Any} [thisArg] An optional "this" to use to invoke each transform.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function corresponding to each notification in the input sequence.
*/
observableProto.flatMapObserver = observableProto.selectManyObserver = function (onNext, onError, onCompleted, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var index = 0;
return source.subscribe(
function (x) {
var result;
try {
result = onNext.call(thisArg, x, index++);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
},
function (err) {
var result;
try {
result = onError.call(thisArg, err);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
},
function () {
var result;
try {
result = onCompleted.call(thisArg);
} catch (e) {
observer.onError(e);
return;
}
isPromise(result) && (result = observableFromPromise(result));
observer.onNext(result);
observer.onCompleted();
});
}).mergeAll();
};
function flatMap(source, selector, thisArg) {
return source.map(function (x, i) {
var result = selector.call(thisArg, x, i);
return isPromise(result) ? observableFromPromise(result) : result;
}).mergeObservable();
}
/**
* One of the Following:
* Projects each element of an observable sequence to an observable sequence and merges the resulting observable sequences into one observable sequence.
*
* @example
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); });
* Or:
* Projects each element of an observable sequence to an observable sequence, invokes the result selector for the source element and each of the corresponding inner sequence's elements, and merges the results into one observable sequence.
*
* var res = source.selectMany(function (x) { return Rx.Observable.range(0, x); }, function (x, y) { return x + y; });
* Or:
* Projects each element of the source observable sequence to the other observable sequence and merges the resulting observable sequences into one observable sequence.
*
* var res = source.selectMany(Rx.Observable.fromArray([1,2,3]));
* @param selector A transform function to apply to each element or an observable sequence to project each element from the
* source sequence onto which could be either an observable or Promise.
* @param {Function} [resultSelector] A transform function to apply to each element of the intermediate sequence.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the one-to-many transform function collectionSelector on each element of the input sequence and then mapping each of those sequence elements and their corresponding source element to a result element.
*/
observableProto.selectMany = observableProto.flatMap = function (selector, resultSelector, thisArg) {
if (resultSelector) {
return this.flatMap(function (x, i) {
var selectorResult = selector(x, i),
result = isPromise(selectorResult) ? observableFromPromise(selectorResult) : selectorResult;
return result.map(function (y) {
return resultSelector(x, y, i);
});
}, thisArg);
}
return typeof selector === 'function' ?
flatMap(this, selector, thisArg) :
flatMap(this, function () { return selector; });
};
/**
* Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then
* transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.
* @param {Function} selector A transform function to apply to each source element; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence whose elements are the result of invoking the transform function on each element of source producing an Observable of Observable sequences
* and that at any point in time produces the elements of the most recent inner observable sequence that has been received.
*/
observableProto.selectSwitch = observableProto.flatMapLatest = observableProto.switchMap = function (selector, thisArg) {
return this.select(selector, thisArg).switchLatest();
};
/**
* Bypasses a specified number of elements in an observable sequence and then returns the remaining elements.
* @param {Number} count The number of elements to skip before returning the remaining elements.
* @returns {Observable} An observable sequence that contains the elements that occur after the specified index in the input sequence.
*/
observableProto.skip = function (count) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining <= 0) {
observer.onNext(x);
} else {
remaining--;
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Bypasses elements in an observable sequence as long as a specified condition is true and then returns the remaining elements.
* The element's index is used in the logic of the predicate function.
*
* var res = source.skipWhile(function (value) { return value < 10; });
* var res = source.skipWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence starting at the first element in the linear series that does not pass the test specified by predicate.
*/
observableProto.skipWhile = function (predicate, thisArg) {
var source = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = false;
return source.subscribe(function (x) {
if (!running) {
try {
running = !predicate.call(thisArg, x, i++, source);
} catch (e) {
observer.onError(e);
return;
}
}
if (running) {
observer.onNext(x);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns a specified number of contiguous elements from the start of an observable sequence, using the specified scheduler for the edge case of take(0).
*
* var res = source.take(5);
* var res = source.take(0, Rx.Scheduler.timeout);
* @param {Number} count The number of elements to return.
* @param {Scheduler} [scheduler] Scheduler used to produce an OnCompleted message in case <paramref name="count count</paramref> is set to 0.
* @returns {Observable} An observable sequence that contains the specified number of elements from the start of the input sequence.
*/
observableProto.take = function (count, scheduler) {
if (count < 0) {
throw new Error(argumentOutOfRange);
}
if (count === 0) {
return observableEmpty(scheduler);
}
var observable = this;
return new AnonymousObservable(function (observer) {
var remaining = count;
return observable.subscribe(function (x) {
if (remaining > 0) {
remaining--;
observer.onNext(x);
if (remaining === 0) {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Returns elements from an observable sequence as long as a specified condition is true.
* The element's index is used in the logic of the predicate function.
*
* @example
* var res = source.takeWhile(function (value) { return value < 10; });
* var res = source.takeWhile(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
*/
observableProto.takeWhile = function (predicate, thisArg) {
var observable = this;
return new AnonymousObservable(function (observer) {
var i = 0, running = true;
return observable.subscribe(function (x) {
if (running) {
try {
running = predicate.call(thisArg, x, i++, observable);
} catch (e) {
observer.onError(e);
return;
}
if (running) {
observer.onNext(x);
} else {
observer.onCompleted();
}
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/**
* Filters the elements of an observable sequence based on a predicate by incorporating the element's index.
*
* @example
* var res = source.where(function (value) { return value < 10; });
* var res = source.where(function (value, index) { return value < 10 || index < 10; });
* @param {Function} predicate A function to test each source element for a condition; the second parameter of the function represents the index of the source element.
* @param {Any} [thisArg] Object to use as this when executing callback.
* @returns {Observable} An observable sequence that contains elements from the input sequence that satisfy the condition.
*/
observableProto.where = observableProto.filter = function (predicate, thisArg) {
var parent = this;
return new AnonymousObservable(function (observer) {
var count = 0;
return parent.subscribe(function (value) {
var shouldRun;
try {
shouldRun = predicate.call(thisArg, value, count++, parent);
} catch (exception) {
observer.onError(exception);
return;
}
if (shouldRun) {
observer.onNext(value);
}
}, observer.onError.bind(observer), observer.onCompleted.bind(observer));
});
};
/*
* Performs a exclusive waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @returns {Observable} A exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusive = function () {
var sources = this;
return new AnonymousObservable(function (observer) {
var hasCurrent = false,
isStopped = false,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
var innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
innerSubscription.setDisposable(innerSource.subscribe(
observer.onNext.bind(observer),
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (!hasCurrent && g.length === 1) {
observer.onCompleted();
}
}));
return g;
});
};
/*
* Performs a exclusive map waiting for the first to finish before subscribing to another observable.
* Observables that come in between subscriptions will be dropped on the floor.
* @param {Function} selector Selector to invoke for every item in the current subscription.
* @param {Any} [thisArg] An optional context to invoke with the selector parameter.
* @returns {Observable} An exclusive observable with only the results that happen when subscribed.
*/
observableProto.exclusiveMap = function (selector, thisArg) {
var sources = this;
return new AnonymousObservable(function (observer) {
var index = 0,
hasCurrent = false,
isStopped = true,
m = new SingleAssignmentDisposable(),
g = new CompositeDisposable();
g.add(m);
m.setDisposable(sources.subscribe(
function (innerSource) {
if (!hasCurrent) {
hasCurrent = true;
innerSubscription = new SingleAssignmentDisposable();
g.add(innerSubscription);
isPromise(innerSource) && (innerSource = observableFromPromise(innerSource));
innerSubscription.setDisposable(innerSource.subscribe(
function (x) {
var result;
try {
result = selector.call(thisArg, x, index++, innerSource);
} catch (e) {
observer.onError(e);
return;
}
observer.onNext(result);
},
observer.onError.bind(observer),
function () {
g.remove(innerSubscription);
hasCurrent = false;
if (isStopped && g.length === 1) {
observer.onCompleted();
}
}));
}
},
observer.onError.bind(observer),
function () {
isStopped = true;
if (g.length === 1 && !hasCurrent) {
observer.onCompleted();
}
}));
return g;
});
};
var AnonymousObservable = Rx.AnonymousObservable = (function (__super__) {
inherits(AnonymousObservable, __super__);
// Fix subscriber to check for undefined or function returned to decorate as Disposable
function fixSubscriber(subscriber) {
if (subscriber && typeof subscriber.dispose === 'function') { return subscriber; }
return typeof subscriber === 'function' ?
disposableCreate(subscriber) :
disposableEmpty;
}
function AnonymousObservable(subscribe) {
if (!(this instanceof AnonymousObservable)) {
return new AnonymousObservable(subscribe);
}
function s(observer) {
var setDisposable = function () {
try {
autoDetachObserver.setDisposable(fixSubscriber(subscribe(autoDetachObserver)));
} catch (e) {
if (!autoDetachObserver.fail(e)) {
throw e;
}
}
};
var autoDetachObserver = new AutoDetachObserver(observer);
if (currentThreadScheduler.scheduleRequired()) {
currentThreadScheduler.schedule(setDisposable);
} else {
setDisposable();
}
return autoDetachObserver;
}
__super__.call(this, s);
}
return AnonymousObservable;
}(Observable));
/** @private */
var AutoDetachObserver = (function (_super) {
inherits(AutoDetachObserver, _super);
function AutoDetachObserver(observer) {
_super.call(this);
this.observer = observer;
this.m = new SingleAssignmentDisposable();
}
var AutoDetachObserverPrototype = AutoDetachObserver.prototype;
AutoDetachObserverPrototype.next = function (value) {
var noError = false;
try {
this.observer.onNext(value);
noError = true;
} catch (e) {
throw e;
} finally {
if (!noError) {
this.dispose();
}
}
};
AutoDetachObserverPrototype.error = function (exn) {
try {
this.observer.onError(exn);
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.completed = function () {
try {
this.observer.onCompleted();
} catch (e) {
throw e;
} finally {
this.dispose();
}
};
AutoDetachObserverPrototype.setDisposable = function (value) { this.m.setDisposable(value); };
AutoDetachObserverPrototype.getDisposable = function (value) { return this.m.getDisposable(); };
/* @private */
AutoDetachObserverPrototype.disposable = function (value) {
return arguments.length ? this.getDisposable() : setDisposable(value);
};
AutoDetachObserverPrototype.dispose = function () {
_super.prototype.dispose.call(this);
this.m.dispose();
};
return AutoDetachObserver;
}(AbstractObserver));
/** @private */
var InnerSubscription = function (subject, observer) {
this.subject = subject;
this.observer = observer;
};
/**
* @private
* @memberOf InnerSubscription
*/
InnerSubscription.prototype.dispose = function () {
if (!this.subject.isDisposed && this.observer !== null) {
var idx = this.subject.observers.indexOf(this.observer);
this.subject.observers.splice(idx, 1);
this.observer = null;
}
};
/**
* Represents an object that is both an observable sequence as well as an observer.
* Each notification is broadcasted to all subscribed observers.
*/
var Subject = Rx.Subject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
if (this.exception) {
observer.onError(this.exception);
return disposableEmpty;
}
observer.onCompleted();
return disposableEmpty;
}
inherits(Subject, _super);
/**
* Creates a subject.
* @constructor
*/
function Subject() {
_super.call(this, subscribe);
this.isDisposed = false,
this.isStopped = false,
this.observers = [];
}
addProperties(Subject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence.
*/
onCompleted: function () {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the arrival of the specified element in the sequence.
* @param {Mixed} value The value to send to all observers.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
for (var i = 0, len = os.length; i < len; i++) {
os[i].onNext(value);
}
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
}
});
/**
* Creates a subject from the specified observer and observable.
* @param {Observer} observer The observer used to send messages to the subject.
* @param {Observable} observable The observable used to subscribe to messages sent from the subject.
* @returns {Subject} Subject implemented using the given observer and observable.
*/
Subject.create = function (observer, observable) {
return new AnonymousSubject(observer, observable);
};
return Subject;
}(Observable));
/**
* Represents the result of an asynchronous operation.
* The last value before the OnCompleted notification, or the error received through OnError, is sent to all subscribed observers.
*/
var AsyncSubject = Rx.AsyncSubject = (function (_super) {
function subscribe(observer) {
checkDisposed.call(this);
if (!this.isStopped) {
this.observers.push(observer);
return new InnerSubscription(this, observer);
}
var ex = this.exception,
hv = this.hasValue,
v = this.value;
if (ex) {
observer.onError(ex);
} else if (hv) {
observer.onNext(v);
observer.onCompleted();
} else {
observer.onCompleted();
}
return disposableEmpty;
}
inherits(AsyncSubject, _super);
/**
* Creates a subject that can only receive one value and that value is cached for all future observations.
* @constructor
*/
function AsyncSubject() {
_super.call(this, subscribe);
this.isDisposed = false;
this.isStopped = false;
this.value = null;
this.hasValue = false;
this.observers = [];
this.exception = null;
}
addProperties(AsyncSubject.prototype, Observer, {
/**
* Indicates whether the subject has observers subscribed to it.
* @returns {Boolean} Indicates whether the subject has observers subscribed to it.
*/
hasObservers: function () {
checkDisposed.call(this);
return this.observers.length > 0;
},
/**
* Notifies all subscribed observers about the end of the sequence, also causing the last received value to be sent out (if any).
*/
onCompleted: function () {
var o, i, len;
checkDisposed.call(this);
if (!this.isStopped) {
this.isStopped = true;
var os = this.observers.slice(0),
v = this.value,
hv = this.hasValue;
if (hv) {
for (i = 0, len = os.length; i < len; i++) {
o = os[i];
o.onNext(v);
o.onCompleted();
}
} else {
for (i = 0, len = os.length; i < len; i++) {
os[i].onCompleted();
}
}
this.observers = [];
}
},
/**
* Notifies all subscribed observers about the exception.
* @param {Mixed} error The exception to send to all observers.
*/
onError: function (exception) {
checkDisposed.call(this);
if (!this.isStopped) {
var os = this.observers.slice(0);
this.isStopped = true;
this.exception = exception;
for (var i = 0, len = os.length; i < len; i++) {
os[i].onError(exception);
}
this.observers = [];
}
},
/**
* Sends a value to the subject. The last value received before successful termination will be sent to all subscribed and future observers.
* @param {Mixed} value The value to store in the subject.
*/
onNext: function (value) {
checkDisposed.call(this);
if (!this.isStopped) {
this.value = value;
this.hasValue = true;
}
},
/**
* Unsubscribe all observers and release resources.
*/
dispose: function () {
this.isDisposed = true;
this.observers = null;
this.exception = null;
this.value = null;
}
});
return AsyncSubject;
}(Observable));
var AnonymousSubject = Rx.AnonymousSubject = (function (__super__) {
inherits(AnonymousSubject, __super__);
function AnonymousSubject(observer, observable) {
this.observer = observer;
this.observable = observable;
__super__.call(this, this.observable.subscribe.bind(this.observable));
}
addProperties(AnonymousSubject.prototype, Observer, {
onCompleted: function () {
this.observer.onCompleted();
},
onError: function (exception) {
this.observer.onError(exception);
},
onNext: function (value) {
this.observer.onNext(value);
}
});
return AnonymousSubject;
}(Observable));
if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) {
root.Rx = Rx;
define(function() {
return Rx;
});
} else if (freeExports && freeModule) {
// in Node.js or RingoJS
if (moduleExports) {
(freeModule.exports = Rx).Rx = Rx;
} else {
freeExports.Rx = Rx;
}
} else {
// in a browser or Rhino
root.Rx = Rx;
}
}.call(this));
|
tp-3/recursos/react-slingshot/src/components/pages/welcome/WelcomePage.js
|
solp/sovos-reactivo-2017
|
import React from 'react';
// Since this component is simple and static, there's no parent container for it.
const WelcomePage = () => {
return (
<div>
<h2 className="alt-header">Bienvenido a Sovosiano! </h2>
<p>
Esta es la pagina estatica de bienvenida solamente. Tu tendras que hacer una como la gente.
</p>
</div>
);
};
export default WelcomePage;
|
example/screens/CustomMapStyle.js
|
hlz2103/SwipeMe
|
import React from 'react';
import {
StyleSheet,
View,
Dimensions,
} from 'react-native';
import MapView from 'react-native-maps';
const { width, height } = Dimensions.get('window');
const ASPECT_RATIO = width / height;
const LATITUDE = 37.78825;
const LONGITUDE = -122.4324;
const LATITUDE_DELTA = 0.0922;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
const customStyle = [
{
elementType: 'geometry',
stylers: [
{
color: '#242f3e',
},
],
},
{
elementType: 'labels.text.fill',
stylers: [
{
color: '#746855',
},
],
},
{
elementType: 'labels.text.stroke',
stylers: [
{
color: '#242f3e',
},
],
},
{
featureType: 'administrative.locality',
elementType: 'labels.text.fill',
stylers: [
{
color: '#d59563',
},
],
},
{
featureType: 'poi',
elementType: 'labels.text.fill',
stylers: [
{
color: '#d59563',
},
],
},
{
featureType: 'poi.park',
elementType: 'geometry',
stylers: [
{
color: '#263c3f',
},
],
},
{
featureType: 'poi.park',
elementType: 'labels.text.fill',
stylers: [
{
color: '#6b9a76',
},
],
},
{
featureType: 'road',
elementType: 'geometry',
stylers: [
{
color: '#38414e',
},
],
},
{
featureType: 'road',
elementType: 'geometry.stroke',
stylers: [
{
color: '#212a37',
},
],
},
{
featureType: 'road',
elementType: 'labels.text.fill',
stylers: [
{
color: '#9ca5b3',
},
],
},
{
featureType: 'road.highway',
elementType: 'geometry',
stylers: [
{
color: '#746855',
},
],
},
{
featureType: 'road.highway',
elementType: 'geometry.stroke',
stylers: [
{
color: '#1f2835',
},
],
},
{
featureType: 'road.highway',
elementType: 'labels.text.fill',
stylers: [
{
color: '#f3d19c',
},
],
},
{
featureType: 'transit',
elementType: 'geometry',
stylers: [
{
color: '#2f3948',
},
],
},
{
featureType: 'transit.station',
elementType: 'labels.text.fill',
stylers: [
{
color: '#d59563',
},
],
},
{
featureType: 'water',
elementType: 'geometry',
stylers: [
{
color: '#17263c',
},
],
},
{
featureType: 'water',
elementType: 'labels.text.fill',
stylers: [
{
color: '#515c6d',
},
],
},
{
featureType: 'water',
elementType: 'labels.text.stroke',
stylers: [
{
color: '#17263c',
},
],
},
];
class MapStyle extends React.Component {
constructor(props) {
super(props);
this.state = {
};
}
render() {
return (
<View style={styles.container}>
<MapView
provider={this.props.provider}
style={styles.map}
initialRegion={{
latitude: LATITUDE,
longitude: LONGITUDE,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
}}
customMapStyle={customStyle}
/>
</View>
);
}
}
MapStyle.propTypes = {
provider: MapView.ProviderPropType,
};
const styles = StyleSheet.create({
container: {
...StyleSheet.absoluteFillObject,
justifyContent: 'flex-end',
alignItems: 'center',
},
map: {
...StyleSheet.absoluteFillObject,
},
});
module.exports = MapStyle;
|
assets/themes/default/hero_files/jquery.js
|
benesgarage/phoneBlog
|
/*! jQuery v1.7.1 jquery.com | jquery.org/license */
(function( window, undefined ) {
// Use the correct document accordingly with window argument (sandbox)
var document = window.document,
navigator = window.navigator,
location = window.location;
var jQuery = (function() {
// Define a local copy of jQuery
var jQuery = function( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
},
// Map over jQuery in case of overwrite
_jQuery = window.jQuery,
// Map over the $ in case of overwrite
_$ = window.$,
// A central reference to the root jQuery(document)
rootjQuery,
// A simple way to check for HTML strings or ID strings
// Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,
// Check if a string has a non-whitespace character in it
rnotwhite = /\S/,
// Used for trimming whitespace
trimLeft = /^\s+/,
trimRight = /\s+$/,
// Match a standalone tag
rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/,
// JSON RegExp
rvalidchars = /^[\],:{}\s]*$/,
rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,
rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g,
// Useragent RegExp
rwebkit = /(webkit)[ \/]([\w.]+)/,
ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/,
rmsie = /(msie) ([\w.]+)/,
rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/,
// Matches dashed string for camelizing
rdashAlpha = /-([a-z]|[0-9])/ig,
rmsPrefix = /^-ms-/,
// Used by jQuery.camelCase as callback to replace()
fcamelCase = function( all, letter ) {
return ( letter + "" ).toUpperCase();
},
// Keep a UserAgent string for use with jQuery.browser
userAgent = navigator.userAgent,
// For matching the engine and version of the browser
browserMatch,
// The deferred used on DOM ready
readyList,
// The ready event handler
DOMContentLoaded,
// Save a reference to some core methods
toString = Object.prototype.toString,
hasOwn = Object.prototype.hasOwnProperty,
push = Array.prototype.push,
slice = Array.prototype.slice,
trim = String.prototype.trim,
indexOf = Array.prototype.indexOf,
// [[Class]] -> type pairs
class2type = {};
jQuery.fn = jQuery.prototype = {
constructor: jQuery,
init: function( selector, context, rootjQuery ) {
var match, elem, ret, doc;
// Handle $(""), $(null), or $(undefined)
if ( !selector ) {
return this;
}
// Handle $(DOMElement)
if ( selector.nodeType ) {
this.context = this[0] = selector;
this.length = 1;
return this;
}
// The body element only exists once, optimize finding it
if ( selector === "body" && !context && document.body ) {
this.context = document;
this[0] = document.body;
this.selector = selector;
this.length = 1;
return this;
}
// Handle HTML strings
if ( typeof selector === "string" ) {
// Are we dealing with HTML string or an ID?
if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) {
// Assume that strings that start and end with <> are HTML and skip the regex check
match = [ null, selector, null ];
} else {
match = quickExpr.exec( selector );
}
// Verify a match, and that no context was specified for #id
if ( match && (match[1] || !context) ) {
// HANDLE: $(html) -> $(array)
if ( match[1] ) {
context = context instanceof jQuery ? context[0] : context;
doc = ( context ? context.ownerDocument || context : document );
// If a single string is passed in and it's a single tag
// just do a createElement and skip the rest
ret = rsingleTag.exec( selector );
if ( ret ) {
if ( jQuery.isPlainObject( context ) ) {
selector = [ document.createElement( ret[1] ) ];
jQuery.fn.attr.call( selector, context, true );
} else {
selector = [ doc.createElement( ret[1] ) ];
}
} else {
ret = jQuery.buildFragment( [ match[1] ], [ doc ] );
selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes;
}
return jQuery.merge( this, selector );
// HANDLE: $("#id")
} else {
elem = document.getElementById( match[2] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id !== match[2] ) {
return rootjQuery.find( selector );
}
// Otherwise, we inject the element directly into the jQuery object
this.length = 1;
this[0] = elem;
}
this.context = document;
this.selector = selector;
return this;
}
// HANDLE: $(expr, $(...))
} else if ( !context || context.jquery ) {
return ( context || rootjQuery ).find( selector );
// HANDLE: $(expr, context)
// (which is just equivalent to: $(context).find(expr)
} else {
return this.constructor( context ).find( selector );
}
// HANDLE: $(function)
// Shortcut for document ready
} else if ( jQuery.isFunction( selector ) ) {
return rootjQuery.ready( selector );
}
if ( selector.selector !== undefined ) {
this.selector = selector.selector;
this.context = selector.context;
}
return jQuery.makeArray( selector, this );
},
// Start with an empty selector
selector: "",
// The current version of jQuery being used
jquery: "1.7.1",
// The default length of a jQuery object is 0
length: 0,
// The number of elements contained in the matched element set
size: function() {
return this.length;
},
toArray: function() {
return slice.call( this, 0 );
},
// Get the Nth element in the matched element set OR
// Get the whole matched element set as a clean array
get: function( num ) {
return num == null ?
// Return a 'clean' array
this.toArray() :
// Return just the object
( num < 0 ? this[ this.length + num ] : this[ num ] );
},
// Take an array of elements and push it onto the stack
// (returning the new matched element set)
pushStack: function( elems, name, selector ) {
// Build a new jQuery matched element set
var ret = this.constructor();
if ( jQuery.isArray( elems ) ) {
push.apply( ret, elems );
} else {
jQuery.merge( ret, elems );
}
// Add the old object onto the stack (as a reference)
ret.prevObject = this;
ret.context = this.context;
if ( name === "find" ) {
ret.selector = this.selector + ( this.selector ? " " : "" ) + selector;
} else if ( name ) {
ret.selector = this.selector + "." + name + "(" + selector + ")";
}
// Return the newly-formed element set
return ret;
},
// Execute a callback for every element in the matched set.
// (You can seed the arguments with an array of args, but this is
// only used internally.)
each: function( callback, args ) {
return jQuery.each( this, callback, args );
},
ready: function( fn ) {
// Attach the listeners
jQuery.bindReady();
// Add the callback
readyList.add( fn );
return this;
},
eq: function( i ) {
i = +i;
return i === -1 ?
this.slice( i ) :
this.slice( i, i + 1 );
},
first: function() {
return this.eq( 0 );
},
last: function() {
return this.eq( -1 );
},
slice: function() {
return this.pushStack( slice.apply( this, arguments ),
"slice", slice.call(arguments).join(",") );
},
map: function( callback ) {
return this.pushStack( jQuery.map(this, function( elem, i ) {
return callback.call( elem, i, elem );
}));
},
end: function() {
return this.prevObject || this.constructor(null);
},
// For internal use only.
// Behaves like an Array's method, not like a jQuery method.
push: push,
sort: [].sort,
splice: [].splice
};
// Give the init function the jQuery prototype for later instantiation
jQuery.fn.init.prototype = jQuery.fn;
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
target = arguments[1] || {};
// skip the boolean and the target
i = 2;
}
// Handle case when target is a string or something (possible in deep copy)
if ( typeof target !== "object" && !jQuery.isFunction(target) ) {
target = {};
}
// extend jQuery itself if only one argument is passed
if ( length === i ) {
target = this;
--i;
}
for ( ; i < length; i++ ) {
// Only deal with non-null/undefined values
if ( (options = arguments[ i ]) != null ) {
// Extend the base object
for ( name in options ) {
src = target[ name ];
copy = options[ name ];
// Prevent never-ending loop
if ( target === copy ) {
continue;
}
// Recurse if we're merging plain objects or arrays
if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) {
if ( copyIsArray ) {
copyIsArray = false;
clone = src && jQuery.isArray(src) ? src : [];
} else {
clone = src && jQuery.isPlainObject(src) ? src : {};
}
// Never move original objects, clone them
target[ name ] = jQuery.extend( deep, clone, copy );
// Don't bring in undefined values
} else if ( copy !== undefined ) {
target[ name ] = copy;
}
}
}
}
// Return the modified object
return target;
};
jQuery.extend({
noConflict: function( deep ) {
if ( window.$ === jQuery ) {
window.$ = _$;
}
if ( deep && window.jQuery === jQuery ) {
window.jQuery = _jQuery;
}
return jQuery;
},
// Is the DOM ready to be used? Set to true once it occurs.
isReady: false,
// A counter to track how many items to wait for before
// the ready event fires. See #6781
readyWait: 1,
// Hold (or release) the ready event
holdReady: function( hold ) {
if ( hold ) {
jQuery.readyWait++;
} else {
jQuery.ready( true );
}
},
// Handle when the DOM is ready
ready: function( wait ) {
// Either a released hold or an DOMready/load event and not yet ready
if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( !document.body ) {
return setTimeout( jQuery.ready, 1 );
}
// Remember that the DOM is ready
jQuery.isReady = true;
// If a normal DOM Ready event fired, decrement, and wait if need be
if ( wait !== true && --jQuery.readyWait > 0 ) {
return;
}
// If there are functions bound, to execute
readyList.fireWith( document, [ jQuery ] );
// Trigger any bound ready events
if ( jQuery.fn.trigger ) {
jQuery( document ).trigger( "ready" ).off( "ready" );
}
}
},
bindReady: function() {
if ( readyList ) {
return;
}
readyList = jQuery.Callbacks( "once memory" );
// Catch cases where $(document).ready() is called after the
// browser event has already occurred.
if ( document.readyState === "complete" ) {
// Handle it asynchronously to allow scripts the opportunity to delay ready
return setTimeout( jQuery.ready, 1 );
}
// Mozilla, Opera and webkit nightlies currently support this event
if ( document.addEventListener ) {
// Use the handy event callback
document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false );
// A fallback to window.onload, that will always work
window.addEventListener( "load", jQuery.ready, false );
// If IE event model is used
} else if ( document.attachEvent ) {
// ensure firing before onload,
// maybe late but safe also for iframes
document.attachEvent( "onreadystatechange", DOMContentLoaded );
// A fallback to window.onload, that will always work
window.attachEvent( "onload", jQuery.ready );
// If IE and not a frame
// continually check to see if the document is ready
var toplevel = false;
try {
toplevel = window.frameElement == null;
} catch(e) {}
if ( document.documentElement.doScroll && toplevel ) {
doScrollCheck();
}
}
},
// See test/unit/core.js for details concerning isFunction.
// Since version 1.3, DOM methods and functions like alert
// aren't supported. They return false on IE (#2968).
isFunction: function( obj ) {
return jQuery.type(obj) === "function";
},
isArray: Array.isArray || function( obj ) {
return jQuery.type(obj) === "array";
},
// A crude way of determining if an object is a window
isWindow: function( obj ) {
return obj && typeof obj === "object" && "setInterval" in obj;
},
isNumeric: function( obj ) {
return !isNaN( parseFloat(obj) ) && isFinite( obj );
},
type: function( obj ) {
return obj == null ?
String( obj ) :
class2type[ toString.call(obj) ] || "object";
},
isPlainObject: function( obj ) {
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!hasOwn.call(obj, "constructor") &&
!hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
var key;
for ( key in obj ) {}
return key === undefined || hasOwn.call( obj, key );
},
isEmptyObject: function( obj ) {
for ( var name in obj ) {
return false;
}
return true;
},
error: function( msg ) {
throw new Error( msg );
},
parseJSON: function( data ) {
if ( typeof data !== "string" || !data ) {
return null;
}
// Make sure leading/trailing whitespace is removed (IE can't handle it)
data = jQuery.trim( data );
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );
}
// Make sure the incoming data is actual JSON
// Logic borrowed from http://json.org/json2.js
if ( rvalidchars.test( data.replace( rvalidescape, "@" )
.replace( rvalidtokens, "]" )
.replace( rvalidbraces, "")) ) {
return ( new Function( "return " + data ) )();
}
jQuery.error( "Invalid JSON: " + data );
},
// Cross-browser xml parsing
parseXML: function( data ) {
var xml, tmp;
try {
if ( window.DOMParser ) { // Standard
tmp = new DOMParser();
xml = tmp.parseFromString( data , "text/xml" );
} else { // IE
xml = new ActiveXObject( "Microsoft.XMLDOM" );
xml.async = "false";
xml.loadXML( data );
}
} catch( e ) {
xml = undefined;
}
if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) {
jQuery.error( "Invalid XML: " + data );
}
return xml;
},
noop: function() {},
// Evaluates a script in a global context
// Workarounds based on findings by Jim Driscoll
// http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context
globalEval: function( data ) {
if ( data && rnotwhite.test( data ) ) {
// We use execScript on Internet Explorer
// We use an anonymous function so that context is window
// rather than jQuery in Firefox
( window.execScript || function( data ) {
window[ "eval" ].call( window, data );
} )( data );
}
},
// Convert dashed to camelCase; used by the css and data modules
// Microsoft forgot to hump their vendor prefix (#9572)
camelCase: function( string ) {
return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
},
nodeName: function( elem, name ) {
return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
},
// args is for internal usage only
each: function( object, callback, args ) {
var name, i = 0,
length = object.length,
isObj = length === undefined || jQuery.isFunction( object );
if ( args ) {
if ( isObj ) {
for ( name in object ) {
if ( callback.apply( object[ name ], args ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.apply( object[ i++ ], args ) === false ) {
break;
}
}
}
// A special, fast, case for the most common use of each
} else {
if ( isObj ) {
for ( name in object ) {
if ( callback.call( object[ name ], name, object[ name ] ) === false ) {
break;
}
}
} else {
for ( ; i < length; ) {
if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) {
break;
}
}
}
}
return object;
},
// Use native String.trim function wherever possible
trim: trim ?
function( text ) {
return text == null ?
"" :
trim.call( text );
} :
// Otherwise use our own trimming functionality
function( text ) {
return text == null ?
"" :
text.toString().replace( trimLeft, "" ).replace( trimRight, "" );
},
// results is for internal usage only
makeArray: function( array, results ) {
var ret = results || [];
if ( array != null ) {
// The window, strings (and functions) also have 'length'
// Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930
var type = jQuery.type( array );
if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) {
push.call( ret, array );
} else {
jQuery.merge( ret, array );
}
}
return ret;
},
inArray: function( elem, array, i ) {
var len;
if ( array ) {
if ( indexOf ) {
return indexOf.call( array, elem, i );
}
len = array.length;
i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0;
for ( ; i < len; i++ ) {
// Skip accessing in sparse arrays
if ( i in array && array[ i ] === elem ) {
return i;
}
}
}
return -1;
},
merge: function( first, second ) {
var i = first.length,
j = 0;
if ( typeof second.length === "number" ) {
for ( var l = second.length; j < l; j++ ) {
first[ i++ ] = second[ j ];
}
} else {
while ( second[j] !== undefined ) {
first[ i++ ] = second[ j++ ];
}
}
first.length = i;
return first;
},
grep: function( elems, callback, inv ) {
var ret = [], retVal;
inv = !!inv;
// Go through the array, only saving the items
// that pass the validator function
for ( var i = 0, length = elems.length; i < length; i++ ) {
retVal = !!callback( elems[ i ], i );
if ( inv !== retVal ) {
ret.push( elems[ i ] );
}
}
return ret;
},
// arg is for internal usage only
map: function( elems, callback, arg ) {
var value, key, ret = [],
i = 0,
length = elems.length,
// jquery objects are treated as arrays
isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ;
// Go through the array, translating each of the items to their
if ( isArray ) {
for ( ; i < length; i++ ) {
value = callback( elems[ i ], i, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
// Go through every key on the object
} else {
for ( key in elems ) {
value = callback( elems[ key ], key, arg );
if ( value != null ) {
ret[ ret.length ] = value;
}
}
}
// Flatten any nested arrays
return ret.concat.apply( [], ret );
},
// A global GUID counter for objects
guid: 1,
// Bind a function to a context, optionally partially applying any
// arguments.
proxy: function( fn, context ) {
if ( typeof context === "string" ) {
var tmp = fn[ context ];
context = fn;
fn = tmp;
}
// Quick check to determine if target is callable, in the spec
// this throws a TypeError, but we will just return undefined.
if ( !jQuery.isFunction( fn ) ) {
return undefined;
}
// Simulated bind
var args = slice.call( arguments, 2 ),
proxy = function() {
return fn.apply( context, args.concat( slice.call( arguments ) ) );
};
// Set the guid of unique handler to the same of original handler, so it can be removed
proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
return proxy;
},
// Mutifunctional method to get and set values to a collection
// The value/s can optionally be executed if it's a function
access: function( elems, key, value, exec, fn, pass ) {
var length = elems.length;
// Setting many attributes
if ( typeof key === "object" ) {
for ( var k in key ) {
jQuery.access( elems, k, key[k], exec, fn, value );
}
return elems;
}
// Setting one attribute
if ( value !== undefined ) {
// Optionally, function values get executed if exec is true
exec = !pass && exec && jQuery.isFunction(value);
for ( var i = 0; i < length; i++ ) {
fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass );
}
return elems;
}
// Getting an attribute
return length ? fn( elems[0], key ) : undefined;
},
now: function() {
return ( new Date() ).getTime();
},
// Use of jQuery.browser is frowned upon.
// More details: http://docs.jquery.com/Utilities/jQuery.browser
uaMatch: function( ua ) {
ua = ua.toLowerCase();
var match = rwebkit.exec( ua ) ||
ropera.exec( ua ) ||
rmsie.exec( ua ) ||
ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) ||
[];
return { browser: match[1] || "", version: match[2] || "0" };
},
sub: function() {
function jQuerySub( selector, context ) {
return new jQuerySub.fn.init( selector, context );
}
jQuery.extend( true, jQuerySub, this );
jQuerySub.superclass = this;
jQuerySub.fn = jQuerySub.prototype = this();
jQuerySub.fn.constructor = jQuerySub;
jQuerySub.sub = this.sub;
jQuerySub.fn.init = function init( selector, context ) {
if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) {
context = jQuerySub( context );
}
return jQuery.fn.init.call( this, selector, context, rootjQuerySub );
};
jQuerySub.fn.init.prototype = jQuerySub.fn;
var rootjQuerySub = jQuerySub(document);
return jQuerySub;
},
browser: {}
});
// Populate the class2type map
jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) {
class2type[ "[object " + name + "]" ] = name.toLowerCase();
});
browserMatch = jQuery.uaMatch( userAgent );
if ( browserMatch.browser ) {
jQuery.browser[ browserMatch.browser ] = true;
jQuery.browser.version = browserMatch.version;
}
// Deprecated, use jQuery.browser.webkit instead
if ( jQuery.browser.webkit ) {
jQuery.browser.safari = true;
}
// IE doesn't match non-breaking spaces with \s
if ( rnotwhite.test( "\xA0" ) ) {
trimLeft = /^[\s\xA0]+/;
trimRight = /[\s\xA0]+$/;
}
// All jQuery objects should point back to these
rootjQuery = jQuery(document);
// Cleanup functions for the document ready method
if ( document.addEventListener ) {
DOMContentLoaded = function() {
document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false );
jQuery.ready();
};
} else if ( document.attachEvent ) {
DOMContentLoaded = function() {
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
if ( document.readyState === "complete" ) {
document.detachEvent( "onreadystatechange", DOMContentLoaded );
jQuery.ready();
}
};
}
// The DOM ready check for Internet Explorer
function doScrollCheck() {
if ( jQuery.isReady ) {
return;
}
try {
// If IE is used, use the trick by Diego Perini
// http://javascript.nwbox.com/IEContentLoaded/
document.documentElement.doScroll("left");
} catch(e) {
setTimeout( doScrollCheck, 1 );
return;
}
// and execute any waiting functions
jQuery.ready();
}
return jQuery;
})();
// String to Object flags format cache
var flagsCache = {};
// Convert String-formatted flags into Object-formatted ones and store in cache
function createFlags( flags ) {
var object = flagsCache[ flags ] = {},
i, length;
flags = flags.split( /\s+/ );
for ( i = 0, length = flags.length; i < length; i++ ) {
object[ flags[i] ] = true;
}
return object;
}
/*
* Create a callback list using the following parameters:
*
* flags: an optional list of space-separated flags that will change how
* the callback list behaves
*
* By default a callback list will act like an event callback list and can be
* "fired" multiple times.
*
* Possible flags:
*
* once: will ensure the callback list can only be fired once (like a Deferred)
*
* memory: will keep track of previous values and will call any callback added
* after the list has been fired right away with the latest "memorized"
* values (like a Deferred)
*
* unique: will ensure a callback can only be added once (no duplicate in the list)
*
* stopOnFalse: interrupt callings when a callback returns false
*
*/
jQuery.Callbacks = function( flags ) {
// Convert flags from String-formatted to Object-formatted
// (we check in cache first)
flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {};
var // Actual callback list
list = [],
// Stack of fire calls for repeatable lists
stack = [],
// Last fire value (for non-forgettable lists)
memory,
// Flag to know if list is currently firing
firing,
// First callback to fire (used internally by add and fireWith)
firingStart,
// End of the loop when firing
firingLength,
// Index of currently firing callback (modified by remove if needed)
firingIndex,
// Add one or several callbacks to the list
add = function( args ) {
var i,
length,
elem,
type,
actual;
for ( i = 0, length = args.length; i < length; i++ ) {
elem = args[ i ];
type = jQuery.type( elem );
if ( type === "array" ) {
// Inspect recursively
add( elem );
} else if ( type === "function" ) {
// Add if not in unique mode and callback is not in
if ( !flags.unique || !self.has( elem ) ) {
list.push( elem );
}
}
}
},
// Fire callbacks
fire = function( context, args ) {
args = args || [];
memory = !flags.memory || [ context, args ];
firing = true;
firingIndex = firingStart || 0;
firingStart = 0;
firingLength = list.length;
for ( ; list && firingIndex < firingLength; firingIndex++ ) {
if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) {
memory = true; // Mark as halted
break;
}
}
firing = false;
if ( list ) {
if ( !flags.once ) {
if ( stack && stack.length ) {
memory = stack.shift();
self.fireWith( memory[ 0 ], memory[ 1 ] );
}
} else if ( memory === true ) {
self.disable();
} else {
list = [];
}
}
},
// Actual Callbacks object
self = {
// Add a callback or a collection of callbacks to the list
add: function() {
if ( list ) {
var length = list.length;
add( arguments );
// Do we need to add the callbacks to the
// current firing batch?
if ( firing ) {
firingLength = list.length;
// With memory, if we're not firing then
// we should call right away, unless previous
// firing was halted (stopOnFalse)
} else if ( memory && memory !== true ) {
firingStart = length;
fire( memory[ 0 ], memory[ 1 ] );
}
}
return this;
},
// Remove a callback from the list
remove: function() {
if ( list ) {
var args = arguments,
argIndex = 0,
argLength = args.length;
for ( ; argIndex < argLength ; argIndex++ ) {
for ( var i = 0; i < list.length; i++ ) {
if ( args[ argIndex ] === list[ i ] ) {
// Handle firingIndex and firingLength
if ( firing ) {
if ( i <= firingLength ) {
firingLength--;
if ( i <= firingIndex ) {
firingIndex--;
}
}
}
// Remove the element
list.splice( i--, 1 );
// If we have some unicity property then
// we only need to do this once
if ( flags.unique ) {
break;
}
}
}
}
}
return this;
},
// Control if a given callback is in the list
has: function( fn ) {
if ( list ) {
var i = 0,
length = list.length;
for ( ; i < length; i++ ) {
if ( fn === list[ i ] ) {
return true;
}
}
}
return false;
},
// Remove all callbacks from the list
empty: function() {
list = [];
return this;
},
// Have the list do nothing anymore
disable: function() {
list = stack = memory = undefined;
return this;
},
// Is it disabled?
disabled: function() {
return !list;
},
// Lock the list in its current state
lock: function() {
stack = undefined;
if ( !memory || memory === true ) {
self.disable();
}
return this;
},
// Is it locked?
locked: function() {
return !stack;
},
// Call all callbacks with the given context and arguments
fireWith: function( context, args ) {
if ( stack ) {
if ( firing ) {
if ( !flags.once ) {
stack.push( [ context, args ] );
}
} else if ( !( flags.once && memory ) ) {
fire( context, args );
}
}
return this;
},
// Call all the callbacks with the given arguments
fire: function() {
self.fireWith( this, arguments );
return this;
},
// To know if the callbacks have already been called at least once
fired: function() {
return !!memory;
}
};
return self;
};
var // Static reference to slice
sliceDeferred = [].slice;
jQuery.extend({
Deferred: function( func ) {
var doneList = jQuery.Callbacks( "once memory" ),
failList = jQuery.Callbacks( "once memory" ),
progressList = jQuery.Callbacks( "memory" ),
state = "pending",
lists = {
resolve: doneList,
reject: failList,
notify: progressList
},
promise = {
done: doneList.add,
fail: failList.add,
progress: progressList.add,
state: function() {
return state;
},
// Deprecated
isResolved: doneList.fired,
isRejected: failList.fired,
then: function( doneCallbacks, failCallbacks, progressCallbacks ) {
deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks );
return this;
},
always: function() {
deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments );
return this;
},
pipe: function( fnDone, fnFail, fnProgress ) {
return jQuery.Deferred(function( newDefer ) {
jQuery.each( {
done: [ fnDone, "resolve" ],
fail: [ fnFail, "reject" ],
progress: [ fnProgress, "notify" ]
}, function( handler, data ) {
var fn = data[ 0 ],
action = data[ 1 ],
returned;
if ( jQuery.isFunction( fn ) ) {
deferred[ handler ](function() {
returned = fn.apply( this, arguments );
if ( returned && jQuery.isFunction( returned.promise ) ) {
returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify );
} else {
newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] );
}
});
} else {
deferred[ handler ]( newDefer[ action ] );
}
});
}).promise();
},
// Get a promise for this deferred
// If obj is provided, the promise aspect is added to the object
promise: function( obj ) {
if ( obj == null ) {
obj = promise;
} else {
for ( var key in promise ) {
obj[ key ] = promise[ key ];
}
}
return obj;
}
},
deferred = promise.promise({}),
key;
for ( key in lists ) {
deferred[ key ] = lists[ key ].fire;
deferred[ key + "With" ] = lists[ key ].fireWith;
}
// Handle state
deferred.done( function() {
state = "resolved";
}, failList.disable, progressList.lock ).fail( function() {
state = "rejected";
}, doneList.disable, progressList.lock );
// Call given func if any
if ( func ) {
func.call( deferred, deferred );
}
// All done!
return deferred;
},
// Deferred helper
when: function( firstParam ) {
var args = sliceDeferred.call( arguments, 0 ),
i = 0,
length = args.length,
pValues = new Array( length ),
count = length,
pCount = length,
deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ?
firstParam :
jQuery.Deferred(),
promise = deferred.promise();
function resolveFunc( i ) {
return function( value ) {
args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
if ( !( --count ) ) {
deferred.resolveWith( deferred, args );
}
};
}
function progressFunc( i ) {
return function( value ) {
pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value;
deferred.notifyWith( promise, pValues );
};
}
if ( length > 1 ) {
for ( ; i < length; i++ ) {
if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) {
args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) );
} else {
--count;
}
}
if ( !count ) {
deferred.resolveWith( deferred, args );
}
} else if ( deferred !== firstParam ) {
deferred.resolveWith( deferred, length ? [ firstParam ] : [] );
}
return promise;
}
});
jQuery.support = (function() {
var support,
all,
a,
select,
opt,
input,
marginDiv,
fragment,
tds,
events,
eventName,
i,
isSupported,
div = document.createElement( "div" ),
documentElement = document.documentElement;
// Preliminary tests
div.setAttribute("className", "t");
div.innerHTML = " <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>";
all = div.getElementsByTagName( "*" );
a = div.getElementsByTagName( "a" )[ 0 ];
// Can't get basic test support
if ( !all || !all.length || !a ) {
return {};
}
// First batch of supports tests
select = document.createElement( "select" );
opt = select.appendChild( document.createElement("option") );
input = div.getElementsByTagName( "input" )[ 0 ];
support = {
// IE strips leading whitespace when .innerHTML is used
leadingWhitespace: ( div.firstChild.nodeType === 3 ),
// Make sure that tbody elements aren't automatically inserted
// IE will insert them into empty tables
tbody: !div.getElementsByTagName("tbody").length,
// Make sure that link elements get serialized correctly by innerHTML
// This requires a wrapper element in IE
htmlSerialize: !!div.getElementsByTagName("link").length,
// Get the style information from getAttribute
// (IE uses .cssText instead)
style: /top/.test( a.getAttribute("style") ),
// Make sure that URLs aren't manipulated
// (IE normalizes it by default)
hrefNormalized: ( a.getAttribute("href") === "/a" ),
// Make sure that element opacity exists
// (IE uses filter instead)
// Use a regex to work around a WebKit issue. See #5145
opacity: /^0.55/.test( a.style.opacity ),
// Verify style float existence
// (IE uses styleFloat instead of cssFloat)
cssFloat: !!a.style.cssFloat,
// Make sure that if no value is specified for a checkbox
// that it defaults to "on".
// (WebKit defaults to "" instead)
checkOn: ( input.value === "on" ),
// Make sure that a selected-by-default option has a working selected property.
// (WebKit defaults to false instead of true, IE too, if it's in an optgroup)
optSelected: opt.selected,
// Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7)
getSetAttribute: div.className !== "t",
// Tests for enctype support on a form(#6743)
enctype: !!document.createElement("form").enctype,
// Makes sure cloning an html5 element does not cause problems
// Where outerHTML is undefined, this still works
html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>",
// Will be defined later
submitBubbles: true,
changeBubbles: true,
focusinBubbles: false,
deleteExpando: true,
noCloneEvent: true,
inlineBlockNeedsLayout: false,
shrinkWrapBlocks: false,
reliableMarginRight: true
};
// Make sure checked status is properly cloned
input.checked = true;
support.noCloneChecked = input.cloneNode( true ).checked;
// Make sure that the options inside disabled selects aren't marked as disabled
// (WebKit marks them as disabled)
select.disabled = true;
support.optDisabled = !opt.disabled;
// Test to see if it's possible to delete an expando from an element
// Fails in Internet Explorer
try {
delete div.test;
} catch( e ) {
support.deleteExpando = false;
}
if ( !div.addEventListener && div.attachEvent && div.fireEvent ) {
div.attachEvent( "onclick", function() {
// Cloning a node shouldn't copy over any
// bound event handlers (IE does this)
support.noCloneEvent = false;
});
div.cloneNode( true ).fireEvent( "onclick" );
}
// Check if a radio maintains its value
// after being appended to the DOM
input = document.createElement("input");
input.value = "t";
input.setAttribute("type", "radio");
support.radioValue = input.value === "t";
input.setAttribute("checked", "checked");
div.appendChild( input );
fragment = document.createDocumentFragment();
fragment.appendChild( div.lastChild );
// WebKit doesn't clone checked state correctly in fragments
support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked;
// Check if a disconnected checkbox will retain its checked
// value of true after appended to the DOM (IE6/7)
support.appendChecked = input.checked;
fragment.removeChild( input );
fragment.appendChild( div );
div.innerHTML = "";
// Check if div with explicit width and no margin-right incorrectly
// gets computed margin-right based on width of container. For more
// info see bug #3333
// Fails in WebKit before Feb 2011 nightlies
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
if ( window.getComputedStyle ) {
marginDiv = document.createElement( "div" );
marginDiv.style.width = "0";
marginDiv.style.marginRight = "0";
div.style.width = "2px";
div.appendChild( marginDiv );
support.reliableMarginRight =
( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0;
}
// Technique from Juriy Zaytsev
// http://perfectionkills.com/detecting-event-support-without-browser-sniffing/
// We only care about the case where non-standard event systems
// are used, namely in IE. Short-circuiting here helps us to
// avoid an eval call (in setAttribute) which can cause CSP
// to go haywire. See: https://developer.mozilla.org/en/Security/CSP
if ( div.attachEvent ) {
for( i in {
submit: 1,
change: 1,
focusin: 1
}) {
eventName = "on" + i;
isSupported = ( eventName in div );
if ( !isSupported ) {
div.setAttribute( eventName, "return;" );
isSupported = ( typeof div[ eventName ] === "function" );
}
support[ i + "Bubbles" ] = isSupported;
}
}
fragment.removeChild( div );
// Null elements to avoid leaks in IE
fragment = select = opt = marginDiv = div = input = null;
// Run tests that need a body at doc ready
jQuery(function() {
var container, outer, inner, table, td, offsetSupport,
conMarginTop, ptlm, vb, style, html,
body = document.getElementsByTagName("body")[0];
if ( !body ) {
// Return for frameset docs that don't have a body
return;
}
conMarginTop = 1;
ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;";
vb = "visibility:hidden;border:0;";
style = "style='" + ptlm + "border:5px solid #000;padding:0;'";
html = "<div " + style + "><div></div></div>" +
"<table " + style + " cellpadding='0' cellspacing='0'>" +
"<tr><td></td></tr></table>";
container = document.createElement("div");
container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px";
body.insertBefore( container, body.firstChild );
// Construct the test element
div = document.createElement("div");
container.appendChild( div );
// Check if table cells still have offsetWidth/Height when they are set
// to display:none and there are still other visible table cells in a
// table row; if so, offsetWidth/Height are not reliable for use when
// determining if an element has been hidden directly using
// display:none (it is still safe to use offsets if a parent element is
// hidden; don safety goggles and see bug #4512 for more information).
// (only IE 8 fails this test)
div.innerHTML = "<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>";
tds = div.getElementsByTagName( "td" );
isSupported = ( tds[ 0 ].offsetHeight === 0 );
tds[ 0 ].style.display = "";
tds[ 1 ].style.display = "none";
// Check if empty table cells still have offsetWidth/Height
// (IE <= 8 fail this test)
support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 );
// Figure out if the W3C box model works as expected
div.innerHTML = "";
div.style.width = div.style.paddingLeft = "1px";
jQuery.boxModel = support.boxModel = div.offsetWidth === 2;
if ( typeof div.style.zoom !== "undefined" ) {
// Check if natively block-level elements act like inline-block
// elements when setting their display to 'inline' and giving
// them layout
// (IE < 8 does this)
div.style.display = "inline";
div.style.zoom = 1;
support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 );
// Check if elements with layout shrink-wrap their children
// (IE 6 does this)
div.style.display = "";
div.innerHTML = "<div style='width:4px;'></div>";
support.shrinkWrapBlocks = ( div.offsetWidth !== 2 );
}
div.style.cssText = ptlm + vb;
div.innerHTML = html;
outer = div.firstChild;
inner = outer.firstChild;
td = outer.nextSibling.firstChild.firstChild;
offsetSupport = {
doesNotAddBorder: ( inner.offsetTop !== 5 ),
doesAddBorderForTableAndCells: ( td.offsetTop === 5 )
};
inner.style.position = "fixed";
inner.style.top = "20px";
// safari subtracts parent border width here which is 5px
offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 );
inner.style.position = inner.style.top = "";
outer.style.overflow = "hidden";
outer.style.position = "relative";
offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 );
offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop );
body.removeChild( container );
div = container = null;
jQuery.extend( support, offsetSupport );
});
return support;
})();
var rbrace = /^(?:\{.*\}|\[.*\])$/,
rmultiDash = /([A-Z])/g;
jQuery.extend({
cache: {},
// Please use with caution
uuid: 0,
// Unique for each copy of jQuery on the page
// Non-digits removed to match rinlinejQuery
expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
// The following elements throw uncatchable exceptions if you
// attempt to add expando properties to them.
noData: {
"embed": true,
// Ban all objects except for Flash (which handle expandos)
"object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
"applet": true
},
hasData: function( elem ) {
elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ];
return !!elem && !isEmptyDataObject( elem );
},
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var privateCache, thisCache, ret,
internalKey = jQuery.expando,
getByName = typeof name === "string",
// We have to handle DOM nodes and JS objects differently because IE6-7
// can't GC object references properly across the DOM-JS boundary
isNode = elem.nodeType,
// Only DOM nodes need the global jQuery cache; JS object data is
// attached directly to the object so GC can occur automatically
cache = isNode ? jQuery.cache : elem,
// Only defining an ID for JS objects if its cache already exists allows
// the code to shortcut on the same path as a DOM node with no cache
id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey,
isEvents = name === "events";
// Avoid doing any more work than we need to when trying to get data on an
// object that has no data at all
if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) {
return;
}
if ( !id ) {
// Only DOM nodes need a new unique ID for each element since their data
// ends up in the global cache
if ( isNode ) {
elem[ internalKey ] = id = ++jQuery.uuid;
} else {
id = internalKey;
}
}
if ( !cache[ id ] ) {
cache[ id ] = {};
// Avoids exposing jQuery metadata on plain JS objects when the object
// is serialized using JSON.stringify
if ( !isNode ) {
cache[ id ].toJSON = jQuery.noop;
}
}
// An object can be passed to jQuery.data instead of a key/value pair; this gets
// shallow copied over onto the existing cache
if ( typeof name === "object" || typeof name === "function" ) {
if ( pvt ) {
cache[ id ] = jQuery.extend( cache[ id ], name );
} else {
cache[ id ].data = jQuery.extend( cache[ id ].data, name );
}
}
privateCache = thisCache = cache[ id ];
// jQuery data() is stored in a separate object inside the object's internal data
// cache in order to avoid key collisions between internal data and user-defined
// data.
if ( !pvt ) {
if ( !thisCache.data ) {
thisCache.data = {};
}
thisCache = thisCache.data;
}
if ( data !== undefined ) {
thisCache[ jQuery.camelCase( name ) ] = data;
}
// Users should not attempt to inspect the internal events object using jQuery.data,
// it is undocumented and subject to change. But does anyone listen? No.
if ( isEvents && !thisCache[ name ] ) {
return privateCache.events;
}
// Check for both converted-to-camel and non-converted data property names
// If a data property was specified
if ( getByName ) {
// First Try to find as-is property data
ret = thisCache[ name ];
// Test for null|undefined property data
if ( ret == null ) {
// Try to find the camelCased property
ret = thisCache[ jQuery.camelCase( name ) ];
}
} else {
ret = thisCache;
}
return ret;
},
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
var thisCache, i, l,
// Reference to internal data cache key
internalKey = jQuery.expando,
isNode = elem.nodeType,
// See jQuery.data for more information
cache = isNode ? jQuery.cache : elem,
// See jQuery.data for more information
id = isNode ? elem[ internalKey ] : internalKey;
// If there is already no cache entry for this object, there is no
// purpose in continuing
if ( !cache[ id ] ) {
return;
}
if ( name ) {
thisCache = pvt ? cache[ id ] : cache[ id ].data;
if ( thisCache ) {
// Support array or space separated string names for data keys
if ( !jQuery.isArray( name ) ) {
// try the string as a key before any manipulation
if ( name in thisCache ) {
name = [ name ];
} else {
// split the camel cased version by spaces unless a key with the spaces exists
name = jQuery.camelCase( name );
if ( name in thisCache ) {
name = [ name ];
} else {
name = name.split( " " );
}
}
}
for ( i = 0, l = name.length; i < l; i++ ) {
delete thisCache[ name[i] ];
}
// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) {
return;
}
}
}
// See jQuery.data for more information
if ( !pvt ) {
delete cache[ id ].data;
// Don't destroy the parent cache unless the internal data object
// had been the only thing left in it
if ( !isEmptyDataObject(cache[ id ]) ) {
return;
}
}
// Browsers that fail expando deletion also refuse to delete expandos on
// the window, but it will allow it on all other JS objects; other browsers
// don't care
// Ensure that `cache` is not a window object #10080
if ( jQuery.support.deleteExpando || !cache.setInterval ) {
delete cache[ id ];
} else {
cache[ id ] = null;
}
// We destroyed the cache and need to eliminate the expando on the node to avoid
// false lookups in the cache for entries that no longer exist
if ( isNode ) {
// IE does not allow us to delete expando properties from nodes,
// nor does it have a removeAttribute function on Document nodes;
// we must handle all of these cases
if ( jQuery.support.deleteExpando ) {
delete elem[ internalKey ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( internalKey );
} else {
elem[ internalKey ] = null;
}
}
},
// For internal use only.
_data: function( elem, name, data ) {
return jQuery.data( elem, name, data, true );
},
// A method for determining if a DOM node can handle the data expando
acceptData: function( elem ) {
if ( elem.nodeName ) {
var match = jQuery.noData[ elem.nodeName.toLowerCase() ];
if ( match ) {
return !(match === true || elem.getAttribute("classid") !== match);
}
}
return true;
}
});
jQuery.fn.extend({
data: function( key, value ) {
var parts, attr, name,
data = null;
if ( typeof key === "undefined" ) {
if ( this.length ) {
data = jQuery.data( this[0] );
if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) {
attr = this[0].attributes;
for ( var i = 0, l = attr.length; i < l; i++ ) {
name = attr[i].name;
if ( name.indexOf( "data-" ) === 0 ) {
name = jQuery.camelCase( name.substring(5) );
dataAttr( this[0], name, data[ name ] );
}
}
jQuery._data( this[0], "parsedAttrs", true );
}
}
return data;
} else if ( typeof key === "object" ) {
return this.each(function() {
jQuery.data( this, key );
});
}
parts = key.split(".");
parts[1] = parts[1] ? "." + parts[1] : "";
if ( value === undefined ) {
data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]);
// Try to fetch any internally stored data first
if ( data === undefined && this.length ) {
data = jQuery.data( this[0], key );
data = dataAttr( this[0], key, data );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else {
return this.each(function() {
var self = jQuery( this ),
args = [ parts[0], value ];
self.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
self.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},
removeData: function( key ) {
return this.each(function() {
jQuery.removeData( this, key );
});
}
});
function dataAttr( elem, key, data ) {
// If nothing was found internally, try to fetch any
// data from the HTML5 data-* attribute
if ( data === undefined && elem.nodeType === 1 ) {
var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase();
data = elem.getAttribute( name );
if ( typeof data === "string" ) {
try {
data = data === "true" ? true :
data === "false" ? false :
data === "null" ? null :
jQuery.isNumeric( data ) ? parseFloat( data ) :
rbrace.test( data ) ? jQuery.parseJSON( data ) :
data;
} catch( e ) {}
// Make sure we set the data so it isn't changed later
jQuery.data( elem, key, data );
} else {
data = undefined;
}
}
return data;
}
// checks a cache object for emptiness
function isEmptyDataObject( obj ) {
for ( var name in obj ) {
// if the public data object is empty, the private is still empty
if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) {
continue;
}
if ( name !== "toJSON" ) {
return false;
}
}
return true;
}
function handleQueueMarkDefer( elem, type, src ) {
var deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
defer = jQuery._data( elem, deferDataKey );
if ( defer &&
( src === "queue" || !jQuery._data(elem, queueDataKey) ) &&
( src === "mark" || !jQuery._data(elem, markDataKey) ) ) {
// Give room for hard-coded callbacks to fire first
// and eventually mark/queue something else on the element
setTimeout( function() {
if ( !jQuery._data( elem, queueDataKey ) &&
!jQuery._data( elem, markDataKey ) ) {
jQuery.removeData( elem, deferDataKey, true );
defer.fire();
}
}, 0 );
}
}
jQuery.extend({
_mark: function( elem, type ) {
if ( elem ) {
type = ( type || "fx" ) + "mark";
jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 );
}
},
_unmark: function( force, elem, type ) {
if ( force !== true ) {
type = elem;
elem = force;
force = false;
}
if ( elem ) {
type = type || "fx";
var key = type + "mark",
count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 );
if ( count ) {
jQuery._data( elem, key, count );
} else {
jQuery.removeData( elem, key, true );
handleQueueMarkDefer( elem, type, "mark" );
}
}
},
queue: function( elem, type, data ) {
var q;
if ( elem ) {
type = ( type || "fx" ) + "queue";
q = jQuery._data( elem, type );
// Speed up dequeue by getting out quickly if this is just a lookup
if ( data ) {
if ( !q || jQuery.isArray(data) ) {
q = jQuery._data( elem, type, jQuery.makeArray(data) );
} else {
q.push( data );
}
}
return q || [];
}
},
dequeue: function( elem, type ) {
type = type || "fx";
var queue = jQuery.queue( elem, type ),
fn = queue.shift(),
hooks = {};
// If the fx queue is dequeued, always remove the progress sentinel
if ( fn === "inprogress" ) {
fn = queue.shift();
}
if ( fn ) {
// Add a progress sentinel to prevent the fx queue from being
// automatically dequeued
if ( type === "fx" ) {
queue.unshift( "inprogress" );
}
jQuery._data( elem, type + ".run", hooks );
fn.call( elem, function() {
jQuery.dequeue( elem, type );
}, hooks );
}
if ( !queue.length ) {
jQuery.removeData( elem, type + "queue " + type + ".run", true );
handleQueueMarkDefer( elem, type, "queue" );
}
}
});
jQuery.fn.extend({
queue: function( type, data ) {
if ( typeof type !== "string" ) {
data = type;
type = "fx";
}
if ( data === undefined ) {
return jQuery.queue( this[0], type );
}
return this.each(function() {
var queue = jQuery.queue( this, type, data );
if ( type === "fx" && queue[0] !== "inprogress" ) {
jQuery.dequeue( this, type );
}
});
},
dequeue: function( type ) {
return this.each(function() {
jQuery.dequeue( this, type );
});
},
// Based off of the plugin by Clint Helfers, with permission.
// http://blindsignals.com/index.php/2009/07/jquery-delay/
delay: function( time, type ) {
time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
type = type || "fx";
return this.queue( type, function( next, hooks ) {
var timeout = setTimeout( next, time );
hooks.stop = function() {
clearTimeout( timeout );
};
});
},
clearQueue: function( type ) {
return this.queue( type || "fx", [] );
},
// Get a promise resolved when queues of a certain type
// are emptied (fx is the type by default)
promise: function( type, object ) {
if ( typeof type !== "string" ) {
object = type;
type = undefined;
}
type = type || "fx";
var defer = jQuery.Deferred(),
elements = this,
i = elements.length,
count = 1,
deferDataKey = type + "defer",
queueDataKey = type + "queue",
markDataKey = type + "mark",
tmp;
function resolve() {
if ( !( --count ) ) {
defer.resolveWith( elements, [ elements ] );
}
}
while( i-- ) {
if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) ||
( jQuery.data( elements[ i ], queueDataKey, undefined, true ) ||
jQuery.data( elements[ i ], markDataKey, undefined, true ) ) &&
jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) {
count++;
tmp.add( resolve );
}
}
resolve();
return defer.promise();
}
});
var rclass = /[\n\t\r]/g,
rspace = /\s+/,
rreturn = /\r/g,
rtype = /^(?:button|input)$/i,
rfocusable = /^(?:button|input|object|select|textarea)$/i,
rclickable = /^a(?:rea)?$/i,
rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,
getSetAttribute = jQuery.support.getSetAttribute,
nodeHook, boolHook, fixSpecified;
jQuery.fn.extend({
attr: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.attr );
},
removeAttr: function( name ) {
return this.each(function() {
jQuery.removeAttr( this, name );
});
},
prop: function( name, value ) {
return jQuery.access( this, name, value, true, jQuery.prop );
},
removeProp: function( name ) {
name = jQuery.propFix[ name ] || name;
return this.each(function() {
// try/catch handles cases where IE balks (such as removing a property on window)
try {
this[ name ] = undefined;
delete this[ name ];
} catch( e ) {}
});
},
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).addClass( value.call(this, j, this.className) );
});
}
if ( value && typeof value === "string" ) {
classNames = value.split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 ) {
if ( !elem.className && classNames.length === 1 ) {
elem.className = value;
} else {
setClass = " " + elem.className + " ";
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
setClass += classNames[ c ] + " ";
}
}
elem.className = jQuery.trim( setClass );
}
}
}
}
return this;
},
removeClass: function( value ) {
var classNames, i, l, elem, className, c, cl;
if ( jQuery.isFunction( value ) ) {
return this.each(function( j ) {
jQuery( this ).removeClass( value.call(this, j, this.className) );
});
}
if ( (value && typeof value === "string") || value === undefined ) {
classNames = ( value || "" ).split( rspace );
for ( i = 0, l = this.length; i < l; i++ ) {
elem = this[ i ];
if ( elem.nodeType === 1 && elem.className ) {
if ( value ) {
className = (" " + elem.className + " ").replace( rclass, " " );
for ( c = 0, cl = classNames.length; c < cl; c++ ) {
className = className.replace(" " + classNames[ c ] + " ", " ");
}
elem.className = jQuery.trim( className );
} else {
elem.className = "";
}
}
}
}
return this;
},
toggleClass: function( value, stateVal ) {
var type = typeof value,
isBool = typeof stateVal === "boolean";
if ( jQuery.isFunction( value ) ) {
return this.each(function( i ) {
jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal );
});
}
return this.each(function() {
if ( type === "string" ) {
// toggle individual class names
var className,
i = 0,
self = jQuery( this ),
state = stateVal,
classNames = value.split( rspace );
while ( (className = classNames[ i++ ]) ) {
// check each className given, space seperated list
state = isBool ? state : !self.hasClass( className );
self[ state ? "addClass" : "removeClass" ]( className );
}
} else if ( type === "undefined" || type === "boolean" ) {
if ( this.className ) {
// store className if set
jQuery._data( this, "__className__", this.className );
}
// toggle whole className
this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || "";
}
});
},
hasClass: function( selector ) {
var className = " " + selector + " ",
i = 0,
l = this.length;
for ( ; i < l; i++ ) {
if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
return true;
}
}
return false;
},
val: function( value ) {
var hooks, ret, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}
isFunction = jQuery.isFunction( value );
return this.each(function( i ) {
var self = jQuery(this), val;
if ( this.nodeType !== 1 ) {
return;
}
if ( isFunction ) {
val = value.call( this, i, self.val() );
} else {
val = value;
}
// Treat null/undefined as ""; convert numbers to string
if ( val == null ) {
val = "";
} else if ( typeof val === "number" ) {
val += "";
} else if ( jQuery.isArray( val ) ) {
val = jQuery.map(val, function ( value ) {
return value == null ? "" : value + "";
});
}
hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ];
// If set returns undefined, fall back to normal setting
if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) {
this.value = val;
}
});
}
});
jQuery.extend({
valHooks: {
option: {
get: function( elem ) {
// attributes.value is undefined in Blackberry 4.7 but
// uses .value. See #6932
var val = elem.attributes.value;
return !val || val.specified ? elem.value : elem.text;
}
},
select: {
get: function( elem ) {
var value, i, max, option,
index = elem.selectedIndex,
values = [],
options = elem.options,
one = elem.type === "select-one";
// Nothing was selected
if ( index < 0 ) {
return null;
}
// Loop through all the selected options
i = one ? index : 0;
max = one ? index + 1 : options.length;
for ( ; i < max; i++ ) {
option = options[ i ];
// Don't return options that are disabled or in a disabled optgroup
if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) &&
(!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
// Get the specific value for the option
value = jQuery( option ).val();
// We don't need an array for one selects
if ( one ) {
return value;
}
// Multi-Selects return an array
values.push( value );
}
}
// Fixes Bug #2551 -- select.val() broken in IE after form.reset()
if ( one && !values.length && options.length ) {
return jQuery( options[ index ] ).val();
}
return values;
},
set: function( elem, value ) {
var values = jQuery.makeArray( value );
jQuery(elem).find("option").each(function() {
this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0;
});
if ( !values.length ) {
elem.selectedIndex = -1;
}
return values;
}
}
},
attrFn: {
val: true,
css: true,
html: true,
text: true,
data: true,
width: true,
height: true,
offset: true
},
attr: function( elem, name, value, pass ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set attributes on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
if ( pass && name in jQuery.attrFn ) {
return jQuery( elem )[ name ]( value );
}
// Fallback to prop when attributes are not supported
if ( typeof elem.getAttribute === "undefined" ) {
return jQuery.prop( elem, name, value );
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
// All attributes are lowercase
// Grab necessary hook if one is defined
if ( notxml ) {
name = name.toLowerCase();
hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook );
}
if ( value !== undefined ) {
if ( value === null ) {
jQuery.removeAttr( elem, name );
return;
} else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
elem.setAttribute( name, "" + value );
return value;
}
} else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
ret = elem.getAttribute( name );
// Non-existent attributes return null, we normalize to undefined
return ret === null ?
undefined :
ret;
}
},
removeAttr: function( elem, value ) {
var propName, attrNames, name, l,
i = 0;
if ( value && elem.nodeType === 1 ) {
attrNames = value.toLowerCase().split( rspace );
l = attrNames.length;
for ( ; i < l; i++ ) {
name = attrNames[ i ];
if ( name ) {
propName = jQuery.propFix[ name ] || name;
// See #9699 for explanation of this approach (setting first, then removal)
jQuery.attr( elem, name, "" );
elem.removeAttribute( getSetAttribute ? name : propName );
// Set corresponding property to false for boolean attributes
if ( rboolean.test( name ) && propName in elem ) {
elem[ propName ] = false;
}
}
}
}
},
attrHooks: {
type: {
set: function( elem, value ) {
// We can't allow the type property to be changed (since it causes problems in IE)
if ( rtype.test( elem.nodeName ) && elem.parentNode ) {
jQuery.error( "type property can't be changed" );
} else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) {
// Setting the type on a radio button after the value resets the value in IE6-9
// Reset value to it's default in case type is set after value
// This is for element creation
var val = elem.value;
elem.setAttribute( "type", value );
if ( val ) {
elem.value = val;
}
return value;
}
}
},
// Use the value property for back compat
// Use the nodeHook for button elements in IE6/7 (#1954)
value: {
get: function( elem, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.get( elem, name );
}
return name in elem ?
elem.value :
null;
},
set: function( elem, value, name ) {
if ( nodeHook && jQuery.nodeName( elem, "button" ) ) {
return nodeHook.set( elem, value, name );
}
// Does not return so that setAttribute is also used
elem.value = value;
}
}
},
propFix: {
tabindex: "tabIndex",
readonly: "readOnly",
"for": "htmlFor",
"class": "className",
maxlength: "maxLength",
cellspacing: "cellSpacing",
cellpadding: "cellPadding",
rowspan: "rowSpan",
colspan: "colSpan",
usemap: "useMap",
frameborder: "frameBorder",
contenteditable: "contentEditable"
},
prop: function( elem, name, value ) {
var ret, hooks, notxml,
nType = elem.nodeType;
// don't get/set properties on text, comment and attribute nodes
if ( !elem || nType === 3 || nType === 8 || nType === 2 ) {
return;
}
notxml = nType !== 1 || !jQuery.isXMLDoc( elem );
if ( notxml ) {
// Fix name and attach hooks
name = jQuery.propFix[ name ] || name;
hooks = jQuery.propHooks[ name ];
}
if ( value !== undefined ) {
if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) {
return ret;
} else {
return ( elem[ name ] = value );
}
} else {
if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) {
return ret;
} else {
return elem[ name ];
}
}
},
propHooks: {
tabIndex: {
get: function( elem ) {
// elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set
// http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
var attributeNode = elem.getAttributeNode("tabindex");
return attributeNode && attributeNode.specified ?
parseInt( attributeNode.value, 10 ) :
rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ?
0 :
undefined;
}
}
}
});
// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional)
jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex;
// Hook for boolean attributes
boolHook = {
get: function( elem, name ) {
// Align boolean attributes with corresponding properties
// Fall back to attribute presence where some booleans are not supported
var attrNode,
property = jQuery.prop( elem, name );
return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ?
name.toLowerCase() :
undefined;
},
set: function( elem, value, name ) {
var propName;
if ( value === false ) {
// Remove boolean attributes when set to false
jQuery.removeAttr( elem, name );
} else {
// value is true since we know at this point it's type boolean and not false
// Set boolean attributes to the same name and set the DOM property
propName = jQuery.propFix[ name ] || name;
if ( propName in elem ) {
// Only set the IDL specifically if it already exists on the element
elem[ propName ] = true;
}
elem.setAttribute( name, name.toLowerCase() );
}
return name;
}
};
// IE6/7 do not support getting/setting some attributes with get/setAttribute
if ( !getSetAttribute ) {
fixSpecified = {
name: true,
id: true
};
// Use this for any attribute in IE6/7
// This fixes almost every IE6/7 issue
nodeHook = jQuery.valHooks.button = {
get: function( elem, name ) {
var ret;
ret = elem.getAttributeNode( name );
return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ?
ret.nodeValue :
undefined;
},
set: function( elem, value, name ) {
// Set the existing or create a new attribute node
var ret = elem.getAttributeNode( name );
if ( !ret ) {
ret = document.createAttribute( name );
elem.setAttributeNode( ret );
}
return ( ret.nodeValue = value + "" );
}
};
// Apply the nodeHook to tabindex
jQuery.attrHooks.tabindex.set = nodeHook.set;
// Set width and height to auto instead of 0 on empty string( Bug #8150 )
// This is for removals
jQuery.each([ "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
set: function( elem, value ) {
if ( value === "" ) {
elem.setAttribute( name, "auto" );
return value;
}
}
});
});
// Set contenteditable to false on removals(#10429)
// Setting to empty string throws an error as an invalid value
jQuery.attrHooks.contenteditable = {
get: nodeHook.get,
set: function( elem, value, name ) {
if ( value === "" ) {
value = "false";
}
nodeHook.set( elem, value, name );
}
};
}
// Some attributes require a special call on IE
if ( !jQuery.support.hrefNormalized ) {
jQuery.each([ "href", "src", "width", "height" ], function( i, name ) {
jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], {
get: function( elem ) {
var ret = elem.getAttribute( name, 2 );
return ret === null ? undefined : ret;
}
});
});
}
if ( !jQuery.support.style ) {
jQuery.attrHooks.style = {
get: function( elem ) {
// Return undefined in the case of empty string
// Normalize to lowercase since IE uppercases css property names
return elem.style.cssText.toLowerCase() || undefined;
},
set: function( elem, value ) {
return ( elem.style.cssText = "" + value );
}
};
}
// Safari mis-reports the default selected property of an option
// Accessing the parent's selectedIndex property fixes it
if ( !jQuery.support.optSelected ) {
jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, {
get: function( elem ) {
var parent = elem.parentNode;
if ( parent ) {
parent.selectedIndex;
// Make sure that it also works with optgroups, see #5701
if ( parent.parentNode ) {
parent.parentNode.selectedIndex;
}
}
return null;
}
});
}
// IE6/7 call enctype encoding
if ( !jQuery.support.enctype ) {
jQuery.propFix.enctype = "encoding";
}
// Radios and checkboxes getter/setter
if ( !jQuery.support.checkOn ) {
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = {
get: function( elem ) {
// Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified
return elem.getAttribute("value") === null ? "on" : elem.value;
}
};
});
}
jQuery.each([ "radio", "checkbox" ], function() {
jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], {
set: function( elem, value ) {
if ( jQuery.isArray( value ) ) {
return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 );
}
}
});
});
var rformElems = /^(?:textarea|input|select)$/i,
rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/,
rhoverHack = /\bhover(\.\S+)?\b/,
rkeyEvent = /^key/,
rmouseEvent = /^(?:mouse|contextmenu)|click/,
rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,
quickParse = function( selector ) {
var quick = rquickIs.exec( selector );
if ( quick ) {
// 0 1 2 3
// [ _, tag, id, class ]
quick[1] = ( quick[1] || "" ).toLowerCase();
quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" );
}
return quick;
},
quickIs = function( elem, m ) {
var attrs = elem.attributes || {};
return (
(!m[1] || elem.nodeName.toLowerCase() === m[1]) &&
(!m[2] || (attrs.id || {}).value === m[2]) &&
(!m[3] || m[3].test( (attrs[ "class" ] || {}).value ))
);
},
hoverHack = function( events ) {
return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" );
};
/*
* Helper functions for managing events -- not part of the public interface.
* Props to Dean Edwards' addEvent library for many of the ideas.
*/
jQuery.event = {
add: function( elem, types, handler, data, selector ) {
var elemData, eventHandle, events,
t, tns, type, namespaces, handleObj,
handleObjIn, quick, handlers, special;
// Don't attach events to noData or text/comment nodes (allow plain objects tho)
if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) {
return;
}
// Caller can pass in an object of custom data in lieu of the handler
if ( handler.handler ) {
handleObjIn = handler;
handler = handleObjIn.handler;
}
// Make sure that the handler has a unique ID, used to find/remove it later
if ( !handler.guid ) {
handler.guid = jQuery.guid++;
}
// Init the element's event structure and main handler, if this is the first
events = elemData.events;
if ( !events ) {
elemData.events = events = {};
}
eventHandle = elemData.handle;
if ( !eventHandle ) {
elemData.handle = eventHandle = function( e ) {
// Discard the second event of a jQuery.event.trigger() and
// when an event is called after a page has unloaded
return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ?
jQuery.event.dispatch.apply( eventHandle.elem, arguments ) :
undefined;
};
// Add elem as a property of the handle fn to prevent a memory leak with IE non-native events
eventHandle.elem = elem;
}
// Handle multiple events separated by a space
// jQuery(...).bind("mouseover mouseout", fn);
types = jQuery.trim( hoverHack(types) ).split( " " );
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = tns[1];
namespaces = ( tns[2] || "" ).split( "." ).sort();
// If event changes its type, use the special event handlers for the changed type
special = jQuery.event.special[ type ] || {};
// If selector defined, determine special event api type, otherwise given type
type = ( selector ? special.delegateType : special.bindType ) || type;
// Update special based on newly reset type
special = jQuery.event.special[ type ] || {};
// handleObj is passed to all event handlers
handleObj = jQuery.extend({
type: type,
origType: tns[1],
data: data,
handler: handler,
guid: handler.guid,
selector: selector,
quick: quickParse( selector ),
namespace: namespaces.join(".")
}, handleObjIn );
// Init the event handler queue if we're the first
handlers = events[ type ];
if ( !handlers ) {
handlers = events[ type ] = [];
handlers.delegateCount = 0;
// Only use addEventListener/attachEvent if the special events handler returns false
if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
// Bind the global event handler to the element
if ( elem.addEventListener ) {
elem.addEventListener( type, eventHandle, false );
} else if ( elem.attachEvent ) {
elem.attachEvent( "on" + type, eventHandle );
}
}
}
if ( special.add ) {
special.add.call( elem, handleObj );
if ( !handleObj.handler.guid ) {
handleObj.handler.guid = handler.guid;
}
}
// Add to the element's handler list, delegates in front
if ( selector ) {
handlers.splice( handlers.delegateCount++, 0, handleObj );
} else {
handlers.push( handleObj );
}
// Keep track of which events have ever been used, for event optimization
jQuery.event.global[ type ] = true;
}
// Nullify elem to prevent memory leaks in IE
elem = null;
},
global: {},
// Detach an event or set of events from an element
remove: function( elem, types, handler, selector, mappedTypes ) {
var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
t, tns, type, origType, namespaces, origCount,
j, events, special, handle, eventType, handleObj;
if ( !elemData || !(events = elemData.events) ) {
return;
}
// Once for each type.namespace in types; type may be omitted
types = jQuery.trim( hoverHack( types || "" ) ).split(" ");
for ( t = 0; t < types.length; t++ ) {
tns = rtypenamespace.exec( types[t] ) || [];
type = origType = tns[1];
namespaces = tns[2];
// Unbind all events (on this namespace, if provided) for the element
if ( !type ) {
for ( type in events ) {
jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
}
continue;
}
special = jQuery.event.special[ type ] || {};
type = ( selector? special.delegateType : special.bindType ) || type;
eventType = events[ type ] || [];
origCount = eventType.length;
namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
// Remove matching events
for ( j = 0; j < eventType.length; j++ ) {
handleObj = eventType[ j ];
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !namespaces || namespaces.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
eventType.splice( j--, 1 );
if ( handleObj.selector ) {
eventType.delegateCount--;
}
if ( special.remove ) {
special.remove.call( elem, handleObj );
}
}
}
// Remove generic event handler if we removed something and no more handlers exist
// (avoids potential for endless recursion during removal of special event handlers)
if ( eventType.length === 0 && origCount !== eventType.length ) {
if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) {
jQuery.removeEvent( elem, type, elemData.handle );
}
delete events[ type ];
}
}
// Remove the expando if it's no longer used
if ( jQuery.isEmptyObject( events ) ) {
handle = elemData.handle;
if ( handle ) {
handle.elem = null;
}
// removeData also checks for emptiness and clears the expando if empty
// so use it instead of delete
jQuery.removeData( elem, [ "events", "handle" ], true );
}
},
// Events that are safe to short-circuit if no handlers are attached.
// Native DOM events should not be added, they may have inline handlers.
customEvent: {
"getData": true,
"setData": true,
"changeData": true
},
trigger: function( event, data, elem, onlyHandlers ) {
// Don't do events on text and comment nodes
if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) {
return;
}
// Event object or event type
var type = event.type || event,
namespaces = [],
cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType;
// focus/blur morphs to focusin/out; ensure we're not firing them right now
if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
return;
}
if ( type.indexOf( "!" ) >= 0 ) {
// Exclusive events trigger only for the exact event (no namespaces)
type = type.slice(0, -1);
exclusive = true;
}
if ( type.indexOf( "." ) >= 0 ) {
// Namespaced trigger; create a regexp to match event type in handle()
namespaces = type.split(".");
type = namespaces.shift();
namespaces.sort();
}
if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) {
// No jQuery handlers for this event type, and it can't have inline handlers
return;
}
// Caller can pass in an Event, Object, or just an event type string
event = typeof event === "object" ?
// jQuery.Event object
event[ jQuery.expando ] ? event :
// Object literal
new jQuery.Event( type, event ) :
// Just the event type (string)
new jQuery.Event( type );
event.type = type;
event.isTrigger = true;
event.exclusive = exclusive;
event.namespace = namespaces.join( "." );
event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null;
ontype = type.indexOf( ":" ) < 0 ? "on" + type : "";
// Handle a global trigger
if ( !elem ) {
// TODO: Stop taunting the data cache; remove global events and always attach to document
cache = jQuery.cache;
for ( i in cache ) {
if ( cache[ i ].events && cache[ i ].events[ type ] ) {
jQuery.event.trigger( event, data, cache[ i ].handle.elem, true );
}
}
return;
}
// Clean up the event in case it is being reused
event.result = undefined;
if ( !event.target ) {
event.target = elem;
}
// Clone any incoming data and prepend the event, creating the handler arg list
data = data != null ? jQuery.makeArray( data ) : [];
data.unshift( event );
// Allow special events to draw outside the lines
special = jQuery.event.special[ type ] || {};
if ( special.trigger && special.trigger.apply( elem, data ) === false ) {
return;
}
// Determine event propagation path in advance, per W3C events spec (#9951)
// Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
eventPath = [[ elem, special.bindType || type ]];
if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) {
bubbleType = special.delegateType || type;
cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode;
old = null;
for ( ; cur; cur = cur.parentNode ) {
eventPath.push([ cur, bubbleType ]);
old = cur;
}
// Only add window if we got to document (e.g., not plain obj or detached DOM)
if ( old && old === elem.ownerDocument ) {
eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]);
}
}
// Fire handlers on the event path
for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) {
cur = eventPath[i][0];
event.type = eventPath[i][1];
handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" );
if ( handle ) {
handle.apply( cur, data );
}
// Note that this is a bare JS function and not a jQuery handler
handle = ontype && cur[ ontype ];
if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) {
event.preventDefault();
}
}
event.type = type;
// If nobody prevented the default action, do it now
if ( !onlyHandlers && !event.isDefaultPrevented() ) {
if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) &&
!(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) {
// Call a native DOM method on the target with the same name name as the event.
// Can't use an .isFunction() check here because IE6/7 fails that test.
// Don't do default actions on window, that's where global variables be (#6170)
// IE<9 dies on focus/blur to hidden element (#1486)
if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) {
// Don't re-trigger an onFOO event when we call its FOO() method
old = elem[ ontype ];
if ( old ) {
elem[ ontype ] = null;
}
// Prevent re-triggering of the same event, since we already bubbled it above
jQuery.event.triggered = type;
elem[ type ]();
jQuery.event.triggered = undefined;
if ( old ) {
elem[ ontype ] = old;
}
}
}
}
return event.result;
},
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
delegateCount = handlers.delegateCount,
args = [].slice.call( arguments, 0 ),
run_all = !event.exclusive && !event.namespace,
handlerQueue = [],
i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related;
// Use the fix-ed jQuery.Event rather than the (read-only) native event
args[0] = event;
event.delegateTarget = this;
// Determine handlers that should run if there are delegated events
// Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861)
if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) {
// Pregenerate a single jQuery object for reuse with .is()
jqcur = jQuery(this);
jqcur.context = this.ownerDocument || this;
for ( cur = event.target; cur != this; cur = cur.parentNode || this ) {
selMatch = {};
matches = [];
jqcur[0] = cur;
for ( i = 0; i < delegateCount; i++ ) {
handleObj = handlers[ i ];
sel = handleObj.selector;
if ( selMatch[ sel ] === undefined ) {
selMatch[ sel ] = (
handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel )
);
}
if ( selMatch[ sel ] ) {
matches.push( handleObj );
}
}
if ( matches.length ) {
handlerQueue.push({ elem: cur, matches: matches });
}
}
}
// Add the remaining (directly-bound) handlers
if ( handlers.length > delegateCount ) {
handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) });
}
// Run delegates first; they may want to stop propagation beneath us
for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) {
matched = handlerQueue[ i ];
event.currentTarget = matched.elem;
for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) {
handleObj = matched.matches[ j ];
// Triggered event must either 1) be non-exclusive and have no namespace, or
// 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace).
if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) {
event.data = handleObj.data;
event.handleObj = handleObj;
ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler )
.apply( matched.elem, args );
if ( ret !== undefined ) {
event.result = ret;
if ( ret === false ) {
event.preventDefault();
event.stopPropagation();
}
}
}
}
}
return event.result;
},
// Includes some event props shared by KeyEvent and MouseEvent
// *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 ***
props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),
fixHooks: {},
keyHooks: {
props: "char charCode key keyCode".split(" "),
filter: function( event, original ) {
// Add which for key events
if ( event.which == null ) {
event.which = original.charCode != null ? original.charCode : original.keyCode;
}
return event;
}
},
mouseHooks: {
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),
filter: function( event, original ) {
var eventDoc, doc, body,
button = original.button,
fromElement = original.fromElement;
// Calculate pageX/Y if missing and clientX/Y available
if ( event.pageX == null && original.clientX != null ) {
eventDoc = event.target.ownerDocument || document;
doc = eventDoc.documentElement;
body = eventDoc.body;
event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 );
event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 );
}
// Add relatedTarget, if necessary
if ( !event.relatedTarget && fromElement ) {
event.relatedTarget = fromElement === event.target ? original.toElement : fromElement;
}
// Add which for click: 1 === left; 2 === middle; 3 === right
// Note: button is not normalized, so don't use it
if ( !event.which && button !== undefined ) {
event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) );
}
return event;
}
},
fix: function( event ) {
if ( event[ jQuery.expando ] ) {
return event;
}
// Create a writable copy of the event object and normalize some properties
var i, prop,
originalEvent = event,
fixHook = jQuery.event.fixHooks[ event.type ] || {},
copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props;
event = jQuery.Event( originalEvent );
for ( i = copy.length; i; ) {
prop = copy[ --i ];
event[ prop ] = originalEvent[ prop ];
}
// Fix target property, if necessary (#1925, IE 6/7/8 & Safari2)
if ( !event.target ) {
event.target = originalEvent.srcElement || document;
}
// Target should not be a text node (#504, Safari)
if ( event.target.nodeType === 3 ) {
event.target = event.target.parentNode;
}
// For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8)
if ( event.metaKey === undefined ) {
event.metaKey = event.ctrlKey;
}
return fixHook.filter? fixHook.filter( event, originalEvent ) : event;
},
special: {
ready: {
// Make sure the ready event is setup
setup: jQuery.bindReady
},
load: {
// Prevent triggered image.load events from bubbling to window.load
noBubble: true
},
focus: {
delegateType: "focusin"
},
blur: {
delegateType: "focusout"
},
beforeunload: {
setup: function( data, namespaces, eventHandle ) {
// We only want to do this special case on windows
if ( jQuery.isWindow( this ) ) {
this.onbeforeunload = eventHandle;
}
},
teardown: function( namespaces, eventHandle ) {
if ( this.onbeforeunload === eventHandle ) {
this.onbeforeunload = null;
}
}
}
},
simulate: function( type, elem, event, bubble ) {
// Piggyback on a donor event to simulate a different one.
// Fake originalEvent to avoid donor's stopPropagation, but if the
// simulated event prevents default then we do the same on the donor.
var e = jQuery.extend(
new jQuery.Event(),
event,
{ type: type,
isSimulated: true,
originalEvent: {}
}
);
if ( bubble ) {
jQuery.event.trigger( e, null, elem );
} else {
jQuery.event.dispatch.call( elem, e );
}
if ( e.isDefaultPrevented() ) {
event.preventDefault();
}
}
};
// Some plugins are using, but it's undocumented/deprecated and will be removed.
// The 1.7 special event interface should provide all the hooks needed now.
jQuery.event.handle = jQuery.event.dispatch;
jQuery.removeEvent = document.removeEventListener ?
function( elem, type, handle ) {
if ( elem.removeEventListener ) {
elem.removeEventListener( type, handle, false );
}
} :
function( elem, type, handle ) {
if ( elem.detachEvent ) {
elem.detachEvent( "on" + type, handle );
}
};
jQuery.Event = function( src, props ) {
// Allow instantiation without the 'new' keyword
if ( !(this instanceof jQuery.Event) ) {
return new jQuery.Event( src, props );
}
// Event object
if ( src && src.type ) {
this.originalEvent = src;
this.type = src.type;
// Events bubbling up the document may have been marked as prevented
// by a handler lower down the tree; reflect the correct value.
this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false ||
src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse;
// Event type
} else {
this.type = src;
}
// Put explicitly provided properties onto the event object
if ( props ) {
jQuery.extend( this, props );
}
// Create a timestamp if incoming event doesn't have one
this.timeStamp = src && src.timeStamp || jQuery.now();
// Mark it as fixed
this[ jQuery.expando ] = true;
};
function returnFalse() {
return false;
}
function returnTrue() {
return true;
}
// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
jQuery.Event.prototype = {
preventDefault: function() {
this.isDefaultPrevented = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if preventDefault exists run it on the original event
if ( e.preventDefault ) {
e.preventDefault();
// otherwise set the returnValue property of the original event to false (IE)
} else {
e.returnValue = false;
}
},
stopPropagation: function() {
this.isPropagationStopped = returnTrue;
var e = this.originalEvent;
if ( !e ) {
return;
}
// if stopPropagation exists run it on the original event
if ( e.stopPropagation ) {
e.stopPropagation();
}
// otherwise set the cancelBubble property of the original event to true (IE)
e.cancelBubble = true;
},
stopImmediatePropagation: function() {
this.isImmediatePropagationStopped = returnTrue;
this.stopPropagation();
},
isDefaultPrevented: returnFalse,
isPropagationStopped: returnFalse,
isImmediatePropagationStopped: returnFalse
};
// Create mouseenter/leave events using mouseover/out and event-time checks
jQuery.each({
mouseenter: "mouseover",
mouseleave: "mouseout"
}, function( orig, fix ) {
jQuery.event.special[ orig ] = {
delegateType: fix,
bindType: fix,
handle: function( event ) {
var target = this,
related = event.relatedTarget,
handleObj = event.handleObj,
selector = handleObj.selector,
ret;
// For mousenter/leave call the handler if related is outside the target.
// NB: No relatedTarget if the mouse left/entered the browser window
if ( !related || (related !== target && !jQuery.contains( target, related )) ) {
event.type = handleObj.origType;
ret = handleObj.handler.apply( this, arguments );
event.type = fix;
}
return ret;
}
};
});
// IE submit delegation
if ( !jQuery.support.submitBubbles ) {
jQuery.event.special.submit = {
setup: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Lazy-add a submit handler when a descendant form may potentially be submitted
jQuery.event.add( this, "click._submit keypress._submit", function( e ) {
// Node name check avoids a VML-related crash in IE (#9807)
var elem = e.target,
form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined;
if ( form && !form._submit_attached ) {
jQuery.event.add( form, "submit._submit", function( event ) {
// If form was submitted by the user, bubble the event up the tree
if ( this.parentNode && !event.isTrigger ) {
jQuery.event.simulate( "submit", this.parentNode, event, true );
}
});
form._submit_attached = true;
}
});
// return undefined since we don't need an event listener
},
teardown: function() {
// Only need this for delegated form submit events
if ( jQuery.nodeName( this, "form" ) ) {
return false;
}
// Remove delegated handlers; cleanData eventually reaps submit handlers attached above
jQuery.event.remove( this, "._submit" );
}
};
}
// IE change delegation and checkbox/radio fix
if ( !jQuery.support.changeBubbles ) {
jQuery.event.special.change = {
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
// This still fires onchange a second time for check/radio after blur.
if ( this.type === "checkbox" || this.type === "radio" ) {
jQuery.event.add( this, "propertychange._change", function( event ) {
if ( event.originalEvent.propertyName === "checked" ) {
this._just_changed = true;
}
});
jQuery.event.add( this, "click._change", function( event ) {
if ( this._just_changed && !event.isTrigger ) {
this._just_changed = false;
jQuery.event.simulate( "change", this, event, true );
}
});
}
return false;
}
// Delegated event; lazy-add a change handler on descendant inputs
jQuery.event.add( this, "beforeactivate._change", function( e ) {
var elem = e.target;
if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) {
jQuery.event.add( elem, "change._change", function( event ) {
if ( this.parentNode && !event.isSimulated && !event.isTrigger ) {
jQuery.event.simulate( "change", this.parentNode, event, true );
}
});
elem._change_attached = true;
}
});
},
handle: function( event ) {
var elem = event.target;
// Swallow native change events from checkbox/radio, we already triggered them above
if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) {
return event.handleObj.handler.apply( this, arguments );
}
},
teardown: function() {
jQuery.event.remove( this, "._change" );
return rformElems.test( this.nodeName );
}
};
}
// Create "bubbling" focus and blur events
if ( !jQuery.support.focusinBubbles ) {
jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) {
// Attach a single capturing handler while someone wants focusin/focusout
var attaches = 0,
handler = function( event ) {
jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true );
};
jQuery.event.special[ fix ] = {
setup: function() {
if ( attaches++ === 0 ) {
document.addEventListener( orig, handler, true );
}
},
teardown: function() {
if ( --attaches === 0 ) {
document.removeEventListener( orig, handler, true );
}
}
};
});
}
jQuery.fn.extend({
on: function( types, selector, data, fn, /*INTERNAL*/ one ) {
var origFn, type;
// Types can be a map of types/handlers
if ( typeof types === "object" ) {
// ( types-Object, selector, data )
if ( typeof selector !== "string" ) {
// ( types-Object, data )
data = selector;
selector = undefined;
}
for ( type in types ) {
this.on( type, selector, data, types[ type ], one );
}
return this;
}
if ( data == null && fn == null ) {
// ( types, fn )
fn = selector;
data = selector = undefined;
} else if ( fn == null ) {
if ( typeof selector === "string" ) {
// ( types, selector, fn )
fn = data;
data = undefined;
} else {
// ( types, data, fn )
fn = data;
data = selector;
selector = undefined;
}
}
if ( fn === false ) {
fn = returnFalse;
} else if ( !fn ) {
return this;
}
if ( one === 1 ) {
origFn = fn;
fn = function( event ) {
// Can use an empty set, since event contains the info
jQuery().off( event );
return origFn.apply( this, arguments );
};
// Use same guid so caller can remove using origFn
fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
}
return this.each( function() {
jQuery.event.add( this, types, fn, data, selector );
});
},
one: function( types, selector, data, fn ) {
return this.on.call( this, types, selector, data, fn, 1 );
},
off: function( types, selector, fn ) {
if ( types && types.preventDefault && types.handleObj ) {
// ( event ) dispatched jQuery.Event
var handleObj = types.handleObj;
jQuery( types.delegateTarget ).off(
handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type,
handleObj.selector,
handleObj.handler
);
return this;
}
if ( typeof types === "object" ) {
// ( types-object [, selector] )
for ( var type in types ) {
this.off( type, selector, types[ type ] );
}
return this;
}
if ( selector === false || typeof selector === "function" ) {
// ( types [, fn] )
fn = selector;
selector = undefined;
}
if ( fn === false ) {
fn = returnFalse;
}
return this.each(function() {
jQuery.event.remove( this, types, fn, selector );
});
},
bind: function( types, data, fn ) {
return this.on( types, null, data, fn );
},
unbind: function( types, fn ) {
return this.off( types, null, fn );
},
live: function( types, data, fn ) {
jQuery( this.context ).on( types, this.selector, data, fn );
return this;
},
die: function( types, fn ) {
jQuery( this.context ).off( types, this.selector || "**", fn );
return this;
},
delegate: function( selector, types, data, fn ) {
return this.on( types, selector, data, fn );
},
undelegate: function( selector, types, fn ) {
// ( namespace ) or ( selector, types [, fn] )
return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn );
},
trigger: function( type, data ) {
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
if ( this[0] ) {
return jQuery.event.trigger( type, data, this[0], true );
}
},
toggle: function( fn ) {
// Save reference to arguments for access in closure
var args = arguments,
guid = fn.guid || jQuery.guid++,
i = 0,
toggler = function( event ) {
// Figure out which function to execute
var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i;
jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 );
// Make sure that clicks stop
event.preventDefault();
// and execute the function
return args[ lastToggle ].apply( this, arguments ) || false;
};
// link all the functions, so any of them can unbind this click handler
toggler.guid = guid;
while ( i < args.length ) {
args[ i++ ].guid = guid;
}
return this.click( toggler );
},
hover: function( fnOver, fnOut ) {
return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
}
});
jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " +
"mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
"change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) {
// Handle event binding
jQuery.fn[ name ] = function( data, fn ) {
if ( fn == null ) {
fn = data;
data = null;
}
return arguments.length > 0 ?
this.on( name, null, data, fn ) :
this.trigger( name );
};
if ( jQuery.attrFn ) {
jQuery.attrFn[ name ] = true;
}
if ( rkeyEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks;
}
if ( rmouseEvent.test( name ) ) {
jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks;
}
});
/*!
* Sizzle CSS Selector Engine
* Copyright 2012, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
(function(){
var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
expando = "sizcache" + (Math.random() + '').replace('.', ''),
done = 0,
toString = Object.prototype.toString,
hasDuplicate = false,
baseHasDuplicate = true,
rBackslash = /\\/g,
rReturn = /\r\n/g,
rNonWord = /\W/;
// Here we check if the JavaScript engine is using some sort of
// optimization where it does not always call our comparision
// function. If that is the case, discard the hasDuplicate value.
// Thus far that includes Google Chrome.
[0, 0].sort(function() {
baseHasDuplicate = false;
return 0;
});
var Sizzle = function( selector, context, results, seed ) {
results = results || [];
context = context || document;
var origContext = context;
if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
return [];
}
if ( !selector || typeof selector !== "string" ) {
return results;
}
var m, set, checkSet, extra, ret, cur, pop, i,
prune = true,
contextXML = Sizzle.isXML( context ),
parts = [],
soFar = selector;
// Reset the position of the chunker regexp (start from head)
do {
chunker.exec( "" );
m = chunker.exec( soFar );
if ( m ) {
soFar = m[3];
parts.push( m[1] );
if ( m[2] ) {
extra = m[3];
break;
}
}
} while ( m );
if ( parts.length > 1 && origPOS.exec( selector ) ) {
if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
set = posProcess( parts[0] + parts[1], context, seed );
} else {
set = Expr.relative[ parts[0] ] ?
[ context ] :
Sizzle( parts.shift(), context );
while ( parts.length ) {
selector = parts.shift();
if ( Expr.relative[ selector ] ) {
selector += parts.shift();
}
set = posProcess( selector, set, seed );
}
}
} else {
// Take a shortcut and set the context if the root selector is an ID
// (but not if it'll be faster if the inner selector is an ID)
if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
ret = Sizzle.find( parts.shift(), context, contextXML );
context = ret.expr ?
Sizzle.filter( ret.expr, ret.set )[0] :
ret.set[0];
}
if ( context ) {
ret = seed ?
{ expr: parts.pop(), set: makeArray(seed) } :
Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
set = ret.expr ?
Sizzle.filter( ret.expr, ret.set ) :
ret.set;
if ( parts.length > 0 ) {
checkSet = makeArray( set );
} else {
prune = false;
}
while ( parts.length ) {
cur = parts.pop();
pop = cur;
if ( !Expr.relative[ cur ] ) {
cur = "";
} else {
pop = parts.pop();
}
if ( pop == null ) {
pop = context;
}
Expr.relative[ cur ]( checkSet, pop, contextXML );
}
} else {
checkSet = parts = [];
}
}
if ( !checkSet ) {
checkSet = set;
}
if ( !checkSet ) {
Sizzle.error( cur || selector );
}
if ( toString.call(checkSet) === "[object Array]" ) {
if ( !prune ) {
results.push.apply( results, checkSet );
} else if ( context && context.nodeType === 1 ) {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
results.push( set[i] );
}
}
} else {
for ( i = 0; checkSet[i] != null; i++ ) {
if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
results.push( set[i] );
}
}
}
} else {
makeArray( checkSet, results );
}
if ( extra ) {
Sizzle( extra, origContext, results, seed );
Sizzle.uniqueSort( results );
}
return results;
};
Sizzle.uniqueSort = function( results ) {
if ( sortOrder ) {
hasDuplicate = baseHasDuplicate;
results.sort( sortOrder );
if ( hasDuplicate ) {
for ( var i = 1; i < results.length; i++ ) {
if ( results[i] === results[ i - 1 ] ) {
results.splice( i--, 1 );
}
}
}
}
return results;
};
Sizzle.matches = function( expr, set ) {
return Sizzle( expr, null, null, set );
};
Sizzle.matchesSelector = function( node, expr ) {
return Sizzle( expr, null, null, [node] ).length > 0;
};
Sizzle.find = function( expr, context, isXML ) {
var set, i, len, match, type, left;
if ( !expr ) {
return [];
}
for ( i = 0, len = Expr.order.length; i < len; i++ ) {
type = Expr.order[i];
if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
left = match[1];
match.splice( 1, 1 );
if ( left.substr( left.length - 1 ) !== "\\" ) {
match[1] = (match[1] || "").replace( rBackslash, "" );
set = Expr.find[ type ]( match, context, isXML );
if ( set != null ) {
expr = expr.replace( Expr.match[ type ], "" );
break;
}
}
}
}
if ( !set ) {
set = typeof context.getElementsByTagName !== "undefined" ?
context.getElementsByTagName( "*" ) :
[];
}
return { set: set, expr: expr };
};
Sizzle.filter = function( expr, set, inplace, not ) {
var match, anyFound,
type, found, item, filter, left,
i, pass,
old = expr,
result = [],
curLoop = set,
isXMLFilter = set && set[0] && Sizzle.isXML( set[0] );
while ( expr && set.length ) {
for ( type in Expr.filter ) {
if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
filter = Expr.filter[ type ];
left = match[1];
anyFound = false;
match.splice(1,1);
if ( left.substr( left.length - 1 ) === "\\" ) {
continue;
}
if ( curLoop === result ) {
result = [];
}
if ( Expr.preFilter[ type ] ) {
match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
if ( !match ) {
anyFound = found = true;
} else if ( match === true ) {
continue;
}
}
if ( match ) {
for ( i = 0; (item = curLoop[i]) != null; i++ ) {
if ( item ) {
found = filter( item, match, i, curLoop );
pass = not ^ found;
if ( inplace && found != null ) {
if ( pass ) {
anyFound = true;
} else {
curLoop[i] = false;
}
} else if ( pass ) {
result.push( item );
anyFound = true;
}
}
}
}
if ( found !== undefined ) {
if ( !inplace ) {
curLoop = result;
}
expr = expr.replace( Expr.match[ type ], "" );
if ( !anyFound ) {
return [];
}
break;
}
}
}
// Improper expression
if ( expr === old ) {
if ( anyFound == null ) {
Sizzle.error( expr );
} else {
break;
}
}
old = expr;
}
return curLoop;
};
Sizzle.error = function( msg ) {
throw new Error( "Syntax error, unrecognized expression: " + msg );
};
/**
* Utility function for retreiving the text value of an array of DOM nodes
* @param {Array|Element} elem
*/
var getText = Sizzle.getText = function( elem ) {
var i, node,
nodeType = elem.nodeType,
ret = "";
if ( nodeType ) {
if ( nodeType === 1 || nodeType === 9 ) {
// Use textContent || innerText for elements
if ( typeof elem.textContent === 'string' ) {
return elem.textContent;
} else if ( typeof elem.innerText === 'string' ) {
// Replace IE's carriage returns
return elem.innerText.replace( rReturn, '' );
} else {
// Traverse it's children
for ( elem = elem.firstChild; elem; elem = elem.nextSibling) {
ret += getText( elem );
}
}
} else if ( nodeType === 3 || nodeType === 4 ) {
return elem.nodeValue;
}
} else {
// If no nodeType, this is expected to be an array
for ( i = 0; (node = elem[i]); i++ ) {
// Do not traverse comment nodes
if ( node.nodeType !== 8 ) {
ret += getText( node );
}
}
}
return ret;
};
var Expr = Sizzle.selectors = {
order: [ "ID", "NAME", "TAG" ],
match: {
ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,
NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,
ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,
TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,
CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,
POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,
PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/
},
leftMatch: {},
attrMap: {
"class": "className",
"for": "htmlFor"
},
attrHandle: {
href: function( elem ) {
return elem.getAttribute( "href" );
},
type: function( elem ) {
return elem.getAttribute( "type" );
}
},
relative: {
"+": function(checkSet, part){
var isPartStr = typeof part === "string",
isTag = isPartStr && !rNonWord.test( part ),
isPartStrNotTag = isPartStr && !isTag;
if ( isTag ) {
part = part.toLowerCase();
}
for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
if ( (elem = checkSet[i]) ) {
while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
elem || false :
elem === part;
}
}
if ( isPartStrNotTag ) {
Sizzle.filter( part, checkSet, true );
}
},
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
if ( isPartStr && !rNonWord.test( part ) ) {
part = part.toLowerCase();
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
var parent = elem.parentNode;
checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
}
}
} else {
for ( ; i < l; i++ ) {
elem = checkSet[i];
if ( elem ) {
checkSet[i] = isPartStr ?
elem.parentNode :
elem.parentNode === part;
}
}
if ( isPartStr ) {
Sizzle.filter( part, checkSet, true );
}
}
},
"": function(checkSet, part, isXML){
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML );
},
"~": function( checkSet, part, isXML ) {
var nodeCheck,
doneName = done++,
checkFn = dirCheck;
if ( typeof part === "string" && !rNonWord.test( part ) ) {
part = part.toLowerCase();
nodeCheck = part;
checkFn = dirNodeCheck;
}
checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML );
}
},
find: {
ID: function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
return m && m.parentNode ? [m] : [];
}
},
NAME: function( match, context ) {
if ( typeof context.getElementsByName !== "undefined" ) {
var ret = [],
results = context.getElementsByName( match[1] );
for ( var i = 0, l = results.length; i < l; i++ ) {
if ( results[i].getAttribute("name") === match[1] ) {
ret.push( results[i] );
}
}
return ret.length === 0 ? null : ret;
}
},
TAG: function( match, context ) {
if ( typeof context.getElementsByTagName !== "undefined" ) {
return context.getElementsByTagName( match[1] );
}
}
},
preFilter: {
CLASS: function( match, curLoop, inplace, result, not, isXML ) {
match = " " + match[1].replace( rBackslash, "" ) + " ";
if ( isXML ) {
return match;
}
for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
if ( elem ) {
if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) {
if ( !inplace ) {
result.push( elem );
}
} else if ( inplace ) {
curLoop[i] = false;
}
}
}
return false;
},
ID: function( match ) {
return match[1].replace( rBackslash, "" );
},
TAG: function( match, curLoop ) {
return match[1].replace( rBackslash, "" ).toLowerCase();
},
CHILD: function( match ) {
if ( match[1] === "nth" ) {
if ( !match[2] ) {
Sizzle.error( match[0] );
}
match[2] = match[2].replace(/^\+|\s*/g, '');
// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(
match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
// calculate the numbers (first)n+(last) including if they are negative
match[2] = (test[1] + (test[2] || 1)) - 0;
match[3] = test[3] - 0;
}
else if ( match[2] ) {
Sizzle.error( match[0] );
}
// TODO: Move to normal caching system
match[0] = done++;
return match;
},
ATTR: function( match, curLoop, inplace, result, not, isXML ) {
var name = match[1] = match[1].replace( rBackslash, "" );
if ( !isXML && Expr.attrMap[name] ) {
match[1] = Expr.attrMap[name];
}
// Handle if an un-quoted value was used
match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" );
if ( match[2] === "~=" ) {
match[4] = " " + match[4] + " ";
}
return match;
},
PSEUDO: function( match, curLoop, inplace, result, not ) {
if ( match[1] === "not" ) {
// If we're dealing with a complex expression, or a simple one
if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
match[3] = Sizzle(match[3], null, null, curLoop);
} else {
var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
if ( !inplace ) {
result.push.apply( result, ret );
}
return false;
}
} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
return true;
}
return match;
},
POS: function( match ) {
match.unshift( true );
return match;
}
},
filters: {
enabled: function( elem ) {
return elem.disabled === false && elem.type !== "hidden";
},
disabled: function( elem ) {
return elem.disabled === true;
},
checked: function( elem ) {
return elem.checked === true;
},
selected: function( elem ) {
// Accessing this property makes selected-by-default
// options in Safari work properly
if ( elem.parentNode ) {
elem.parentNode.selectedIndex;
}
return elem.selected === true;
},
parent: function( elem ) {
return !!elem.firstChild;
},
empty: function( elem ) {
return !elem.firstChild;
},
has: function( elem, i, match ) {
return !!Sizzle( match[3], elem ).length;
},
header: function( elem ) {
return (/h\d/i).test( elem.nodeName );
},
text: function( elem ) {
var attr = elem.getAttribute( "type" ), type = elem.type;
// IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc)
// use getAttribute instead to test this case
return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null );
},
radio: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type;
},
checkbox: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type;
},
file: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "file" === elem.type;
},
password: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "password" === elem.type;
},
submit: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "submit" === elem.type;
},
image: function( elem ) {
return elem.nodeName.toLowerCase() === "input" && "image" === elem.type;
},
reset: function( elem ) {
var name = elem.nodeName.toLowerCase();
return (name === "input" || name === "button") && "reset" === elem.type;
},
button: function( elem ) {
var name = elem.nodeName.toLowerCase();
return name === "input" && "button" === elem.type || name === "button";
},
input: function( elem ) {
return (/input|select|textarea|button/i).test( elem.nodeName );
},
focus: function( elem ) {
return elem === elem.ownerDocument.activeElement;
}
},
setFilters: {
first: function( elem, i ) {
return i === 0;
},
last: function( elem, i, match, array ) {
return i === array.length - 1;
},
even: function( elem, i ) {
return i % 2 === 0;
},
odd: function( elem, i ) {
return i % 2 === 1;
},
lt: function( elem, i, match ) {
return i < match[3] - 0;
},
gt: function( elem, i, match ) {
return i > match[3] - 0;
},
nth: function( elem, i, match ) {
return match[3] - 0 === i;
},
eq: function( elem, i, match ) {
return match[3] - 0 === i;
}
},
filter: {
PSEUDO: function( elem, match, i, array ) {
var name = match[1],
filter = Expr.filters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
} else if ( name === "contains" ) {
return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0;
} else if ( name === "not" ) {
var not = match[3];
for ( var j = 0, l = not.length; j < l; j++ ) {
if ( not[j] === elem ) {
return false;
}
}
return true;
} else {
Sizzle.error( name );
}
},
CHILD: function( elem, match ) {
var first, last,
doneName, parent, cache,
count, diff,
type = match[1],
node = elem;
switch ( type ) {
case "only":
case "first":
while ( (node = node.previousSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
if ( type === "first" ) {
return true;
}
node = elem;
case "last":
while ( (node = node.nextSibling) ) {
if ( node.nodeType === 1 ) {
return false;
}
}
return true;
case "nth":
first = match[2];
last = match[3];
if ( first === 1 && last === 0 ) {
return true;
}
doneName = match[0];
parent = elem.parentNode;
if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) {
count = 0;
for ( node = parent.firstChild; node; node = node.nextSibling ) {
if ( node.nodeType === 1 ) {
node.nodeIndex = ++count;
}
}
parent[ expando ] = doneName;
}
diff = elem.nodeIndex - last;
if ( first === 0 ) {
return diff === 0;
} else {
return ( diff % first === 0 && diff / first >= 0 );
}
}
},
ID: function( elem, match ) {
return elem.nodeType === 1 && elem.getAttribute("id") === match;
},
TAG: function( elem, match ) {
return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match;
},
CLASS: function( elem, match ) {
return (" " + (elem.className || elem.getAttribute("class")) + " ")
.indexOf( match ) > -1;
},
ATTR: function( elem, match ) {
var name = match[1],
result = Sizzle.attr ?
Sizzle.attr( elem, name ) :
Expr.attrHandle[ name ] ?
Expr.attrHandle[ name ]( elem ) :
elem[ name ] != null ?
elem[ name ] :
elem.getAttribute( name ),
value = result + "",
type = match[2],
check = match[4];
return result == null ?
type === "!=" :
!type && Sizzle.attr ?
result != null :
type === "=" ?
value === check :
type === "*=" ?
value.indexOf(check) >= 0 :
type === "~=" ?
(" " + value + " ").indexOf(check) >= 0 :
!check ?
value && result !== false :
type === "!=" ?
value !== check :
type === "^=" ?
value.indexOf(check) === 0 :
type === "$=" ?
value.substr(value.length - check.length) === check :
type === "|=" ?
value === check || value.substr(0, check.length + 1) === check + "-" :
false;
},
POS: function( elem, match, i, array ) {
var name = match[2],
filter = Expr.setFilters[ name ];
if ( filter ) {
return filter( elem, i, match, array );
}
}
}
};
var origPOS = Expr.match.POS,
fescape = function(all, num){
return "\\" + (num - 0 + 1);
};
for ( var type in Expr.match ) {
Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
}
var makeArray = function( array, results ) {
array = Array.prototype.slice.call( array, 0 );
if ( results ) {
results.push.apply( results, array );
return results;
}
return array;
};
// Perform a simple check to determine if the browser is capable of
// converting a NodeList to an array using builtin methods.
// Also verifies that the returned array holds DOM nodes
// (which is not the case in the Blackberry browser)
try {
Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
// Provide a fallback method if it does not work
} catch( e ) {
makeArray = function( array, results ) {
var i = 0,
ret = results || [];
if ( toString.call(array) === "[object Array]" ) {
Array.prototype.push.apply( ret, array );
} else {
if ( typeof array.length === "number" ) {
for ( var l = array.length; i < l; i++ ) {
ret.push( array[i] );
}
} else {
for ( ; array[i]; i++ ) {
ret.push( array[i] );
}
}
}
return ret;
};
}
var sortOrder, siblingCheck;
if ( document.documentElement.compareDocumentPosition ) {
sortOrder = function( a, b ) {
if ( a === b ) {
hasDuplicate = true;
return 0;
}
if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
return a.compareDocumentPosition ? -1 : 1;
}
return a.compareDocumentPosition(b) & 4 ? -1 : 1;
};
} else {
sortOrder = function( a, b ) {
// The nodes are identical, we can exit early
if ( a === b ) {
hasDuplicate = true;
return 0;
// Fallback to using sourceIndex (in IE) if it's available on both nodes
} else if ( a.sourceIndex && b.sourceIndex ) {
return a.sourceIndex - b.sourceIndex;
}
var al, bl,
ap = [],
bp = [],
aup = a.parentNode,
bup = b.parentNode,
cur = aup;
// If the nodes are siblings (or identical) we can do a quick check
if ( aup === bup ) {
return siblingCheck( a, b );
// If no parents were found then the nodes are disconnected
} else if ( !aup ) {
return -1;
} else if ( !bup ) {
return 1;
}
// Otherwise they're somewhere else in the tree so we need
// to build up a full list of the parentNodes for comparison
while ( cur ) {
ap.unshift( cur );
cur = cur.parentNode;
}
cur = bup;
while ( cur ) {
bp.unshift( cur );
cur = cur.parentNode;
}
al = ap.length;
bl = bp.length;
// Start walking down the tree looking for a discrepancy
for ( var i = 0; i < al && i < bl; i++ ) {
if ( ap[i] !== bp[i] ) {
return siblingCheck( ap[i], bp[i] );
}
}
// We ended someplace up the tree so do a sibling check
return i === al ?
siblingCheck( a, bp[i], -1 ) :
siblingCheck( ap[i], b, 1 );
};
siblingCheck = function( a, b, ret ) {
if ( a === b ) {
return ret;
var cur = a.nextSibling;
}
while ( cur ) {
if ( cur === b ) {
return -1;
}
cur = cur.nextSibling;
}
return 1;
};
}
// Check to see if the browser returns elements by name when
// querying by getElementById (and provide a workaround)
(function(){
// We're going to inject a fake input element with a specified name
var form = document.createElement("div"),
id = "script" + (new Date()).getTime(),
root = document.documentElement;
form.innerHTML = "<a name='" + id + "'/>";
// Inject it into the root element, check its status, and remove it quickly
root.insertBefore( form, root.firstChild );
// The workaround has to do additional checks after a getElementById
// Which slows things down for other browsers (hence the branching)
if ( document.getElementById( id ) ) {
Expr.find.ID = function( match, context, isXML ) {
if ( typeof context.getElementById !== "undefined" && !isXML ) {
var m = context.getElementById(match[1]);
return m ?
m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ?
[m] :
undefined :
[];
}
};
Expr.filter.ID = function( elem, match ) {
var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
return elem.nodeType === 1 && node && node.nodeValue === match;
};
}
root.removeChild( form );
// release memory in IE
root = form = null;
})();
(function(){
// Check to see if the browser returns only elements
// when doing getElementsByTagName("*")
// Create a fake element
var div = document.createElement("div");
div.appendChild( document.createComment("") );
// Make sure no comments are found
if ( div.getElementsByTagName("*").length > 0 ) {
Expr.find.TAG = function( match, context ) {
var results = context.getElementsByTagName( match[1] );
// Filter out possible comments
if ( match[1] === "*" ) {
var tmp = [];
for ( var i = 0; results[i]; i++ ) {
if ( results[i].nodeType === 1 ) {
tmp.push( results[i] );
}
}
results = tmp;
}
return results;
};
}
// Check to see if an attribute returns normalized href attributes
div.innerHTML = "<a href='#'></a>";
if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
div.firstChild.getAttribute("href") !== "#" ) {
Expr.attrHandle.href = function( elem ) {
return elem.getAttribute( "href", 2 );
};
}
// release memory in IE
div = null;
})();
if ( document.querySelectorAll ) {
(function(){
var oldSizzle = Sizzle,
div = document.createElement("div"),
id = "__sizzle__";
div.innerHTML = "<p class='TEST'></p>";
// Safari can't handle uppercase or unicode characters when
// in quirks mode.
if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
return;
}
Sizzle = function( query, context, extra, seed ) {
context = context || document;
// Only use querySelectorAll on non-XML documents
// (ID selectors don't work in non-HTML documents)
if ( !seed && !Sizzle.isXML(context) ) {
// See if we find a selector to speed up
var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query );
if ( match && (context.nodeType === 1 || context.nodeType === 9) ) {
// Speed-up: Sizzle("TAG")
if ( match[1] ) {
return makeArray( context.getElementsByTagName( query ), extra );
// Speed-up: Sizzle(".CLASS")
} else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) {
return makeArray( context.getElementsByClassName( match[2] ), extra );
}
}
if ( context.nodeType === 9 ) {
// Speed-up: Sizzle("body")
// The body element only exists once, optimize finding it
if ( query === "body" && context.body ) {
return makeArray( [ context.body ], extra );
// Speed-up: Sizzle("#ID")
} else if ( match && match[3] ) {
var elem = context.getElementById( match[3] );
// Check parentNode to catch when Blackberry 4.6 returns
// nodes that are no longer in the document #6963
if ( elem && elem.parentNode ) {
// Handle the case where IE and Opera return items
// by name instead of ID
if ( elem.id === match[3] ) {
return makeArray( [ elem ], extra );
}
} else {
return makeArray( [], extra );
}
}
try {
return makeArray( context.querySelectorAll(query), extra );
} catch(qsaError) {}
// qSA works strangely on Element-rooted queries
// We can work around this by specifying an extra ID on the root
// and working up from there (Thanks to Andrew Dupont for the technique)
// IE 8 doesn't work on object elements
} else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) {
var oldContext = context,
old = context.getAttribute( "id" ),
nid = old || id,
hasParent = context.parentNode,
relativeHierarchySelector = /^\s*[+~]/.test( query );
if ( !old ) {
context.setAttribute( "id", nid );
} else {
nid = nid.replace( /'/g, "\\$&" );
}
if ( relativeHierarchySelector && hasParent ) {
context = context.parentNode;
}
try {
if ( !relativeHierarchySelector || hasParent ) {
return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra );
}
} catch(pseudoError) {
} finally {
if ( !old ) {
oldContext.removeAttribute( "id" );
}
}
}
}
return oldSizzle(query, context, extra, seed);
};
for ( var prop in oldSizzle ) {
Sizzle[ prop ] = oldSizzle[ prop ];
}
// release memory in IE
div = null;
})();
}
(function(){
var html = document.documentElement,
matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector;
if ( matches ) {
// Check to see if it's possible to do matchesSelector
// on a disconnected node (IE 9 fails this)
var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ),
pseudoWorks = false;
try {
// This should fail with an exception
// Gecko does not error, returns false instead
matches.call( document.documentElement, "[test!='']:sizzle" );
} catch( pseudoError ) {
pseudoWorks = true;
}
Sizzle.matchesSelector = function( node, expr ) {
// Make sure that attribute selectors are quoted
expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']");
if ( !Sizzle.isXML( node ) ) {
try {
if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) {
var ret = matches.call( node, expr );
// IE 9's matchesSelector returns false on disconnected nodes
if ( ret || !disconnectedMatch ||
// As well, disconnected nodes are said to be in a document
// fragment in IE 9, so check for that
node.document && node.document.nodeType !== 11 ) {
return ret;
}
}
} catch(e) {}
}
return Sizzle(expr, null, null, [node]).length > 0;
};
}
})();
(function(){
var div = document.createElement("div");
div.innerHTML = "<div class='test e'></div><div class='test'></div>";
// Opera can't find a second classname (in 9.6)
// Also, make sure that getElementsByClassName actually exists
if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
return;
}
// Safari caches class attributes, doesn't catch changes (in 3.2)
div.lastChild.className = "e";
if ( div.getElementsByClassName("e").length === 1 ) {
return;
}
Expr.order.splice(1, 0, "CLASS");
Expr.find.CLASS = function( match, context, isXML ) {
if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
return context.getElementsByClassName(match[1]);
}
};
// release memory in IE
div = null;
})();
function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 && !isXML ){
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( elem.nodeName.toLowerCase() === cur ) {
match = elem;
break;
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
for ( var i = 0, l = checkSet.length; i < l; i++ ) {
var elem = checkSet[i];
if ( elem ) {
var match = false;
elem = elem[dir];
while ( elem ) {
if ( elem[ expando ] === doneName ) {
match = checkSet[elem.sizset];
break;
}
if ( elem.nodeType === 1 ) {
if ( !isXML ) {
elem[ expando ] = doneName;
elem.sizset = i;
}
if ( typeof cur !== "string" ) {
if ( elem === cur ) {
match = true;
break;
}
} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
match = elem;
break;
}
}
elem = elem[dir];
}
checkSet[i] = match;
}
}
}
if ( document.documentElement.contains ) {
Sizzle.contains = function( a, b ) {
return a !== b && (a.contains ? a.contains(b) : true);
};
} else if ( document.documentElement.compareDocumentPosition ) {
Sizzle.contains = function( a, b ) {
return !!(a.compareDocumentPosition(b) & 16);
};
} else {
Sizzle.contains = function() {
return false;
};
}
Sizzle.isXML = function( elem ) {
// documentElement is verified for cases where it doesn't yet exist
// (such as loading iframes in IE - #4833)
var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
return documentElement ? documentElement.nodeName !== "HTML" : false;
};
var posProcess = function( selector, context, seed ) {
var match,
tmpSet = [],
later = "",
root = context.nodeType ? [context] : context;
// Position selectors must be done after the filter
// And so must :not(positional) so we move all PSEUDOs to the end
while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
later += match[0];
selector = selector.replace( Expr.match.PSEUDO, "" );
}
selector = Expr.relative[selector] ? selector + "*" : selector;
for ( var i = 0, l = root.length; i < l; i++ ) {
Sizzle( selector, root[i], tmpSet, seed );
}
return Sizzle.filter( later, tmpSet );
};
// EXPOSE
// Override sizzle attribute retrieval
Sizzle.attr = jQuery.attr;
Sizzle.selectors.attrMap = {};
jQuery.find = Sizzle;
jQuery.expr = Sizzle.selectors;
jQuery.expr[":"] = jQuery.expr.filters;
jQuery.unique = Sizzle.uniqueSort;
jQuery.text = Sizzle.getText;
jQuery.isXMLDoc = Sizzle.isXML;
jQuery.contains = Sizzle.contains;
})();
var runtil = /Until$/,
rparentsprev = /^(?:parents|prevUntil|prevAll)/,
// Note: This RegExp should be improved, or likely pulled from Sizzle
rmultiselector = /,/,
isSimple = /^.[^:#\[\.,]*$/,
slice = Array.prototype.slice,
POS = jQuery.expr.match.POS,
// methods guaranteed to produce a unique set when starting from a unique set
guaranteedUnique = {
children: true,
contents: true,
next: true,
prev: true
};
jQuery.fn.extend({
find: function( selector ) {
var self = this,
i, l;
if ( typeof selector !== "string" ) {
return jQuery( selector ).filter(function() {
for ( i = 0, l = self.length; i < l; i++ ) {
if ( jQuery.contains( self[ i ], this ) ) {
return true;
}
}
});
}
var ret = this.pushStack( "", "find", selector ),
length, n, r;
for ( i = 0, l = this.length; i < l; i++ ) {
length = ret.length;
jQuery.find( selector, this[i], ret );
if ( i > 0 ) {
// Make sure that the results are unique
for ( n = length; n < ret.length; n++ ) {
for ( r = 0; r < length; r++ ) {
if ( ret[r] === ret[n] ) {
ret.splice(n--, 1);
break;
}
}
}
}
}
return ret;
},
has: function( target ) {
var targets = jQuery( target );
return this.filter(function() {
for ( var i = 0, l = targets.length; i < l; i++ ) {
if ( jQuery.contains( this, targets[i] ) ) {
return true;
}
}
});
},
not: function( selector ) {
return this.pushStack( winnow(this, selector, false), "not", selector);
},
filter: function( selector ) {
return this.pushStack( winnow(this, selector, true), "filter", selector );
},
is: function( selector ) {
return !!selector && (
typeof selector === "string" ?
// If this is a positional selector, check membership in the returned set
// so $("p:first").is("p:last") won't return true for a doc with two "p".
POS.test( selector ) ?
jQuery( selector, this.context ).index( this[0] ) >= 0 :
jQuery.filter( selector, this ).length > 0 :
this.filter( selector ).length > 0 );
},
closest: function( selectors, context ) {
var ret = [], i, l, cur = this[0];
// Array (deprecated as of jQuery 1.7)
if ( jQuery.isArray( selectors ) ) {
var level = 1;
while ( cur && cur.ownerDocument && cur !== context ) {
for ( i = 0; i < selectors.length; i++ ) {
if ( jQuery( cur ).is( selectors[ i ] ) ) {
ret.push({ selector: selectors[ i ], elem: cur, level: level });
}
}
cur = cur.parentNode;
level++;
}
return ret;
}
// String
var pos = POS.test( selectors ) || typeof selectors !== "string" ?
jQuery( selectors, context || this.context ) :
0;
for ( i = 0, l = this.length; i < l; i++ ) {
cur = this[i];
while ( cur ) {
if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) {
ret.push( cur );
break;
} else {
cur = cur.parentNode;
if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) {
break;
}
}
}
}
ret = ret.length > 1 ? jQuery.unique( ret ) : ret;
return this.pushStack( ret, "closest", selectors );
},
// Determine the position of an element within
// the matched set of elements
index: function( elem ) {
// No argument, return index in parent
if ( !elem ) {
return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1;
}
// index in selector
if ( typeof elem === "string" ) {
return jQuery.inArray( this[0], jQuery( elem ) );
}
// Locate the position of the desired element
return jQuery.inArray(
// If it receives a jQuery object, the first element is used
elem.jquery ? elem[0] : elem, this );
},
add: function( selector, context ) {
var set = typeof selector === "string" ?
jQuery( selector, context ) :
jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ),
all = jQuery.merge( this.get(), set );
return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ?
all :
jQuery.unique( all ) );
},
andSelf: function() {
return this.add( this.prevObject );
}
});
// A painfully simple check to see if an element is disconnected
// from a document (should be improved, where feasible).
function isDisconnected( node ) {
return !node || !node.parentNode || node.parentNode.nodeType === 11;
}
jQuery.each({
parent: function( elem ) {
var parent = elem.parentNode;
return parent && parent.nodeType !== 11 ? parent : null;
},
parents: function( elem ) {
return jQuery.dir( elem, "parentNode" );
},
parentsUntil: function( elem, i, until ) {
return jQuery.dir( elem, "parentNode", until );
},
next: function( elem ) {
return jQuery.nth( elem, 2, "nextSibling" );
},
prev: function( elem ) {
return jQuery.nth( elem, 2, "previousSibling" );
},
nextAll: function( elem ) {
return jQuery.dir( elem, "nextSibling" );
},
prevAll: function( elem ) {
return jQuery.dir( elem, "previousSibling" );
},
nextUntil: function( elem, i, until ) {
return jQuery.dir( elem, "nextSibling", until );
},
prevUntil: function( elem, i, until ) {
return jQuery.dir( elem, "previousSibling", until );
},
siblings: function( elem ) {
return jQuery.sibling( elem.parentNode.firstChild, elem );
},
children: function( elem ) {
return jQuery.sibling( elem.firstChild );
},
contents: function( elem ) {
return jQuery.nodeName( elem, "iframe" ) ?
elem.contentDocument || elem.contentWindow.document :
jQuery.makeArray( elem.childNodes );
}
}, function( name, fn ) {
jQuery.fn[ name ] = function( until, selector ) {
var ret = jQuery.map( this, fn, until );
if ( !runtil.test( name ) ) {
selector = until;
}
if ( selector && typeof selector === "string" ) {
ret = jQuery.filter( selector, ret );
}
ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret;
if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) {
ret = ret.reverse();
}
return this.pushStack( ret, name, slice.call( arguments ).join(",") );
};
});
jQuery.extend({
filter: function( expr, elems, not ) {
if ( not ) {
expr = ":not(" + expr + ")";
}
return elems.length === 1 ?
jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] :
jQuery.find.matches(expr, elems);
},
dir: function( elem, dir, until ) {
var matched = [],
cur = elem[ dir ];
while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) {
if ( cur.nodeType === 1 ) {
matched.push( cur );
}
cur = cur[dir];
}
return matched;
},
nth: function( cur, result, dir, elem ) {
result = result || 1;
var num = 0;
for ( ; cur; cur = cur[dir] ) {
if ( cur.nodeType === 1 && ++num === result ) {
break;
}
}
return cur;
},
sibling: function( n, elem ) {
var r = [];
for ( ; n; n = n.nextSibling ) {
if ( n.nodeType === 1 && n !== elem ) {
r.push( n );
}
}
return r;
}
});
// Implement the identical functionality for filter and not
function winnow( elements, qualifier, keep ) {
// Can't pass null or undefined to indexOf in Firefox 4
// Set to 0 to skip string check
qualifier = qualifier || 0;
if ( jQuery.isFunction( qualifier ) ) {
return jQuery.grep(elements, function( elem, i ) {
var retVal = !!qualifier.call( elem, i, elem );
return retVal === keep;
});
} else if ( qualifier.nodeType ) {
return jQuery.grep(elements, function( elem, i ) {
return ( elem === qualifier ) === keep;
});
} else if ( typeof qualifier === "string" ) {
var filtered = jQuery.grep(elements, function( elem ) {
return elem.nodeType === 1;
});
if ( isSimple.test( qualifier ) ) {
return jQuery.filter(qualifier, filtered, !keep);
} else {
qualifier = jQuery.filter( qualifier, filtered );
}
}
return jQuery.grep(elements, function( elem, i ) {
return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep;
});
}
function createSafeFragment( document ) {
var list = nodeNames.split( "|" ),
safeFrag = document.createDocumentFragment();
if ( safeFrag.createElement ) {
while ( list.length ) {
safeFrag.createElement(
list.pop()
);
}
}
return safeFrag;
}
var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" +
"header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",
rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g,
rleadingWhitespace = /^\s+/,
rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,
rtagName = /<([\w:]+)/,
rtbody = /<tbody/i,
rhtml = /<|&#?\w+;/,
rnoInnerhtml = /<(?:script|style)/i,
rnocache = /<(?:script|object|embed|option|style)/i,
rnoshimcache = new RegExp("<(?:" + nodeNames + ")", "i"),
// checked="checked" or checked
rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
rscriptType = /\/(java|ecma)script/i,
rcleanScript = /^\s*<!(?:\[CDATA\[|\-\-)/,
wrapMap = {
option: [ 1, "<select multiple='multiple'>", "</select>" ],
legend: [ 1, "<fieldset>", "</fieldset>" ],
thead: [ 1, "<table>", "</table>" ],
tr: [ 2, "<table><tbody>", "</tbody></table>" ],
td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
area: [ 1, "<map>", "</map>" ],
_default: [ 0, "", "" ]
},
safeFragment = createSafeFragment( document );
wrapMap.optgroup = wrapMap.option;
wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
wrapMap.th = wrapMap.td;
// IE can't serialize <link> and <script> tags normally
if ( !jQuery.support.htmlSerialize ) {
wrapMap._default = [ 1, "div<div>", "</div>" ];
}
jQuery.fn.extend({
text: function( text ) {
if ( jQuery.isFunction(text) ) {
return this.each(function(i) {
var self = jQuery( this );
self.text( text.call(this, i, self.text()) );
});
}
if ( typeof text !== "object" && text !== undefined ) {
return this.empty().append( (this[0] && this[0].ownerDocument || document).createTextNode( text ) );
}
return jQuery.text( this );
},
wrapAll: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapAll( html.call(this, i) );
});
}
if ( this[0] ) {
// The elements to wrap the target around
var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true);
if ( this[0].parentNode ) {
wrap.insertBefore( this[0] );
}
wrap.map(function() {
var elem = this;
while ( elem.firstChild && elem.firstChild.nodeType === 1 ) {
elem = elem.firstChild;
}
return elem;
}).append( this );
}
return this;
},
wrapInner: function( html ) {
if ( jQuery.isFunction( html ) ) {
return this.each(function(i) {
jQuery(this).wrapInner( html.call(this, i) );
});
}
return this.each(function() {
var self = jQuery( this ),
contents = self.contents();
if ( contents.length ) {
contents.wrapAll( html );
} else {
self.append( html );
}
});
},
wrap: function( html ) {
var isFunction = jQuery.isFunction( html );
return this.each(function(i) {
jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html );
});
},
unwrap: function() {
return this.parent().each(function() {
if ( !jQuery.nodeName( this, "body" ) ) {
jQuery( this ).replaceWith( this.childNodes );
}
}).end();
},
append: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.appendChild( elem );
}
});
},
prepend: function() {
return this.domManip(arguments, true, function( elem ) {
if ( this.nodeType === 1 ) {
this.insertBefore( elem, this.firstChild );
}
});
},
before: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this );
});
} else if ( arguments.length ) {
var set = jQuery.clean( arguments );
set.push.apply( set, this.toArray() );
return this.pushStack( set, "before", arguments );
}
},
after: function() {
if ( this[0] && this[0].parentNode ) {
return this.domManip(arguments, false, function( elem ) {
this.parentNode.insertBefore( elem, this.nextSibling );
});
} else if ( arguments.length ) {
var set = this.pushStack( this, "after", arguments );
set.push.apply( set, jQuery.clean(arguments) );
return set;
}
},
// keepData is for internal use only--do not document
remove: function( selector, keepData ) {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
if ( !selector || jQuery.filter( selector, [ elem ] ).length ) {
if ( !keepData && elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
jQuery.cleanData( [ elem ] );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
}
return this;
},
empty: function() {
for ( var i = 0, elem; (elem = this[i]) != null; i++ ) {
// Remove element nodes and prevent memory leaks
if ( elem.nodeType === 1 ) {
jQuery.cleanData( elem.getElementsByTagName("*") );
}
// Remove any remaining nodes
while ( elem.firstChild ) {
elem.removeChild( elem.firstChild );
}
}
return this;
},
clone: function( dataAndEvents, deepDataAndEvents ) {
dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
return this.map( function () {
return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
});
},
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
// See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
value = value.replace(rxhtmlTag, "<$1></$2>");
try {
for ( var i = 0, l = this.length; i < l; i++ ) {
// Remove element nodes and prevent memory leaks
if ( this[i].nodeType === 1 ) {
jQuery.cleanData( this[i].getElementsByTagName("*") );
this[i].innerHTML = value;
}
}
// If using innerHTML throws an exception, use the fallback method
} catch(e) {
this.empty().append( value );
}
} else if ( jQuery.isFunction( value ) ) {
this.each(function(i){
var self = jQuery( this );
self.html( value.call(this, i, self.html()) );
});
} else {
this.empty().append( value );
}
return this;
},
replaceWith: function( value ) {
if ( this[0] && this[0].parentNode ) {
// Make sure that the elements are removed from the DOM before they are inserted
// this can help fix replacing a parent with child elements
if ( jQuery.isFunction( value ) ) {
return this.each(function(i) {
var self = jQuery(this), old = self.html();
self.replaceWith( value.call( this, i, old ) );
});
}
if ( typeof value !== "string" ) {
value = jQuery( value ).detach();
}
return this.each(function() {
var next = this.nextSibling,
parent = this.parentNode;
jQuery( this ).remove();
if ( next ) {
jQuery(next).before( value );
} else {
jQuery(parent).append( value );
}
});
} else {
return this.length ?
this.pushStack( jQuery(jQuery.isFunction(value) ? value() : value), "replaceWith", value ) :
this;
}
},
detach: function( selector ) {
return this.remove( selector, true );
},
domManip: function( args, table, callback ) {
var results, first, fragment, parent,
value = args[0],
scripts = [];
// We can't cloneNode fragments that contain checked, in WebKit
if ( !jQuery.support.checkClone && arguments.length === 3 && typeof value === "string" && rchecked.test( value ) ) {
return this.each(function() {
jQuery(this).domManip( args, table, callback, true );
});
}
if ( jQuery.isFunction(value) ) {
return this.each(function(i) {
var self = jQuery(this);
args[0] = value.call(this, i, table ? self.html() : undefined);
self.domManip( args, table, callback );
});
}
if ( this[0] ) {
parent = value && value.parentNode;
// If we're in a fragment, just use that instead of building a new one
if ( jQuery.support.parentNode && parent && parent.nodeType === 11 && parent.childNodes.length === this.length ) {
results = { fragment: parent };
} else {
results = jQuery.buildFragment( args, this, scripts );
}
fragment = results.fragment;
if ( fragment.childNodes.length === 1 ) {
first = fragment = fragment.firstChild;
} else {
first = fragment.firstChild;
}
if ( first ) {
table = table && jQuery.nodeName( first, "tr" );
for ( var i = 0, l = this.length, lastIndex = l - 1; i < l; i++ ) {
callback.call(
table ?
root(this[i], first) :
this[i],
// Make sure that we do not leak memory by inadvertently discarding
// the original fragment (which might have attached data) instead of
// using it; in addition, use the original fragment object for the last
// item instead of first because it can end up being emptied incorrectly
// in certain situations (Bug #8070).
// Fragments from the fragment cache must always be cloned and never used
// in place.
results.cacheable || ( l > 1 && i < lastIndex ) ?
jQuery.clone( fragment, true, true ) :
fragment
);
}
}
if ( scripts.length ) {
jQuery.each( scripts, evalScript );
}
}
return this;
}
});
function root( elem, cur ) {
return jQuery.nodeName(elem, "table") ?
(elem.getElementsByTagName("tbody")[0] ||
elem.appendChild(elem.ownerDocument.createElement("tbody"))) :
elem;
}
function cloneCopyEvent( src, dest ) {
if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) {
return;
}
var type, i, l,
oldData = jQuery._data( src ),
curData = jQuery._data( dest, oldData ),
events = oldData.events;
if ( events ) {
delete curData.handle;
curData.events = {};
for ( type in events ) {
for ( i = 0, l = events[ type ].length; i < l; i++ ) {
jQuery.event.add( dest, type + ( events[ type ][ i ].namespace ? "." : "" ) + events[ type ][ i ].namespace, events[ type ][ i ], events[ type ][ i ].data );
}
}
}
// make the cloned public data object a copy from the original
if ( curData.data ) {
curData.data = jQuery.extend( {}, curData.data );
}
}
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
return;
}
// clearAttributes removes the attributes, which we don't want,
// but also removes the attachEvent events, which we *do* want
if ( dest.clearAttributes ) {
dest.clearAttributes();
}
// mergeAttributes, in contrast, only merges back on the
// original attributes, not the events
if ( dest.mergeAttributes ) {
dest.mergeAttributes( src );
}
nodeName = dest.nodeName.toLowerCase();
// IE6-8 fail to clone children inside object elements that use
// the proprietary classid attribute value (rather than the type
// attribute) to identify the type of content to display
if ( nodeName === "object" ) {
dest.outerHTML = src.outerHTML;
} else if ( nodeName === "input" && (src.type === "checkbox" || src.type === "radio") ) {
// IE6-8 fails to persist the checked state of a cloned checkbox
// or radio button. Worse, IE6-7 fail to give the cloned element
// a checked appearance if the defaultChecked value isn't also set
if ( src.checked ) {
dest.defaultChecked = dest.checked = src.checked;
}
// IE6-7 get confused and end up setting the value of a cloned
// checkbox/radio button to an empty string instead of "on"
if ( dest.value !== src.value ) {
dest.value = src.value;
}
// IE6-8 fails to return the selected option to the default selected
// state when cloning options
} else if ( nodeName === "option" ) {
dest.selected = src.defaultSelected;
// IE6-8 fails to set the defaultValue to the correct value when
// cloning other types of input fields
} else if ( nodeName === "input" || nodeName === "textarea" ) {
dest.defaultValue = src.defaultValue;
}
// Event data gets referenced instead of copied if the expando
// gets copied too
dest.removeAttribute( jQuery.expando );
}
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc,
first = args[ 0 ];
// nodes may contain either an explicit document object,
// a jQuery collection or context object.
// If nodes[0] contains a valid object to assign to doc
if ( nodes && nodes[0] ) {
doc = nodes[0].ownerDocument || nodes[0];
}
// Ensure that an attr object doesn't incorrectly stand in as a document object
// Chrome and Firefox seem to allow this to occur and will throw exception
// Fixes #8950
if ( !doc.createDocumentFragment ) {
doc = document;
}
// Only cache "small" (1/2 KB) HTML strings that are associated with the main document
// Cloning options loses the selected state, so don't cache them
// IE 6 doesn't like it when you put <object> or <embed> elements in a fragment
// Also, WebKit does not clone 'checked' attributes on cloneNode, so don't cache
// Lastly, IE6,7,8 will not correctly reuse cached fragments that were created from unknown elems #10501
if ( args.length === 1 && typeof first === "string" && first.length < 512 && doc === document &&
first.charAt(0) === "<" && !rnocache.test( first ) &&
(jQuery.support.checkClone || !rchecked.test( first )) &&
(jQuery.support.html5Clone || !rnoshimcache.test( first )) ) {
cacheable = true;
cacheresults = jQuery.fragments[ first ];
if ( cacheresults && cacheresults !== 1 ) {
fragment = cacheresults;
}
}
if ( !fragment ) {
fragment = doc.createDocumentFragment();
jQuery.clean( args, doc, fragment, scripts );
}
if ( cacheable ) {
jQuery.fragments[ first ] = cacheresults ? fragment : 1;
}
return { fragment: fragment, cacheable: cacheable };
};
jQuery.fragments = {};
jQuery.each({
appendTo: "append",
prependTo: "prepend",
insertBefore: "before",
insertAfter: "after",
replaceAll: "replaceWith"
}, function( name, original ) {
jQuery.fn[ name ] = function( selector ) {
var ret = [],
insert = jQuery( selector ),
parent = this.length === 1 && this[0].parentNode;
if ( parent && parent.nodeType === 11 && parent.childNodes.length === 1 && insert.length === 1 ) {
insert[ original ]( this[0] );
return this;
} else {
for ( var i = 0, l = insert.length; i < l; i++ ) {
var elems = ( i > 0 ? this.clone(true) : this ).get();
jQuery( insert[i] )[ original ]( elems );
ret = ret.concat( elems );
}
return this.pushStack( ret, name, insert.selector );
}
};
});
function getAll( elem ) {
if ( typeof elem.getElementsByTagName !== "undefined" ) {
return elem.getElementsByTagName( "*" );
} else if ( typeof elem.querySelectorAll !== "undefined" ) {
return elem.querySelectorAll( "*" );
} else {
return [];
}
}
// Used in clean, fixes the defaultChecked property
function fixDefaultChecked( elem ) {
if ( elem.type === "checkbox" || elem.type === "radio" ) {
elem.defaultChecked = elem.checked;
}
}
// Finds all inputs and passes them to fixDefaultChecked
function findInputs( elem ) {
var nodeName = ( elem.nodeName || "" ).toLowerCase();
if ( nodeName === "input" ) {
fixDefaultChecked( elem );
// Skip scripts, get other children
} else if ( nodeName !== "script" && typeof elem.getElementsByTagName !== "undefined" ) {
jQuery.grep( elem.getElementsByTagName("input"), fixDefaultChecked );
}
}
// Derived From: http://www.iecss.com/shimprove/javascript/shimprove.1-0-1.js
function shimCloneNode( elem ) {
var div = document.createElement( "div" );
safeFragment.appendChild( div );
div.innerHTML = elem.outerHTML;
return div.firstChild;
}
jQuery.extend({
clone: function( elem, dataAndEvents, deepDataAndEvents ) {
var srcElements,
destElements,
i,
// IE<=8 does not properly clone detached, unknown element nodes
clone = jQuery.support.html5Clone || !rnoshimcache.test( "<" + elem.nodeName ) ?
elem.cloneNode( true ) :
shimCloneNode( elem );
if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) &&
(elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) {
// IE copies events bound via attachEvent when using cloneNode.
// Calling detachEvent on the clone will also remove the events
// from the original. In order to get around this, we use some
// proprietary methods to clear the events. Thanks to MooTools
// guys for this hotness.
cloneFixAttributes( elem, clone );
// Using Sizzle here is crazy slow, so we use getElementsByTagName instead
srcElements = getAll( elem );
destElements = getAll( clone );
// Weird iteration because IE will replace the length property
// with an element if you are cloning the body and one of the
// elements on the page has a name or id of "length"
for ( i = 0; srcElements[i]; ++i ) {
// Ensure that the destination node is not null; Fixes #9587
if ( destElements[i] ) {
cloneFixAttributes( srcElements[i], destElements[i] );
}
}
}
// Copy the events from the original to the clone
if ( dataAndEvents ) {
cloneCopyEvent( elem, clone );
if ( deepDataAndEvents ) {
srcElements = getAll( elem );
destElements = getAll( clone );
for ( i = 0; srcElements[i]; ++i ) {
cloneCopyEvent( srcElements[i], destElements[i] );
}
}
}
srcElements = destElements = null;
// Return the cloned set
return clone;
},
clean: function( elems, context, fragment, scripts ) {
var checkScriptType;
context = context || document;
// !context.createElement fails in IE with an error but returns typeof 'object'
if ( typeof context.createElement === "undefined" ) {
context = context.ownerDocument || context[0] && context[0].ownerDocument || document;
}
var ret = [], j;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( typeof elem === "number" ) {
elem += "";
}
if ( !elem ) {
continue;
}
// Convert html string into DOM nodes
if ( typeof elem === "string" ) {
if ( !rhtml.test( elem ) ) {
elem = context.createTextNode( elem );
} else {
// Fix "XHTML"-style tags in all browsers
elem = elem.replace(rxhtmlTag, "<$1></$2>");
// Trim whitespace, otherwise indexOf won't work as expected
var tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(),
wrap = wrapMap[ tag ] || wrapMap._default,
depth = wrap[0],
div = context.createElement("div");
// Append wrapper element to unknown element safe doc fragment
if ( context === document ) {
// Use the fragment we've already created for this document
safeFragment.appendChild( div );
} else {
// Use a fragment created with the owner document
createSafeFragment( context ).appendChild( div );
}
// Go to html and back, then peel off extra wrappers
div.innerHTML = wrap[1] + elem + wrap[2];
// Move to the right depth
while ( depth-- ) {
div = div.lastChild;
}
// Remove IE's autoinserted <tbody> from table fragments
if ( !jQuery.support.tbody ) {
// String was a <table>, *may* have spurious <tbody>
var hasBody = rtbody.test(elem),
tbody = tag === "table" && !hasBody ?
div.firstChild && div.firstChild.childNodes :
// String was a bare <thead> or <tfoot>
wrap[1] === "<table>" && !hasBody ?
div.childNodes :
[];
for ( j = tbody.length - 1; j >= 0 ; --j ) {
if ( jQuery.nodeName( tbody[ j ], "tbody" ) && !tbody[ j ].childNodes.length ) {
tbody[ j ].parentNode.removeChild( tbody[ j ] );
}
}
}
// IE completely kills leading whitespace when innerHTML is used
if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
div.insertBefore( context.createTextNode( rleadingWhitespace.exec(elem)[0] ), div.firstChild );
}
elem = div.childNodes;
}
}
// Resets defaultChecked for any radios and checkboxes
// about to be appended to the DOM in IE 6/7 (#8060)
var len;
if ( !jQuery.support.appendChecked ) {
if ( elem[0] && typeof (len = elem.length) === "number" ) {
for ( j = 0; j < len; j++ ) {
findInputs( elem[j] );
}
} else {
findInputs( elem );
}
}
if ( elem.nodeType ) {
ret.push( elem );
} else {
ret = jQuery.merge( ret, elem );
}
}
if ( fragment ) {
checkScriptType = function( elem ) {
return !elem.type || rscriptType.test( elem.type );
};
for ( i = 0; ret[i]; i++ ) {
if ( scripts && jQuery.nodeName( ret[i], "script" ) && (!ret[i].type || ret[i].type.toLowerCase() === "text/javascript") ) {
scripts.push( ret[i].parentNode ? ret[i].parentNode.removeChild( ret[i] ) : ret[i] );
} else {
if ( ret[i].nodeType === 1 ) {
var jsTags = jQuery.grep( ret[i].getElementsByTagName( "script" ), checkScriptType );
ret.splice.apply( ret, [i + 1, 0].concat( jsTags ) );
}
fragment.appendChild( ret[i] );
}
}
}
return ret;
},
cleanData: function( elems ) {
var data, id,
cache = jQuery.cache,
special = jQuery.event.special,
deleteExpando = jQuery.support.deleteExpando;
for ( var i = 0, elem; (elem = elems[i]) != null; i++ ) {
if ( elem.nodeName && jQuery.noData[elem.nodeName.toLowerCase()] ) {
continue;
}
id = elem[ jQuery.expando ];
if ( id ) {
data = cache[ id ];
if ( data && data.events ) {
for ( var type in data.events ) {
if ( special[ type ] ) {
jQuery.event.remove( elem, type );
// This is a shortcut to avoid jQuery.event.remove's overhead
} else {
jQuery.removeEvent( elem, type, data.handle );
}
}
// Null the DOM reference to avoid IE6/7/8 leak (#7054)
if ( data.handle ) {
data.handle.elem = null;
}
}
if ( deleteExpando ) {
delete elem[ jQuery.expando ];
} else if ( elem.removeAttribute ) {
elem.removeAttribute( jQuery.expando );
}
delete cache[ id ];
}
}
}
});
function evalScript( i, elem ) {
if ( elem.src ) {
jQuery.ajax({
url: elem.src,
async: false,
dataType: "script"
});
} else {
jQuery.globalEval( ( elem.text || elem.textContent || elem.innerHTML || "" ).replace( rcleanScript, "/*$0*/" ) );
}
if ( elem.parentNode ) {
elem.parentNode.removeChild( elem );
}
}
var ralpha = /alpha\([^)]*\)/i,
ropacity = /opacity=([^)]*)/,
// fixed for IE9, see #8346
rupper = /([A-Z]|^ms)/g,
rnumpx = /^-?\d+(?:px)?$/i,
rnum = /^-?\d/,
rrelNum = /^([\-+])=([\-+.\de]+)/,
cssShow = { position: "absolute", visibility: "hidden", display: "block" },
cssWidth = [ "Left", "Right" ],
cssHeight = [ "Top", "Bottom" ],
curCSS,
getComputedStyle,
currentStyle;
jQuery.fn.css = function( name, value ) {
// Setting 'undefined' is a no-op
if ( arguments.length === 2 && value === undefined ) {
return this;
}
return jQuery.access( this, name, value, true, function( elem, name, value ) {
return value !== undefined ?
jQuery.style( elem, name, value ) :
jQuery.css( elem, name );
});
};
jQuery.extend({
// Add in style property hooks for overriding the default
// behavior of getting and setting a style property
cssHooks: {
opacity: {
get: function( elem, computed ) {
if ( computed ) {
// We should always get a number back from opacity
var ret = curCSS( elem, "opacity", "opacity" );
return ret === "" ? "1" : ret;
} else {
return elem.style.opacity;
}
}
}
},
// Exclude the following css properties to add px
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
},
// Add in properties whose names you wish to fix before
// setting or getting the value
cssProps: {
// normalize float css property
"float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat"
},
// Get and set the style property on a DOM Node
style: function( elem, name, value, extra ) {
// Don't set styles on text and comment nodes
if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
return;
}
// Make sure that we're working with the right name
var ret, type, origName = jQuery.camelCase( name ),
style = elem.style, hooks = jQuery.cssHooks[ origName ];
name = jQuery.cssProps[ origName ] || origName;
// Check if we're setting a value
if ( value !== undefined ) {
type = typeof value;
// convert relative number strings (+= or -=) to relative numbers. #7345
if ( type === "string" && (ret = rrelNum.exec( value )) ) {
value = ( +( ret[1] + 1) * +ret[2] ) + parseFloat( jQuery.css( elem, name ) );
// Fixes bug #9237
type = "number";
}
// Make sure that NaN and null values aren't set. See: #7116
if ( value == null || type === "number" && isNaN( value ) ) {
return;
}
// If a number was passed in, add 'px' to the (except for certain CSS properties)
if ( type === "number" && !jQuery.cssNumber[ origName ] ) {
value += "px";
}
// If a hook was provided, use that value, otherwise just set the specified value
if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value )) !== undefined ) {
// Wrapped to prevent IE from throwing errors when 'invalid' values are provided
// Fixes bug #5509
try {
style[ name ] = value;
} catch(e) {}
}
} else {
// If a hook was provided get the non-computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) {
return ret;
}
// Otherwise just get the value from the style object
return style[ name ];
}
},
css: function( elem, name, extra ) {
var ret, hooks;
// Make sure that we're working with the right name
name = jQuery.camelCase( name );
hooks = jQuery.cssHooks[ name ];
name = jQuery.cssProps[ name ] || name;
// cssFloat needs a special treatment
if ( name === "cssFloat" ) {
name = "float";
}
// If a hook was provided get the computed value from there
if ( hooks && "get" in hooks && (ret = hooks.get( elem, true, extra )) !== undefined ) {
return ret;
// Otherwise, if a way to get the computed value exists, use that
} else if ( curCSS ) {
return curCSS( elem, name );
}
},
// A method for quickly swapping in/out CSS properties to get correct calculations
swap: function( elem, options, callback ) {
var old = {};
// Remember the old values, and insert the new ones
for ( var name in options ) {
old[ name ] = elem.style[ name ];
elem.style[ name ] = options[ name ];
}
callback.call( elem );
// Revert the old values
for ( name in options ) {
elem.style[ name ] = old[ name ];
}
}
});
// DEPRECATED, Use jQuery.css() instead
jQuery.curCSS = jQuery.css;
jQuery.each(["height", "width"], function( i, name ) {
jQuery.cssHooks[ name ] = {
get: function( elem, computed, extra ) {
var val;
if ( computed ) {
if ( elem.offsetWidth !== 0 ) {
return getWH( elem, name, extra );
} else {
jQuery.swap( elem, cssShow, function() {
val = getWH( elem, name, extra );
});
}
return val;
}
},
set: function( elem, value ) {
if ( rnumpx.test( value ) ) {
// ignore negative width and height values #1599
value = parseFloat( value );
if ( value >= 0 ) {
return value + "px";
}
} else {
return value;
}
}
};
});
if ( !jQuery.support.opacity ) {
jQuery.cssHooks.opacity = {
get: function( elem, computed ) {
// IE uses filters for opacity
return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ?
( parseFloat( RegExp.$1 ) / 100 ) + "" :
computed ? "1" : "";
},
set: function( elem, value ) {
var style = elem.style,
currentStyle = elem.currentStyle,
opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "",
filter = currentStyle && currentStyle.filter || style.filter || "";
// IE has trouble with opacity if it does not have layout
// Force it by setting the zoom level
style.zoom = 1;
// if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652
if ( value >= 1 && jQuery.trim( filter.replace( ralpha, "" ) ) === "" ) {
// Setting style.filter to null, "" & " " still leave "filter:" in the cssText
// if "filter:" is present at all, clearType is disabled, we want to avoid this
// style.removeAttribute is IE Only, but so apparently is this code path...
style.removeAttribute( "filter" );
// if there there is no filter style applied in a css rule, we are done
if ( currentStyle && !currentStyle.filter ) {
return;
}
}
// otherwise, set new filter values
style.filter = ralpha.test( filter ) ?
filter.replace( ralpha, opacity ) :
filter + " " + opacity;
}
};
}
jQuery(function() {
// This hook cannot be added until DOM ready because the support test
// for it is not run until after DOM ready
if ( !jQuery.support.reliableMarginRight ) {
jQuery.cssHooks.marginRight = {
get: function( elem, computed ) {
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
// Work around by temporarily setting element display to inline-block
var ret;
jQuery.swap( elem, { "display": "inline-block" }, function() {
if ( computed ) {
ret = curCSS( elem, "margin-right", "marginRight" );
} else {
ret = elem.style.marginRight;
}
});
return ret;
}
};
}
});
if ( document.defaultView && document.defaultView.getComputedStyle ) {
getComputedStyle = function( elem, name ) {
var ret, defaultView, computedStyle;
name = name.replace( rupper, "-$1" ).toLowerCase();
if ( (defaultView = elem.ownerDocument.defaultView) &&
(computedStyle = defaultView.getComputedStyle( elem, null )) ) {
ret = computedStyle.getPropertyValue( name );
if ( ret === "" && !jQuery.contains( elem.ownerDocument.documentElement, elem ) ) {
ret = jQuery.style( elem, name );
}
}
return ret;
};
}
if ( document.documentElement.currentStyle ) {
currentStyle = function( elem, name ) {
var left, rsLeft, uncomputed,
ret = elem.currentStyle && elem.currentStyle[ name ],
style = elem.style;
// Avoid setting ret to empty string here
// so we don't default to auto
if ( ret === null && style && (uncomputed = style[ name ]) ) {
ret = uncomputed;
}
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
if ( !rnumpx.test( ret ) && rnum.test( ret ) ) {
// Remember the original values
left = style.left;
rsLeft = elem.runtimeStyle && elem.runtimeStyle.left;
// Put in the new values to get a computed value out
if ( rsLeft ) {
elem.runtimeStyle.left = elem.currentStyle.left;
}
style.left = name === "fontSize" ? "1em" : ( ret || 0 );
ret = style.pixelLeft + "px";
// Revert the changed values
style.left = left;
if ( rsLeft ) {
elem.runtimeStyle.left = rsLeft;
}
}
return ret === "" ? "auto" : ret;
};
}
curCSS = getComputedStyle || currentStyle;
function getWH( elem, name, extra ) {
// Start with offset property
var val = name === "width" ? elem.offsetWidth : elem.offsetHeight,
which = name === "width" ? cssWidth : cssHeight,
i = 0,
len = which.length;
if ( val > 0 ) {
if ( extra !== "border" ) {
for ( ; i < len; i++ ) {
if ( !extra ) {
val -= parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
} else {
val -= parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
}
}
}
return val + "px";
}
// Fall back to computed then uncomputed css if necessary
val = curCSS( elem, name, name );
if ( val < 0 || val == null ) {
val = elem.style[ name ] || 0;
}
// Normalize "", auto, and prepare for extra
val = parseFloat( val ) || 0;
// Add padding, border, margin
if ( extra ) {
for ( ; i < len; i++ ) {
val += parseFloat( jQuery.css( elem, "padding" + which[ i ] ) ) || 0;
if ( extra !== "padding" ) {
val += parseFloat( jQuery.css( elem, "border" + which[ i ] + "Width" ) ) || 0;
}
if ( extra === "margin" ) {
val += parseFloat( jQuery.css( elem, extra + which[ i ] ) ) || 0;
}
}
}
return val + "px";
}
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.hidden = function( elem ) {
var width = elem.offsetWidth,
height = elem.offsetHeight;
return ( width === 0 && height === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none");
};
jQuery.expr.filters.visible = function( elem ) {
return !jQuery.expr.filters.hidden( elem );
};
}
var r20 = /%20/g,
rbracket = /\[\]$/,
rCRLF = /\r?\n/g,
rhash = /#.*$/,
rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
rinput = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
// #7653, #8125, #8152: local protocol detection
rlocalProtocol = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,
rnoContent = /^(?:GET|HEAD)$/,
rprotocol = /^\/\//,
rquery = /\?/,
rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
rselectTextarea = /^(?:select|textarea)/i,
rspacesAjax = /\s+/,
rts = /([?&])_=[^&]*/,
rurl = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,
// Keep a copy of the old load method
_load = jQuery.fn.load,
/* Prefilters
* 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
* 2) These are called:
* - BEFORE asking for a transport
* - AFTER param serialization (s.data is a string if s.processData is true)
* 3) key is the dataType
* 4) the catchall symbol "*" can be used
* 5) execution will start with transport dataType and THEN continue down to "*" if needed
*/
prefilters = {},
/* Transports bindings
* 1) key is the dataType
* 2) the catchall symbol "*" can be used
* 3) selection will start with transport dataType and THEN go to "*" if needed
*/
transports = {},
// Document location
ajaxLocation,
// Document location segments
ajaxLocParts,
// Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
allTypes = ["*/"] + ["*"];
// #8138, IE may throw an exception when accessing
// a field from window.location if document.domain has been set
try {
ajaxLocation = location.href;
} catch( e ) {
// Use the href attribute of an A element
// since IE will modify it given document.location
ajaxLocation = document.createElement( "a" );
ajaxLocation.href = "";
ajaxLocation = ajaxLocation.href;
}
// Segment location into parts
ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || [];
// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
function addToPrefiltersOrTransports( structure ) {
// dataTypeExpression is optional and defaults to "*"
return function( dataTypeExpression, func ) {
if ( typeof dataTypeExpression !== "string" ) {
func = dataTypeExpression;
dataTypeExpression = "*";
}
if ( jQuery.isFunction( func ) ) {
var dataTypes = dataTypeExpression.toLowerCase().split( rspacesAjax ),
i = 0,
length = dataTypes.length,
dataType,
list,
placeBefore;
// For each dataType in the dataTypeExpression
for ( ; i < length; i++ ) {
dataType = dataTypes[ i ];
// We control if we're asked to add before
// any existing element
placeBefore = /^\+/.test( dataType );
if ( placeBefore ) {
dataType = dataType.substr( 1 ) || "*";
}
list = structure[ dataType ] = structure[ dataType ] || [];
// then we add to the structure accordingly
list[ placeBefore ? "unshift" : "push" ]( func );
}
}
};
}
// Base inspection function for prefilters and transports
function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
dataType /* internal */, inspected /* internal */ ) {
dataType = dataType || options.dataTypes[ 0 ];
inspected = inspected || {};
inspected[ dataType ] = true;
var list = structure[ dataType ],
i = 0,
length = list ? list.length : 0,
executeOnly = ( structure === prefilters ),
selection;
for ( ; i < length && ( executeOnly || !selection ); i++ ) {
selection = list[ i ]( options, originalOptions, jqXHR );
// If we got redirected to another dataType
// we try there if executing only and not done already
if ( typeof selection === "string" ) {
if ( !executeOnly || inspected[ selection ] ) {
selection = undefined;
} else {
options.dataTypes.unshift( selection );
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, selection, inspected );
}
}
}
// If we're only executing or nothing was selected
// we try the catchall dataType if not done already
if ( ( executeOnly || !selection ) && !inspected[ "*" ] ) {
selection = inspectPrefiltersOrTransports(
structure, options, originalOptions, jqXHR, "*", inspected );
}
// unnecessary when only executing (prefilters)
// but it'll be ignored by the caller in that case
return selection;
}
// A special extend for ajax options
// that takes "flat" options (not to be deep extended)
// Fixes #9887
function ajaxExtend( target, src ) {
var key, deep,
flatOptions = jQuery.ajaxSettings.flatOptions || {};
for ( key in src ) {
if ( src[ key ] !== undefined ) {
( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
}
}
if ( deep ) {
jQuery.extend( true, target, deep );
}
}
jQuery.fn.extend({
load: function( url, params, callback ) {
if ( typeof url !== "string" && _load ) {
return _load.apply( this, arguments );
// Don't do a request if no elements are being requested
} else if ( !this.length ) {
return this;
}
var off = url.indexOf( " " );
if ( off >= 0 ) {
var selector = url.slice( off, url.length );
url = url.slice( 0, off );
}
// Default to a GET request
var type = "GET";
// If the second parameter was provided
if ( params ) {
// If it's a function
if ( jQuery.isFunction( params ) ) {
// We assume that it's the callback
callback = params;
params = undefined;
// Otherwise, build a param string
} else if ( typeof params === "object" ) {
params = jQuery.param( params, jQuery.ajaxSettings.traditional );
type = "POST";
}
}
var self = this;
// Request the remote document
jQuery.ajax({
url: url,
type: type,
dataType: "html",
data: params,
// Complete callback (responseText is used internally)
complete: function( jqXHR, status, responseText ) {
// Store the response as specified by the jqXHR object
responseText = jqXHR.responseText;
// If successful, inject the HTML into all the matched elements
if ( jqXHR.isResolved() ) {
// #4825: Get the actual response in case
// a dataFilter is present in ajaxSettings
jqXHR.done(function( r ) {
responseText = r;
});
// See if a selector was specified
self.html( selector ?
// Create a dummy div to hold the results
jQuery("<div>")
// inject the contents of the document in, removing the scripts
// to avoid any 'Permission Denied' errors in IE
.append(responseText.replace(rscript, ""))
// Locate the specified elements
.find(selector) :
// If not, just inject the full result
responseText );
}
if ( callback ) {
self.each( callback, [ responseText, status, jqXHR ] );
}
}
});
return this;
},
serialize: function() {
return jQuery.param( this.serializeArray() );
},
serializeArray: function() {
return this.map(function(){
return this.elements ? jQuery.makeArray( this.elements ) : this;
})
.filter(function(){
return this.name && !this.disabled &&
( this.checked || rselectTextarea.test( this.nodeName ) ||
rinput.test( this.type ) );
})
.map(function( i, elem ){
var val = jQuery( this ).val();
return val == null ?
null :
jQuery.isArray( val ) ?
jQuery.map( val, function( val, i ){
return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}) :
{ name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
}).get();
}
});
// Attach a bunch of functions for handling common AJAX events
jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split( " " ), function( i, o ){
jQuery.fn[ o ] = function( f ){
return this.on( o, f );
};
});
jQuery.each( [ "get", "post" ], function( i, method ) {
jQuery[ method ] = function( url, data, callback, type ) {
// shift arguments if data argument was omitted
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = undefined;
}
return jQuery.ajax({
type: method,
url: url,
data: data,
success: callback,
dataType: type
});
};
});
jQuery.extend({
getScript: function( url, callback ) {
return jQuery.get( url, undefined, callback, "script" );
},
getJSON: function( url, data, callback ) {
return jQuery.get( url, data, callback, "json" );
},
// Creates a full fledged settings object into target
// with both ajaxSettings and settings fields.
// If target is omitted, writes into ajaxSettings.
ajaxSetup: function( target, settings ) {
if ( settings ) {
// Building a settings object
ajaxExtend( target, jQuery.ajaxSettings );
} else {
// Extending ajaxSettings
settings = target;
target = jQuery.ajaxSettings;
}
ajaxExtend( target, settings );
return target;
},
ajaxSettings: {
url: ajaxLocation,
isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ),
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
/*
timeout: 0,
data: null,
dataType: null,
username: null,
password: null,
cache: null,
traditional: false,
headers: {},
*/
accepts: {
xml: "application/xml, text/xml",
html: "text/html",
text: "text/plain",
json: "application/json, text/javascript",
"*": allTypes
},
contents: {
xml: /xml/,
html: /html/,
json: /json/
},
responseFields: {
xml: "responseXML",
text: "responseText"
},
// List of data converters
// 1) key format is "source_type destination_type" (a single space in-between)
// 2) the catchall symbol "*" can be used for source_type
converters: {
// Convert anything to text
"* text": window.String,
// Text to html (true = no transformation)
"text html": true,
// Evaluate text as a json expression
"text json": jQuery.parseJSON,
// Parse text as xml
"text xml": jQuery.parseXML
},
// For options that shouldn't be deep extended:
// you can add your own custom options here if
// and when you create one that shouldn't be
// deep extended (see ajaxExtend)
flatOptions: {
context: true,
url: true
}
},
ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
ajaxTransport: addToPrefiltersOrTransports( transports ),
// Main method
ajax: function( url, options ) {
// If url is an object, simulate pre-1.5 signature
if ( typeof url === "object" ) {
options = url;
url = undefined;
}
// Force options to be an object
options = options || {};
var // Create the final options object
s = jQuery.ajaxSetup( {}, options ),
// Callbacks context
callbackContext = s.context || s,
// Context for global events
// It's the callbackContext if one was provided in the options
// and if it's a DOM node or a jQuery collection
globalEventContext = callbackContext !== s &&
( callbackContext.nodeType || callbackContext instanceof jQuery ) ?
jQuery( callbackContext ) : jQuery.event,
// Deferreds
deferred = jQuery.Deferred(),
completeDeferred = jQuery.Callbacks( "once memory" ),
// Status-dependent callbacks
statusCode = s.statusCode || {},
// ifModified key
ifModifiedKey,
// Headers (they are sent all at once)
requestHeaders = {},
requestHeadersNames = {},
// Response headers
responseHeadersString,
responseHeaders,
// transport
transport,
// timeout handle
timeoutTimer,
// Cross-domain detection vars
parts,
// The jqXHR state
state = 0,
// To know if global events are to be dispatched
fireGlobals,
// Loop variable
i,
// Fake xhr
jqXHR = {
readyState: 0,
// Caches the header
setRequestHeader: function( name, value ) {
if ( !state ) {
var lname = name.toLowerCase();
name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
requestHeaders[ name ] = value;
}
return this;
},
// Raw string
getAllResponseHeaders: function() {
return state === 2 ? responseHeadersString : null;
},
// Builds headers hashtable if needed
getResponseHeader: function( key ) {
var match;
if ( state === 2 ) {
if ( !responseHeaders ) {
responseHeaders = {};
while( ( match = rheaders.exec( responseHeadersString ) ) ) {
responseHeaders[ match[1].toLowerCase() ] = match[ 2 ];
}
}
match = responseHeaders[ key.toLowerCase() ];
}
return match === undefined ? null : match;
},
// Overrides response content-type header
overrideMimeType: function( type ) {
if ( !state ) {
s.mimeType = type;
}
return this;
},
// Cancel the request
abort: function( statusText ) {
statusText = statusText || "abort";
if ( transport ) {
transport.abort( statusText );
}
done( 0, statusText );
return this;
}
};
// Callback for when everything is done
// It is defined here because jslint complains if it is declared
// at the end of the function (which would be more logical and readable)
function done( status, nativeStatusText, responses, headers ) {
// Called once
if ( state === 2 ) {
return;
}
// State is "done" now
state = 2;
// Clear timeout if it exists
if ( timeoutTimer ) {
clearTimeout( timeoutTimer );
}
// Dereference transport for early garbage collection
// (no matter how long the jqXHR object will be used)
transport = undefined;
// Cache response headers
responseHeadersString = headers || "";
// Set readyState
jqXHR.readyState = status > 0 ? 4 : 0;
var isSuccess,
success,
error,
statusText = nativeStatusText,
response = responses ? ajaxHandleResponses( s, jqXHR, responses ) : undefined,
lastModified,
etag;
// If successful, handle type chaining
if ( status >= 200 && status < 300 || status === 304 ) {
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
if ( ( lastModified = jqXHR.getResponseHeader( "Last-Modified" ) ) ) {
jQuery.lastModified[ ifModifiedKey ] = lastModified;
}
if ( ( etag = jqXHR.getResponseHeader( "Etag" ) ) ) {
jQuery.etag[ ifModifiedKey ] = etag;
}
}
// If not modified
if ( status === 304 ) {
statusText = "notmodified";
isSuccess = true;
// If we have data
} else {
try {
success = ajaxConvert( s, response );
statusText = "success";
isSuccess = true;
} catch(e) {
// We have a parsererror
statusText = "parsererror";
error = e;
}
}
} else {
// We extract error from statusText
// then normalize statusText and status for non-aborts
error = statusText;
if ( !statusText || status ) {
statusText = "error";
if ( status < 0 ) {
status = 0;
}
}
}
// Set data for the fake xhr object
jqXHR.status = status;
jqXHR.statusText = "" + ( nativeStatusText || statusText );
// Success/Error
if ( isSuccess ) {
deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
} else {
deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
}
// Status-dependent callbacks
jqXHR.statusCode( statusCode );
statusCode = undefined;
if ( fireGlobals ) {
globalEventContext.trigger( "ajax" + ( isSuccess ? "Success" : "Error" ),
[ jqXHR, s, isSuccess ? success : error ] );
}
// Complete
completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
// Handle the global AJAX counter
if ( !( --jQuery.active ) ) {
jQuery.event.trigger( "ajaxStop" );
}
}
}
// Attach deferreds
deferred.promise( jqXHR );
jqXHR.success = jqXHR.done;
jqXHR.error = jqXHR.fail;
jqXHR.complete = completeDeferred.add;
// Status-dependent callbacks
jqXHR.statusCode = function( map ) {
if ( map ) {
var tmp;
if ( state < 2 ) {
for ( tmp in map ) {
statusCode[ tmp ] = [ statusCode[tmp], map[tmp] ];
}
} else {
tmp = map[ jqXHR.status ];
jqXHR.then( tmp, tmp );
}
}
return this;
};
// Remove hash character (#7531: and string promotion)
// Add protocol if not provided (#5866: IE7 issue with protocol-less urls)
// We also use the url parameter if available
s.url = ( ( url || s.url ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" );
// Extract dataTypes list
s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( rspacesAjax );
// Determine if a cross-domain request is in order
if ( s.crossDomain == null ) {
parts = rurl.exec( s.url.toLowerCase() );
s.crossDomain = !!( parts &&
( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
);
}
// Convert data if not already a string
if ( s.data && s.processData && typeof s.data !== "string" ) {
s.data = jQuery.param( s.data, s.traditional );
}
// Apply prefilters
inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
// If request was aborted inside a prefiler, stop there
if ( state === 2 ) {
return false;
}
// We can fire global events as of now if asked to
fireGlobals = s.global;
// Uppercase the type
s.type = s.type.toUpperCase();
// Determine if request has content
s.hasContent = !rnoContent.test( s.type );
// Watch for a new set of requests
if ( fireGlobals && jQuery.active++ === 0 ) {
jQuery.event.trigger( "ajaxStart" );
}
// More options handling for requests with no content
if ( !s.hasContent ) {
// If data is available, append data to url
if ( s.data ) {
s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.data;
// #9682: remove data so that it's not used in an eventual retry
delete s.data;
}
// Get ifModifiedKey before adding the anti-cache parameter
ifModifiedKey = s.url;
// Add anti-cache in url if needed
if ( s.cache === false ) {
var ts = jQuery.now(),
// try replacing _= if it is there
ret = s.url.replace( rts, "$1_=" + ts );
// if nothing was replaced, add timestamp to the end
s.url = ret + ( ( ret === s.url ) ? ( rquery.test( s.url ) ? "&" : "?" ) + "_=" + ts : "" );
}
}
// Set the correct header, if data is being sent
if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
jqXHR.setRequestHeader( "Content-Type", s.contentType );
}
// Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
if ( s.ifModified ) {
ifModifiedKey = ifModifiedKey || s.url;
if ( jQuery.lastModified[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ ifModifiedKey ] );
}
if ( jQuery.etag[ ifModifiedKey ] ) {
jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ ifModifiedKey ] );
}
}
// Set the Accepts header for the server, depending on the dataType
jqXHR.setRequestHeader(
"Accept",
s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ?
s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
s.accepts[ "*" ]
);
// Check for headers option
for ( i in s.headers ) {
jqXHR.setRequestHeader( i, s.headers[ i ] );
}
// Allow custom headers/mimetypes and early abort
if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) {
// Abort if not done already
jqXHR.abort();
return false;
}
// Install callbacks on deferreds
for ( i in { success: 1, error: 1, complete: 1 } ) {
jqXHR[ i ]( s[ i ] );
}
// Get transport
transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
// If no transport, we auto-abort
if ( !transport ) {
done( -1, "No Transport" );
} else {
jqXHR.readyState = 1;
// Send global event
if ( fireGlobals ) {
globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
}
// Timeout
if ( s.async && s.timeout > 0 ) {
timeoutTimer = setTimeout( function(){
jqXHR.abort( "timeout" );
}, s.timeout );
}
try {
state = 1;
transport.send( requestHeaders, done );
} catch (e) {
// Propagate exception as error if not done
if ( state < 2 ) {
done( -1, e );
// Simply rethrow otherwise
} else {
throw e;
}
}
}
return jqXHR;
},
// Serialize an array of form elements or a set of
// key/values into a query string
param: function( a, traditional ) {
var s = [],
add = function( key, value ) {
// If value is a function, invoke it and return its value
value = jQuery.isFunction( value ) ? value() : value;
s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value );
};
// Set traditional to true for jQuery <= 1.3.2 behavior.
if ( traditional === undefined ) {
traditional = jQuery.ajaxSettings.traditional;
}
// If an array was passed in, assume that it is an array of form elements.
if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
// Serialize the form elements
jQuery.each( a, function() {
add( this.name, this.value );
});
} else {
// If traditional, encode the "old" way (the way 1.3.2 or older
// did it), otherwise encode params recursively.
for ( var prefix in a ) {
buildParams( prefix, a[ prefix ], traditional, add );
}
}
// Return the resulting serialization
return s.join( "&" ).replace( r20, "+" );
}
});
function buildParams( prefix, obj, traditional, add ) {
if ( jQuery.isArray( obj ) ) {
// Serialize array item.
jQuery.each( obj, function( i, v ) {
if ( traditional || rbracket.test( prefix ) ) {
// Treat each array item as a scalar.
add( prefix, v );
} else {
// If array item is non-scalar (array or object), encode its
// numeric index to resolve deserialization ambiguity issues.
// Note that rack (as of 1.0.0) can't currently deserialize
// nested arrays properly, and attempting to do so may cause
// a server error. Possible fixes are to modify rack's
// deserialization algorithm or to provide an option or flag
// to force array serialization to be shallow.
buildParams( prefix + "[" + ( typeof v === "object" || jQuery.isArray(v) ? i : "" ) + "]", v, traditional, add );
}
});
} else if ( !traditional && obj != null && typeof obj === "object" ) {
// Serialize object item.
for ( var name in obj ) {
buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
}
} else {
// Serialize scalar item.
add( prefix, obj );
}
}
// This is still on the jQuery object... for now
// Want to move this to jQuery.ajax some day
jQuery.extend({
// Counter for holding the number of active queries
active: 0,
// Last-Modified header cache for next request
lastModified: {},
etag: {}
});
/* Handles responses to an ajax request:
* - sets all responseXXX fields accordingly
* - finds the right dataType (mediates between content-type and expected dataType)
* - returns the corresponding response
*/
function ajaxHandleResponses( s, jqXHR, responses ) {
var contents = s.contents,
dataTypes = s.dataTypes,
responseFields = s.responseFields,
ct,
type,
finalDataType,
firstDataType;
// Fill responseXXX fields
for ( type in responseFields ) {
if ( type in responses ) {
jqXHR[ responseFields[type] ] = responses[ type ];
}
}
// Remove auto dataType and get content-type in the process
while( dataTypes[ 0 ] === "*" ) {
dataTypes.shift();
if ( ct === undefined ) {
ct = s.mimeType || jqXHR.getResponseHeader( "content-type" );
}
}
// Check if we're dealing with a known content-type
if ( ct ) {
for ( type in contents ) {
if ( contents[ type ] && contents[ type ].test( ct ) ) {
dataTypes.unshift( type );
break;
}
}
}
// Check to see if we have a response for the expected dataType
if ( dataTypes[ 0 ] in responses ) {
finalDataType = dataTypes[ 0 ];
} else {
// Try convertible dataTypes
for ( type in responses ) {
if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) {
finalDataType = type;
break;
}
if ( !firstDataType ) {
firstDataType = type;
}
}
// Or just use first one
finalDataType = finalDataType || firstDataType;
}
// If we found a dataType
// We add the dataType to the list if needed
// and return the corresponding response
if ( finalDataType ) {
if ( finalDataType !== dataTypes[ 0 ] ) {
dataTypes.unshift( finalDataType );
}
return responses[ finalDataType ];
}
}
// Chain conversions given the request and the original response
function ajaxConvert( s, response ) {
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
}
var dataTypes = s.dataTypes,
converters = {},
i,
key,
length = dataTypes.length,
tmp,
// Current and previous dataTypes
current = dataTypes[ 0 ],
prev,
// Conversion expression
conversion,
// Conversion function
conv,
// Conversion functions (transitive conversion)
conv1,
conv2;
// For each dataType in the chain
for ( i = 1; i < length; i++ ) {
// Create converters map
// with lowercased keys
if ( i === 1 ) {
for ( key in s.converters ) {
if ( typeof key === "string" ) {
converters[ key.toLowerCase() ] = s.converters[ key ];
}
}
}
// Get the dataTypes
prev = current;
current = dataTypes[ i ];
// If current is auto dataType, update it to prev
if ( current === "*" ) {
current = prev;
// If no auto and dataTypes are actually different
} else if ( prev !== "*" && prev !== current ) {
// Get the converter
conversion = prev + " " + current;
conv = converters[ conversion ] || converters[ "* " + current ];
// If there is no direct converter, search transitively
if ( !conv ) {
conv2 = undefined;
for ( conv1 in converters ) {
tmp = conv1.split( " " );
if ( tmp[ 0 ] === prev || tmp[ 0 ] === "*" ) {
conv2 = converters[ tmp[1] + " " + current ];
if ( conv2 ) {
conv1 = converters[ conv1 ];
if ( conv1 === true ) {
conv = conv2;
} else if ( conv2 === true ) {
conv = conv1;
}
break;
}
}
}
}
// If we found no converter, dispatch an error
if ( !( conv || conv2 ) ) {
jQuery.error( "No conversion from " + conversion.replace(" "," to ") );
}
// If found converter is not an equivalence
if ( conv !== true ) {
// Convert with 1 or 2 converters accordingly
response = conv ? conv( response ) : conv2( conv1(response) );
}
}
}
return response;
}
var jsc = jQuery.now(),
jsre = /(\=)\?(&|$)|\?\?/i;
// Default jsonp settings
jQuery.ajaxSetup({
jsonp: "callback",
jsonpCallback: function() {
return jQuery.expando + "_" + ( jsc++ );
}
});
// Detect, normalize options and install callbacks for jsonp requests
jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
var inspectData = s.contentType === "application/x-www-form-urlencoded" &&
( typeof s.data === "string" );
if ( s.dataTypes[ 0 ] === "jsonp" ||
s.jsonp !== false && ( jsre.test( s.url ) ||
inspectData && jsre.test( s.data ) ) ) {
var responseContainer,
jsonpCallback = s.jsonpCallback =
jQuery.isFunction( s.jsonpCallback ) ? s.jsonpCallback() : s.jsonpCallback,
previous = window[ jsonpCallback ],
url = s.url,
data = s.data,
replace = "$1" + jsonpCallback + "$2";
if ( s.jsonp !== false ) {
url = url.replace( jsre, replace );
if ( s.url === url ) {
if ( inspectData ) {
data = data.replace( jsre, replace );
}
if ( s.data === data ) {
// Add callback manually
url += (/\?/.test( url ) ? "&" : "?") + s.jsonp + "=" + jsonpCallback;
}
}
}
s.url = url;
s.data = data;
// Install callback
window[ jsonpCallback ] = function( response ) {
responseContainer = [ response ];
};
// Clean-up function
jqXHR.always(function() {
// Set callback back to previous value
window[ jsonpCallback ] = previous;
// Call if it was a function and we have a response
if ( responseContainer && jQuery.isFunction( previous ) ) {
window[ jsonpCallback ]( responseContainer[ 0 ] );
}
});
// Use data converter to retrieve json after script execution
s.converters["script json"] = function() {
if ( !responseContainer ) {
jQuery.error( jsonpCallback + " was not called" );
}
return responseContainer[ 0 ];
};
// force json dataType
s.dataTypes[ 0 ] = "json";
// Delegate to script
return "script";
}
});
// Install script dataType
jQuery.ajaxSetup({
accepts: {
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
},
contents: {
script: /javascript|ecmascript/
},
converters: {
"text script": function( text ) {
jQuery.globalEval( text );
return text;
}
}
});
// Handle cache's special case and global
jQuery.ajaxPrefilter( "script", function( s ) {
if ( s.cache === undefined ) {
s.cache = false;
}
if ( s.crossDomain ) {
s.type = "GET";
s.global = false;
}
});
// Bind script tag hack transport
jQuery.ajaxTransport( "script", function(s) {
// This transport only deals with cross domain requests
if ( s.crossDomain ) {
var script,
head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement;
return {
send: function( _, callback ) {
script = document.createElement( "script" );
script.async = "async";
if ( s.scriptCharset ) {
script.charset = s.scriptCharset;
}
script.src = s.url;
// Attach handlers for all browsers
script.onload = script.onreadystatechange = function( _, isAbort ) {
if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) {
// Handle memory leak in IE
script.onload = script.onreadystatechange = null;
// Remove the script
if ( head && script.parentNode ) {
head.removeChild( script );
}
// Dereference the script
script = undefined;
// Callback if not abort
if ( !isAbort ) {
callback( 200, "success" );
}
}
};
// Use insertBefore instead of appendChild to circumvent an IE6 bug.
// This arises when a base node is used (#2709 and #4378).
head.insertBefore( script, head.firstChild );
},
abort: function() {
if ( script ) {
script.onload( 0, 1 );
}
}
};
}
});
var // #5280: Internet Explorer will keep connections alive if we don't abort on unload
xhrOnUnloadAbort = window.ActiveXObject ? function() {
// Abort all pending requests
for ( var key in xhrCallbacks ) {
xhrCallbacks[ key ]( 0, 1 );
}
} : false,
xhrId = 0,
xhrCallbacks;
// Functions to create xhrs
function createStandardXHR() {
try {
return new window.XMLHttpRequest();
} catch( e ) {}
}
function createActiveXHR() {
try {
return new window.ActiveXObject( "Microsoft.XMLHTTP" );
} catch( e ) {}
}
// Create the request object
// (This is still attached to ajaxSettings for backward compatibility)
jQuery.ajaxSettings.xhr = window.ActiveXObject ?
/* Microsoft failed to properly
* implement the XMLHttpRequest in IE7 (can't request local files),
* so we use the ActiveXObject when it is available
* Additionally XMLHttpRequest can be disabled in IE7/IE8 so
* we need a fallback.
*/
function() {
return !this.isLocal && createStandardXHR() || createActiveXHR();
} :
// For all other browsers, use the standard XMLHttpRequest object
createStandardXHR;
// Determine support properties
(function( xhr ) {
jQuery.extend( jQuery.support, {
ajax: !!xhr,
cors: !!xhr && ( "withCredentials" in xhr )
});
})( jQuery.ajaxSettings.xhr() );
// Create transport if the browser can provide an xhr
if ( jQuery.support.ajax ) {
jQuery.ajaxTransport(function( s ) {
// Cross domain only allowed if supported through XMLHttpRequest
if ( !s.crossDomain || jQuery.support.cors ) {
var callback;
return {
send: function( headers, complete ) {
// Get a new xhr
var xhr = s.xhr(),
handle,
i;
// Open the socket
// Passing null username, generates a login popup on Opera (#2865)
if ( s.username ) {
xhr.open( s.type, s.url, s.async, s.username, s.password );
} else {
xhr.open( s.type, s.url, s.async );
}
// Apply custom fields if provided
if ( s.xhrFields ) {
for ( i in s.xhrFields ) {
xhr[ i ] = s.xhrFields[ i ];
}
}
// Override mime type if needed
if ( s.mimeType && xhr.overrideMimeType ) {
xhr.overrideMimeType( s.mimeType );
}
// X-Requested-With header
// For cross-domain requests, seeing as conditions for a preflight are
// akin to a jigsaw puzzle, we simply never set it to be sure.
// (it can always be set on a per-request basis or even using ajaxSetup)
// For same-domain requests, won't change header if already provided.
if ( !s.crossDomain && !headers["X-Requested-With"] ) {
headers[ "X-Requested-With" ] = "XMLHttpRequest";
}
// Need an extra try/catch for cross domain requests in Firefox 3
try {
for ( i in headers ) {
xhr.setRequestHeader( i, headers[ i ] );
}
} catch( _ ) {}
// Do send the request
// This may raise an exception which is actually
// handled in jQuery.ajax (so no try/catch here)
xhr.send( ( s.hasContent && s.data ) || null );
// Listener
callback = function( _, isAbort ) {
var status,
statusText,
responseHeaders,
responses,
xml;
// Firefox throws exceptions when accessing properties
// of an xhr when a network error occured
// http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE)
try {
// Was never called and is aborted or complete
if ( callback && ( isAbort || xhr.readyState === 4 ) ) {
// Only called once
callback = undefined;
// Do not keep as active anymore
if ( handle ) {
xhr.onreadystatechange = jQuery.noop;
if ( xhrOnUnloadAbort ) {
delete xhrCallbacks[ handle ];
}
}
// If it's an abort
if ( isAbort ) {
// Abort it manually if needed
if ( xhr.readyState !== 4 ) {
xhr.abort();
}
} else {
status = xhr.status;
responseHeaders = xhr.getAllResponseHeaders();
responses = {};
xml = xhr.responseXML;
// Construct response list
if ( xml && xml.documentElement /* #4958 */ ) {
responses.xml = xml;
}
responses.text = xhr.responseText;
// Firefox throws an exception when accessing
// statusText for faulty cross-domain requests
try {
statusText = xhr.statusText;
} catch( e ) {
// We normalize with Webkit giving an empty statusText
statusText = "";
}
// Filter status for non standard behaviors
// If the request is local and we have data: assume a success
// (success with no data won't get notified, that's the best we
// can do given current implementations)
if ( !status && s.isLocal && !s.crossDomain ) {
status = responses.text ? 200 : 404;
// IE - #1450: sometimes returns 1223 when it should be 204
} else if ( status === 1223 ) {
status = 204;
}
}
}
} catch( firefoxAccessException ) {
if ( !isAbort ) {
complete( -1, firefoxAccessException );
}
}
// Call complete if needed
if ( responses ) {
complete( status, statusText, responses, responseHeaders );
}
};
// if we're in sync mode or it's in cache
// and has been retrieved directly (IE6 & IE7)
// we need to manually fire the callback
if ( !s.async || xhr.readyState === 4 ) {
callback();
} else {
handle = ++xhrId;
if ( xhrOnUnloadAbort ) {
// Create the active xhrs callbacks list if needed
// and attach the unload handler
if ( !xhrCallbacks ) {
xhrCallbacks = {};
jQuery( window ).unload( xhrOnUnloadAbort );
}
// Add to list of active xhrs callbacks
xhrCallbacks[ handle ] = callback;
}
xhr.onreadystatechange = callback;
}
},
abort: function() {
if ( callback ) {
callback(0,1);
}
}
};
}
});
}
var elemdisplay = {},
iframe, iframeDoc,
rfxtypes = /^(?:toggle|show|hide)$/,
rfxnum = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,
timerId,
fxAttrs = [
// height animations
[ "height", "marginTop", "marginBottom", "paddingTop", "paddingBottom" ],
// width animations
[ "width", "marginLeft", "marginRight", "paddingLeft", "paddingRight" ],
// opacity animations
[ "opacity" ]
],
fxNow;
jQuery.fn.extend({
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback );
} else {
for ( var i = 0, j = this.length; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
// Reset the inline display of this element to learn if it is
// being hidden by cascaded rules or not
if ( !jQuery._data(elem, "olddisplay") && display === "none" ) {
display = elem.style.display = "";
}
// Set elements which have been overridden with display: none
// in a stylesheet to whatever the default browser style is
// for such an element
if ( display === "" && jQuery.css(elem, "display") === "none" ) {
jQuery._data( elem, "olddisplay", defaultDisplay(elem.nodeName) );
}
}
}
// Set the display of most of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
elem = this[ i ];
if ( elem.style ) {
display = elem.style.display;
if ( display === "" || display === "none" ) {
elem.style.display = jQuery._data( elem, "olddisplay" ) || "";
}
}
}
return this;
}
},
hide: function( speed, easing, callback ) {
if ( speed || speed === 0 ) {
return this.animate( genFx("hide", 3), speed, easing, callback);
} else {
var elem, display,
i = 0,
j = this.length;
for ( ; i < j; i++ ) {
elem = this[i];
if ( elem.style ) {
display = jQuery.css( elem, "display" );
if ( display !== "none" && !jQuery._data( elem, "olddisplay" ) ) {
jQuery._data( elem, "olddisplay", display );
}
}
}
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( i = 0; i < j; i++ ) {
if ( this[i].style ) {
this[i].style.display = "none";
}
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2, callback ) {
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2, callback);
}
return this;
},
fadeTo: function( speed, to, easing, callback ) {
return this.filter(":hidden").css("opacity", 0).show().end()
.animate({opacity: to}, speed, easing, callback);
},
animate: function( prop, speed, easing, callback ) {
var optall = jQuery.speed( speed, easing, callback );
if ( jQuery.isEmptyObject( prop ) ) {
return this.each( optall.complete, [ false ] );
}
// Do not change referenced properties as per-property easing will be lost
prop = jQuery.extend( {}, prop );
function doAnimation() {
// XXX 'this' does not always have a nodeName when running the
// test suite
if ( optall.queue === false ) {
jQuery._mark( this );
}
var opt = jQuery.extend( {}, optall ),
isElement = this.nodeType === 1,
hidden = isElement && jQuery(this).is(":hidden"),
name, val, p, e,
parts, start, end, unit,
method;
// will store per property easing and be used to determine when an animation is complete
opt.animatedProperties = {};
for ( p in prop ) {
// property name normalization
name = jQuery.camelCase( p );
if ( p !== name ) {
prop[ name ] = prop[ p ];
delete prop[ p ];
}
val = prop[ name ];
// easing resolution: per property > opt.specialEasing > opt.easing > 'swing' (default)
if ( jQuery.isArray( val ) ) {
opt.animatedProperties[ name ] = val[ 1 ];
val = prop[ name ] = val[ 0 ];
} else {
opt.animatedProperties[ name ] = opt.specialEasing && opt.specialEasing[ name ] || opt.easing || 'swing';
}
if ( val === "hide" && hidden || val === "show" && !hidden ) {
return opt.complete.call( this );
}
if ( isElement && ( name === "height" || name === "width" ) ) {
// Make sure that nothing sneaks out
// Record all 3 overflow attributes because IE does not
// change the overflow attribute when overflowX and
// overflowY are set to the same value
opt.overflow = [ this.style.overflow, this.style.overflowX, this.style.overflowY ];
// Set display property to inline-block for height/width
// animations on inline elements that are having width/height animated
if ( jQuery.css( this, "display" ) === "inline" &&
jQuery.css( this, "float" ) === "none" ) {
// inline-level elements accept inline-block;
// block-level elements need to be inline with layout
if ( !jQuery.support.inlineBlockNeedsLayout || defaultDisplay( this.nodeName ) === "inline" ) {
this.style.display = "inline-block";
} else {
this.style.zoom = 1;
}
}
}
}
if ( opt.overflow != null ) {
this.style.overflow = "hidden";
}
for ( p in prop ) {
e = new jQuery.fx( this, opt, p );
val = prop[ p ];
if ( rfxtypes.test( val ) ) {
// Tracks whether to show or hide based on private
// data attached to the element
method = jQuery._data( this, "toggle" + p ) || ( val === "toggle" ? hidden ? "show" : "hide" : 0 );
if ( method ) {
jQuery._data( this, "toggle" + p, method === "show" ? "hide" : "show" );
e[ method ]();
} else {
e[ val ]();
}
} else {
parts = rfxnum.exec( val );
start = e.cur();
if ( parts ) {
end = parseFloat( parts[2] );
unit = parts[3] || ( jQuery.cssNumber[ p ] ? "" : "px" );
// We need to compute starting value
if ( unit !== "px" ) {
jQuery.style( this, p, (end || 1) + unit);
start = ( (end || 1) / e.cur() ) * start;
jQuery.style( this, p, start + unit);
}
// If a +=/-= token was provided, we're doing a relative animation
if ( parts[1] ) {
end = ( (parts[ 1 ] === "-=" ? -1 : 1) * end ) + start;
}
e.custom( start, end, unit );
} else {
e.custom( start, val, "" );
}
}
}
// For JS strict compliance
return true;
}
return optall.queue === false ?
this.each( doAnimation ) :
this.queue( optall.queue, doAnimation );
},
stop: function( type, clearQueue, gotoEnd ) {
if ( typeof type !== "string" ) {
gotoEnd = clearQueue;
clearQueue = type;
type = undefined;
}
if ( clearQueue && type !== false ) {
this.queue( type || "fx", [] );
}
return this.each(function() {
var index,
hadTimers = false,
timers = jQuery.timers,
data = jQuery._data( this );
// clear marker counters if we know they won't be
if ( !gotoEnd ) {
jQuery._unmark( true, this );
}
function stopQueue( elem, data, index ) {
var hooks = data[ index ];
jQuery.removeData( elem, index, true );
hooks.stop( gotoEnd );
}
if ( type == null ) {
for ( index in data ) {
if ( data[ index ] && data[ index ].stop && index.indexOf(".run") === index.length - 4 ) {
stopQueue( this, data, index );
}
}
} else if ( data[ index = type + ".run" ] && data[ index ].stop ){
stopQueue( this, data, index );
}
for ( index = timers.length; index--; ) {
if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) {
if ( gotoEnd ) {
// force the next step to be the last
timers[ index ]( true );
} else {
timers[ index ].saveState();
}
hadTimers = true;
timers.splice( index, 1 );
}
}
// start the next in the queue if the last step wasn't forced
// timers currently will call their complete callbacks, which will dequeue
// but only if they were gotoEnd
if ( !( gotoEnd && hadTimers ) ) {
jQuery.dequeue( this, type );
}
});
}
});
// Animations created synchronously will run synchronously
function createFxNow() {
setTimeout( clearFxNow, 0 );
return ( fxNow = jQuery.now() );
}
function clearFxNow() {
fxNow = undefined;
}
// Generate parameters to create a standard animation
function genFx( type, num ) {
var obj = {};
jQuery.each( fxAttrs.concat.apply([], fxAttrs.slice( 0, num )), function() {
obj[ this ] = type;
});
return obj;
}
// Generate shortcuts for custom animations
jQuery.each({
slideDown: genFx( "show", 1 ),
slideUp: genFx( "hide", 1 ),
slideToggle: genFx( "toggle", 1 ),
fadeIn: { opacity: "show" },
fadeOut: { opacity: "hide" },
fadeToggle: { opacity: "toggle" }
}, function( name, props ) {
jQuery.fn[ name ] = function( speed, easing, callback ) {
return this.animate( props, speed, easing, callback );
};
});
jQuery.extend({
speed: function( speed, easing, fn ) {
var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
complete: fn || !fn && easing ||
jQuery.isFunction( speed ) && speed,
duration: speed,
easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing
};
opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration :
opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default;
// normalize opt.queue - true/undefined/null -> "fx"
if ( opt.queue == null || opt.queue === true ) {
opt.queue = "fx";
}
// Queueing
opt.old = opt.complete;
opt.complete = function( noUnmark ) {
if ( jQuery.isFunction( opt.old ) ) {
opt.old.call( this );
}
if ( opt.queue ) {
jQuery.dequeue( this, opt.queue );
} else if ( noUnmark !== false ) {
jQuery._unmark( this );
}
};
return opt;
},
easing: {
linear: function( p, n, firstNum, diff ) {
return firstNum + diff * p;
},
swing: function( p, n, firstNum, diff ) {
return ( ( -Math.cos( p*Math.PI ) / 2 ) + 0.5 ) * diff + firstNum;
}
},
timers: [],
fx: function( elem, options, prop ) {
this.options = options;
this.elem = elem;
this.prop = prop;
options.orig = options.orig || {};
}
});
jQuery.fx.prototype = {
// Simple function for setting a style value
update: function() {
if ( this.options.step ) {
this.options.step.call( this.elem, this.now, this );
}
( jQuery.fx.step[ this.prop ] || jQuery.fx.step._default )( this );
},
// Get the current size
cur: function() {
if ( this.elem[ this.prop ] != null && (!this.elem.style || this.elem.style[ this.prop ] == null) ) {
return this.elem[ this.prop ];
}
var parsed,
r = jQuery.css( this.elem, this.prop );
// Empty strings, null, undefined and "auto" are converted to 0,
// complex values such as "rotate(1rad)" are returned as is,
// simple values such as "10px" are parsed to Float.
return isNaN( parsed = parseFloat( r ) ) ? !r || r === "auto" ? 0 : r : parsed;
},
// Start an animation from one number to another
custom: function( from, to, unit ) {
var self = this,
fx = jQuery.fx;
this.startTime = fxNow || createFxNow();
this.end = to;
this.now = this.start = from;
this.pos = this.state = 0;
this.unit = unit || this.unit || ( jQuery.cssNumber[ this.prop ] ? "" : "px" );
function t( gotoEnd ) {
return self.step( gotoEnd );
}
t.queue = this.options.queue;
t.elem = this.elem;
t.saveState = function() {
if ( self.options.hide && jQuery._data( self.elem, "fxshow" + self.prop ) === undefined ) {
jQuery._data( self.elem, "fxshow" + self.prop, self.start );
}
};
if ( t() && jQuery.timers.push(t) && !timerId ) {
timerId = setInterval( fx.tick, fx.interval );
}
},
// Simple 'show' function
show: function() {
var dataShow = jQuery._data( this.elem, "fxshow" + this.prop );
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = dataShow || jQuery.style( this.elem, this.prop );
this.options.show = true;
// Begin the animation
// Make sure that we start at a small width/height to avoid any flash of content
if ( dataShow !== undefined ) {
// This show is picking up where a previous hide or show left off
this.custom( this.cur(), dataShow );
} else {
this.custom( this.prop === "width" || this.prop === "height" ? 1 : 0, this.cur() );
}
// Start by showing the element
jQuery( this.elem ).show();
},
// Simple 'hide' function
hide: function() {
// Remember where we started, so that we can go back to it later
this.options.orig[ this.prop ] = jQuery._data( this.elem, "fxshow" + this.prop ) || jQuery.style( this.elem, this.prop );
this.options.hide = true;
// Begin the animation
this.custom( this.cur(), 0 );
},
// Each step of an animation
step: function( gotoEnd ) {
var p, n, complete,
t = fxNow || createFxNow(),
done = true,
elem = this.elem,
options = this.options;
if ( gotoEnd || t >= options.duration + this.startTime ) {
this.now = this.end;
this.pos = this.state = 1;
this.update();
options.animatedProperties[ this.prop ] = true;
for ( p in options.animatedProperties ) {
if ( options.animatedProperties[ p ] !== true ) {
done = false;
}
}
if ( done ) {
// Reset the overflow
if ( options.overflow != null && !jQuery.support.shrinkWrapBlocks ) {
jQuery.each( [ "", "X", "Y" ], function( index, value ) {
elem.style[ "overflow" + value ] = options.overflow[ index ];
});
}
// Hide the element if the "hide" operation was done
if ( options.hide ) {
jQuery( elem ).hide();
}
// Reset the properties, if the item has been hidden or shown
if ( options.hide || options.show ) {
for ( p in options.animatedProperties ) {
jQuery.style( elem, p, options.orig[ p ] );
jQuery.removeData( elem, "fxshow" + p, true );
// Toggle data is no longer needed
jQuery.removeData( elem, "toggle" + p, true );
}
}
// Execute the complete function
// in the event that the complete function throws an exception
// we must ensure it won't be called twice. #5684
complete = options.complete;
if ( complete ) {
options.complete = false;
complete.call( elem );
}
}
return false;
} else {
// classical easing cannot be used with an Infinity duration
if ( options.duration == Infinity ) {
this.now = t;
} else {
n = t - this.startTime;
this.state = n / options.duration;
// Perform the easing function, defaults to swing
this.pos = jQuery.easing[ options.animatedProperties[this.prop] ]( this.state, n, 0, 1, options.duration );
this.now = this.start + ( (this.end - this.start) * this.pos );
}
// Perform the next step of the animation
this.update();
}
return true;
}
};
jQuery.extend( jQuery.fx, {
tick: function() {
var timer,
timers = jQuery.timers,
i = 0;
for ( ; i < timers.length; i++ ) {
timer = timers[ i ];
// Checks the timer has not already been removed
if ( !timer() && timers[ i ] === timer ) {
timers.splice( i--, 1 );
}
}
if ( !timers.length ) {
jQuery.fx.stop();
}
},
interval: 13,
stop: function() {
clearInterval( timerId );
timerId = null;
},
speeds: {
slow: 600,
fast: 200,
// Default speed
_default: 400
},
step: {
opacity: function( fx ) {
jQuery.style( fx.elem, "opacity", fx.now );
},
_default: function( fx ) {
if ( fx.elem.style && fx.elem.style[ fx.prop ] != null ) {
fx.elem.style[ fx.prop ] = fx.now + fx.unit;
} else {
fx.elem[ fx.prop ] = fx.now;
}
}
}
});
// Adds width/height step functions
// Do not set anything below 0
jQuery.each([ "width", "height" ], function( i, prop ) {
jQuery.fx.step[ prop ] = function( fx ) {
jQuery.style( fx.elem, prop, Math.max(0, fx.now) + fx.unit );
};
});
if ( jQuery.expr && jQuery.expr.filters ) {
jQuery.expr.filters.animated = function( elem ) {
return jQuery.grep(jQuery.timers, function( fn ) {
return elem === fn.elem;
}).length;
};
}
// Try to restore the default display value of an element
function defaultDisplay( nodeName ) {
if ( !elemdisplay[ nodeName ] ) {
var body = document.body,
elem = jQuery( "<" + nodeName + ">" ).appendTo( body ),
display = elem.css( "display" );
elem.remove();
// If the simple way fails,
// get element's real default display by attaching it to a temp iframe
if ( display === "none" || display === "" ) {
// No iframe to use yet, so create it
if ( !iframe ) {
iframe = document.createElement( "iframe" );
iframe.frameBorder = iframe.width = iframe.height = 0;
}
body.appendChild( iframe );
// Create a cacheable copy of the iframe document on first call.
// IE and Opera will allow us to reuse the iframeDoc without re-writing the fake HTML
// document to it; WebKit & Firefox won't allow reusing the iframe document.
if ( !iframeDoc || !iframe.createElement ) {
iframeDoc = ( iframe.contentWindow || iframe.contentDocument ).document;
iframeDoc.write( ( document.compatMode === "CSS1Compat" ? "<!doctype html>" : "" ) + "<html><body>" );
iframeDoc.close();
}
elem = iframeDoc.createElement( nodeName );
iframeDoc.body.appendChild( elem );
display = jQuery.css( elem, "display" );
body.removeChild( iframe );
}
// Store the correct default display
elemdisplay[ nodeName ] = display;
}
return elemdisplay[ nodeName ];
}
var rtable = /^t(?:able|d|h)$/i,
rroot = /^(?:body|html)$/i;
if ( "getBoundingClientRect" in document.documentElement ) {
jQuery.fn.offset = function( options ) {
var elem = this[0], box;
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
try {
box = elem.getBoundingClientRect();
} catch(e) {}
var doc = elem.ownerDocument,
docElem = doc.documentElement;
// Make sure we're not dealing with a disconnected DOM node
if ( !box || !jQuery.contains( docElem, elem ) ) {
return box ? { top: box.top, left: box.left } : { top: 0, left: 0 };
}
var body = doc.body,
win = getWindow(doc),
clientTop = docElem.clientTop || body.clientTop || 0,
clientLeft = docElem.clientLeft || body.clientLeft || 0,
scrollTop = win.pageYOffset || jQuery.support.boxModel && docElem.scrollTop || body.scrollTop,
scrollLeft = win.pageXOffset || jQuery.support.boxModel && docElem.scrollLeft || body.scrollLeft,
top = box.top + scrollTop - clientTop,
left = box.left + scrollLeft - clientLeft;
return { top: top, left: left };
};
} else {
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
return this.each(function( i ) {
jQuery.offset.setOffset( this, options, i );
});
}
if ( !elem || !elem.ownerDocument ) {
return null;
}
if ( elem === elem.ownerDocument.body ) {
return jQuery.offset.bodyOffset( elem );
}
var computedStyle,
offsetParent = elem.offsetParent,
prevOffsetParent = elem,
doc = elem.ownerDocument,
docElem = doc.documentElement,
body = doc.body,
defaultView = doc.defaultView,
prevComputedStyle = defaultView ? defaultView.getComputedStyle( elem, null ) : elem.currentStyle,
top = elem.offsetTop,
left = elem.offsetLeft;
while ( (elem = elem.parentNode) && elem !== body && elem !== docElem ) {
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
break;
}
computedStyle = defaultView ? defaultView.getComputedStyle(elem, null) : elem.currentStyle;
top -= elem.scrollTop;
left -= elem.scrollLeft;
if ( elem === offsetParent ) {
top += elem.offsetTop;
left += elem.offsetLeft;
if ( jQuery.support.doesNotAddBorder && !(jQuery.support.doesAddBorderForTableAndCells && rtable.test(elem.nodeName)) ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevOffsetParent = offsetParent;
offsetParent = elem.offsetParent;
}
if ( jQuery.support.subtractsBorderForOverflowNotVisible && computedStyle.overflow !== "visible" ) {
top += parseFloat( computedStyle.borderTopWidth ) || 0;
left += parseFloat( computedStyle.borderLeftWidth ) || 0;
}
prevComputedStyle = computedStyle;
}
if ( prevComputedStyle.position === "relative" || prevComputedStyle.position === "static" ) {
top += body.offsetTop;
left += body.offsetLeft;
}
if ( jQuery.support.fixedPosition && prevComputedStyle.position === "fixed" ) {
top += Math.max( docElem.scrollTop, body.scrollTop );
left += Math.max( docElem.scrollLeft, body.scrollLeft );
}
return { top: top, left: left };
};
}
jQuery.offset = {
bodyOffset: function( body ) {
var top = body.offsetTop,
left = body.offsetLeft;
if ( jQuery.support.doesNotIncludeMarginInBodyOffset ) {
top += parseFloat( jQuery.css(body, "marginTop") ) || 0;
left += parseFloat( jQuery.css(body, "marginLeft") ) || 0;
}
return { top: top, left: left };
},
setOffset: function( elem, options, i ) {
var position = jQuery.css( elem, "position" );
// set position first, in-case top/left are set even on static elem
if ( position === "static" ) {
elem.style.position = "relative";
}
var curElem = jQuery( elem ),
curOffset = curElem.offset(),
curCSSTop = jQuery.css( elem, "top" ),
curCSSLeft = jQuery.css( elem, "left" ),
calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1,
props = {}, curPosition = {}, curTop, curLeft;
// need to be able to calculate position if either top or left is auto and position is either absolute or fixed
if ( calculatePosition ) {
curPosition = curElem.position();
curTop = curPosition.top;
curLeft = curPosition.left;
} else {
curTop = parseFloat( curCSSTop ) || 0;
curLeft = parseFloat( curCSSLeft ) || 0;
}
if ( jQuery.isFunction( options ) ) {
options = options.call( elem, i, curOffset );
}
if ( options.top != null ) {
props.top = ( options.top - curOffset.top ) + curTop;
}
if ( options.left != null ) {
props.left = ( options.left - curOffset.left ) + curLeft;
}
if ( "using" in options ) {
options.using.call( elem, props );
} else {
curElem.css( props );
}
}
};
jQuery.fn.extend({
position: function() {
if ( !this[0] ) {
return null;
}
var elem = this[0],
// Get *real* offsetParent
offsetParent = this.offsetParent(),
// Get correct offsets
offset = this.offset(),
parentOffset = rroot.test(offsetParent[0].nodeName) ? { top: 0, left: 0 } : offsetParent.offset();
// Subtract element margins
// note: when an element has margin: auto the offsetLeft and marginLeft
// are the same in Safari causing offset.left to incorrectly be 0
offset.top -= parseFloat( jQuery.css(elem, "marginTop") ) || 0;
offset.left -= parseFloat( jQuery.css(elem, "marginLeft") ) || 0;
// Add offsetParent borders
parentOffset.top += parseFloat( jQuery.css(offsetParent[0], "borderTopWidth") ) || 0;
parentOffset.left += parseFloat( jQuery.css(offsetParent[0], "borderLeftWidth") ) || 0;
// Subtract the two offsets
return {
top: offset.top - parentOffset.top,
left: offset.left - parentOffset.left
};
},
offsetParent: function() {
return this.map(function() {
var offsetParent = this.offsetParent || document.body;
while ( offsetParent && (!rroot.test(offsetParent.nodeName) && jQuery.css(offsetParent, "position") === "static") ) {
offsetParent = offsetParent.offsetParent;
}
return offsetParent;
});
}
});
// Create scrollLeft and scrollTop methods
jQuery.each( ["Left", "Top"], function( i, name ) {
var method = "scroll" + name;
jQuery.fn[ method ] = function( val ) {
var elem, win;
if ( val === undefined ) {
elem = this[ 0 ];
if ( !elem ) {
return null;
}
win = getWindow( elem );
// Return the scroll offset
return win ? ("pageXOffset" in win) ? win[ i ? "pageYOffset" : "pageXOffset" ] :
jQuery.support.boxModel && win.document.documentElement[ method ] ||
win.document.body[ method ] :
elem[ method ];
}
// Set the scroll offset
return this.each(function() {
win = getWindow( this );
if ( win ) {
win.scrollTo(
!i ? val : jQuery( win ).scrollLeft(),
i ? val : jQuery( win ).scrollTop()
);
} else {
this[ method ] = val;
}
});
};
});
function getWindow( elem ) {
return jQuery.isWindow( elem ) ?
elem :
elem.nodeType === 9 ?
elem.defaultView || elem.parentWindow :
false;
}
// Create width, height, innerHeight, innerWidth, outerHeight and outerWidth methods
jQuery.each([ "Height", "Width" ], function( i, name ) {
var type = name.toLowerCase();
// innerHeight and innerWidth
jQuery.fn[ "inner" + name ] = function() {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, "padding" ) ) :
this[ type ]() :
null;
};
// outerHeight and outerWidth
jQuery.fn[ "outer" + name ] = function( margin ) {
var elem = this[0];
return elem ?
elem.style ?
parseFloat( jQuery.css( elem, type, margin ? "margin" : "border" ) ) :
this[ type ]() :
null;
};
jQuery.fn[ type ] = function( size ) {
// Get window width or height
var elem = this[0];
if ( !elem ) {
return size == null ? null : this;
}
if ( jQuery.isFunction( size ) ) {
return this.each(function( i ) {
var self = jQuery( this );
self[ type ]( size.call( this, i, self[ type ]() ) );
});
}
if ( jQuery.isWindow( elem ) ) {
// Everyone else use document.documentElement or document.body depending on Quirks vs Standards mode
// 3rd condition allows Nokia support, as it supports the docElem prop but not CSS1Compat
var docElemProp = elem.document.documentElement[ "client" + name ],
body = elem.document.body;
return elem.document.compatMode === "CSS1Compat" && docElemProp ||
body && body[ "client" + name ] || docElemProp;
// Get document width or height
} else if ( elem.nodeType === 9 ) {
// Either scroll[Width/Height] or offset[Width/Height], whichever is greater
return Math.max(
elem.documentElement["client" + name],
elem.body["scroll" + name], elem.documentElement["scroll" + name],
elem.body["offset" + name], elem.documentElement["offset" + name]
);
// Get or set width or height on the element
} else if ( size === undefined ) {
var orig = jQuery.css( elem, type ),
ret = parseFloat( orig );
return jQuery.isNumeric( ret ) ? ret : orig;
// Set the width or height on the element (default to pixels if value is unitless)
} else {
return this.css( type, typeof size === "string" ? size : size + "px" );
}
};
});
// Expose jQuery to the global object
window.jQuery = window.$ = jQuery;
// Expose jQuery as an AMD module, but only for AMD loaders that
// understand the issues with loading multiple versions of jQuery
// in a page that all might call define(). The loader will indicate
// they have special allowances for multiple jQuery versions by
// specifying define.amd.jQuery = true. Register as a named module,
// since jQuery can be concatenated with other files that may use define,
// but not use a proper concatenation script that understands anonymous
// AMD modules. A named AMD is safest and most robust way to register.
// Lowercase jquery is used because AMD module names are derived from
// file names, and jQuery is normally delivered in a lowercase file name.
// Do this after creating the global so that if an AMD module wants to call
// noConflict to hide this version of jQuery, it will work.
if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
define( "jquery", [], function () { return jQuery; } );
}
})( window );
|
src/svg-icons/hardware/laptop-chromebook.js
|
w01fgang/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let HardwareLaptopChromebook = (props) => (
<SvgIcon {...props}>
<path d="M22 18V3H2v15H0v2h24v-2h-2zm-8 0h-4v-1h4v1zm6-3H4V5h16v10z"/>
</SvgIcon>
);
HardwareLaptopChromebook = pure(HardwareLaptopChromebook);
HardwareLaptopChromebook.displayName = 'HardwareLaptopChromebook';
HardwareLaptopChromebook.muiName = 'SvgIcon';
export default HardwareLaptopChromebook;
|
files/polymer/0.5.4/polymer.js
|
as-com/jsdelivr
|
/**
* @license
* Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
* This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
* The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
* The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
* Code distributed by Google as part of the polymer project is also
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
// @version 0.5.3
window.PolymerGestures = {};
(function(scope) {
var hasFullPath = false;
// test for full event path support
var pathTest = document.createElement('meta');
if (pathTest.createShadowRoot) {
var sr = pathTest.createShadowRoot();
var s = document.createElement('span');
sr.appendChild(s);
pathTest.addEventListener('testpath', function(ev) {
if (ev.path) {
// if the span is in the event path, then path[0] is the real source for all events
hasFullPath = ev.path[0] === s;
}
ev.stopPropagation();
});
var ev = new CustomEvent('testpath', {bubbles: true});
// must add node to DOM to trigger event listener
document.head.appendChild(pathTest);
s.dispatchEvent(ev);
pathTest.parentNode.removeChild(pathTest);
sr = s = null;
}
pathTest = null;
var target = {
shadow: function(inEl) {
if (inEl) {
return inEl.shadowRoot || inEl.webkitShadowRoot;
}
},
canTarget: function(shadow) {
return shadow && Boolean(shadow.elementFromPoint);
},
targetingShadow: function(inEl) {
var s = this.shadow(inEl);
if (this.canTarget(s)) {
return s;
}
},
olderShadow: function(shadow) {
var os = shadow.olderShadowRoot;
if (!os) {
var se = shadow.querySelector('shadow');
if (se) {
os = se.olderShadowRoot;
}
}
return os;
},
allShadows: function(element) {
var shadows = [], s = this.shadow(element);
while(s) {
shadows.push(s);
s = this.olderShadow(s);
}
return shadows;
},
searchRoot: function(inRoot, x, y) {
var t, st, sr, os;
if (inRoot) {
t = inRoot.elementFromPoint(x, y);
if (t) {
// found element, check if it has a ShadowRoot
sr = this.targetingShadow(t);
} else if (inRoot !== document) {
// check for sibling roots
sr = this.olderShadow(inRoot);
}
// search other roots, fall back to light dom element
return this.searchRoot(sr, x, y) || t;
}
},
owner: function(element) {
if (!element) {
return document;
}
var s = element;
// walk up until you hit the shadow root or document
while (s.parentNode) {
s = s.parentNode;
}
// the owner element is expected to be a Document or ShadowRoot
if (s.nodeType != Node.DOCUMENT_NODE && s.nodeType != Node.DOCUMENT_FRAGMENT_NODE) {
s = document;
}
return s;
},
findTarget: function(inEvent) {
if (hasFullPath && inEvent.path && inEvent.path.length) {
return inEvent.path[0];
}
var x = inEvent.clientX, y = inEvent.clientY;
// if the listener is in the shadow root, it is much faster to start there
var s = this.owner(inEvent.target);
// if x, y is not in this root, fall back to document search
if (!s.elementFromPoint(x, y)) {
s = document;
}
return this.searchRoot(s, x, y);
},
findTouchAction: function(inEvent) {
var n;
if (hasFullPath && inEvent.path && inEvent.path.length) {
var path = inEvent.path;
for (var i = 0; i < path.length; i++) {
n = path[i];
if (n.nodeType === Node.ELEMENT_NODE && n.hasAttribute('touch-action')) {
return n.getAttribute('touch-action');
}
}
} else {
n = inEvent.target;
while(n) {
if (n.nodeType === Node.ELEMENT_NODE && n.hasAttribute('touch-action')) {
return n.getAttribute('touch-action');
}
n = n.parentNode || n.host;
}
}
// auto is default
return "auto";
},
LCA: function(a, b) {
if (a === b) {
return a;
}
if (a && !b) {
return a;
}
if (b && !a) {
return b;
}
if (!b && !a) {
return document;
}
// fast case, a is a direct descendant of b or vice versa
if (a.contains && a.contains(b)) {
return a;
}
if (b.contains && b.contains(a)) {
return b;
}
var adepth = this.depth(a);
var bdepth = this.depth(b);
var d = adepth - bdepth;
if (d >= 0) {
a = this.walk(a, d);
} else {
b = this.walk(b, -d);
}
while (a && b && a !== b) {
a = a.parentNode || a.host;
b = b.parentNode || b.host;
}
return a;
},
walk: function(n, u) {
for (var i = 0; n && (i < u); i++) {
n = n.parentNode || n.host;
}
return n;
},
depth: function(n) {
var d = 0;
while(n) {
d++;
n = n.parentNode || n.host;
}
return d;
},
deepContains: function(a, b) {
var common = this.LCA(a, b);
// if a is the common ancestor, it must "deeply" contain b
return common === a;
},
insideNode: function(node, x, y) {
var rect = node.getBoundingClientRect();
return (rect.left <= x) && (x <= rect.right) && (rect.top <= y) && (y <= rect.bottom);
},
path: function(event) {
var p;
if (hasFullPath && event.path && event.path.length) {
p = event.path;
} else {
p = [];
var n = this.findTarget(event);
while (n) {
p.push(n);
n = n.parentNode || n.host;
}
}
return p;
}
};
scope.targetFinding = target;
/**
* Given an event, finds the "deepest" node that could have been the original target before ShadowDOM retargetting
*
* @param {Event} Event An event object with clientX and clientY properties
* @return {Element} The probable event origninator
*/
scope.findTarget = target.findTarget.bind(target);
/**
* Determines if the "container" node deeply contains the "containee" node, including situations where the "containee" is contained by one or more ShadowDOM
* roots.
*
* @param {Node} container
* @param {Node} containee
* @return {Boolean}
*/
scope.deepContains = target.deepContains.bind(target);
/**
* Determines if the x/y position is inside the given node.
*
* Example:
*
* function upHandler(event) {
* var innode = PolymerGestures.insideNode(event.target, event.clientX, event.clientY);
* if (innode) {
* // wait for tap?
* } else {
* // tap will never happen
* }
* }
*
* @param {Node} node
* @param {Number} x Screen X position
* @param {Number} y screen Y position
* @return {Boolean}
*/
scope.insideNode = target.insideNode;
})(window.PolymerGestures);
(function() {
function shadowSelector(v) {
return 'html /deep/ ' + selector(v);
}
function selector(v) {
return '[touch-action="' + v + '"]';
}
function rule(v) {
return '{ -ms-touch-action: ' + v + '; touch-action: ' + v + ';}';
}
var attrib2css = [
'none',
'auto',
'pan-x',
'pan-y',
{
rule: 'pan-x pan-y',
selectors: [
'pan-x pan-y',
'pan-y pan-x'
]
},
'manipulation'
];
var styles = '';
// only install stylesheet if the browser has touch action support
var hasTouchAction = typeof document.head.style.touchAction === 'string';
// only add shadow selectors if shadowdom is supported
var hasShadowRoot = !window.ShadowDOMPolyfill && document.head.createShadowRoot;
if (hasTouchAction) {
attrib2css.forEach(function(r) {
if (String(r) === r) {
styles += selector(r) + rule(r) + '\n';
if (hasShadowRoot) {
styles += shadowSelector(r) + rule(r) + '\n';
}
} else {
styles += r.selectors.map(selector) + rule(r.rule) + '\n';
if (hasShadowRoot) {
styles += r.selectors.map(shadowSelector) + rule(r.rule) + '\n';
}
}
});
var el = document.createElement('style');
el.textContent = styles;
document.head.appendChild(el);
}
})();
/**
* This is the constructor for new PointerEvents.
*
* New Pointer Events must be given a type, and an optional dictionary of
* initialization properties.
*
* Due to certain platform requirements, events returned from the constructor
* identify as MouseEvents.
*
* @constructor
* @param {String} inType The type of the event to create.
* @param {Object} [inDict] An optional dictionary of initial event properties.
* @return {Event} A new PointerEvent of type `inType` and initialized with properties from `inDict`.
*/
(function(scope) {
var MOUSE_PROPS = [
'bubbles',
'cancelable',
'view',
'detail',
'screenX',
'screenY',
'clientX',
'clientY',
'ctrlKey',
'altKey',
'shiftKey',
'metaKey',
'button',
'relatedTarget',
'pageX',
'pageY'
];
var MOUSE_DEFAULTS = [
false,
false,
null,
null,
0,
0,
0,
0,
false,
false,
false,
false,
0,
null,
0,
0
];
var NOP_FACTORY = function(){ return function(){}; };
var eventFactory = {
// TODO(dfreedm): this is overridden by tap recognizer, needs review
preventTap: NOP_FACTORY,
makeBaseEvent: function(inType, inDict) {
var e = document.createEvent('Event');
e.initEvent(inType, inDict.bubbles || false, inDict.cancelable || false);
e.preventTap = eventFactory.preventTap(e);
return e;
},
makeGestureEvent: function(inType, inDict) {
inDict = inDict || Object.create(null);
var e = this.makeBaseEvent(inType, inDict);
for (var i = 0, keys = Object.keys(inDict), k; i < keys.length; i++) {
k = keys[i];
e[k] = inDict[k];
}
return e;
},
makePointerEvent: function(inType, inDict) {
inDict = inDict || Object.create(null);
var e = this.makeBaseEvent(inType, inDict);
// define inherited MouseEvent properties
for(var i = 0, p; i < MOUSE_PROPS.length; i++) {
p = MOUSE_PROPS[i];
e[p] = inDict[p] || MOUSE_DEFAULTS[i];
}
e.buttons = inDict.buttons || 0;
// Spec requires that pointers without pressure specified use 0.5 for down
// state and 0 for up state.
var pressure = 0;
if (inDict.pressure) {
pressure = inDict.pressure;
} else {
pressure = e.buttons ? 0.5 : 0;
}
// add x/y properties aliased to clientX/Y
e.x = e.clientX;
e.y = e.clientY;
// define the properties of the PointerEvent interface
e.pointerId = inDict.pointerId || 0;
e.width = inDict.width || 0;
e.height = inDict.height || 0;
e.pressure = pressure;
e.tiltX = inDict.tiltX || 0;
e.tiltY = inDict.tiltY || 0;
e.pointerType = inDict.pointerType || '';
e.hwTimestamp = inDict.hwTimestamp || 0;
e.isPrimary = inDict.isPrimary || false;
e._source = inDict._source || '';
return e;
}
};
scope.eventFactory = eventFactory;
})(window.PolymerGestures);
/**
* This module implements an map of pointer states
*/
(function(scope) {
var USE_MAP = window.Map && window.Map.prototype.forEach;
var POINTERS_FN = function(){ return this.size; };
function PointerMap() {
if (USE_MAP) {
var m = new Map();
m.pointers = POINTERS_FN;
return m;
} else {
this.keys = [];
this.values = [];
}
}
PointerMap.prototype = {
set: function(inId, inEvent) {
var i = this.keys.indexOf(inId);
if (i > -1) {
this.values[i] = inEvent;
} else {
this.keys.push(inId);
this.values.push(inEvent);
}
},
has: function(inId) {
return this.keys.indexOf(inId) > -1;
},
'delete': function(inId) {
var i = this.keys.indexOf(inId);
if (i > -1) {
this.keys.splice(i, 1);
this.values.splice(i, 1);
}
},
get: function(inId) {
var i = this.keys.indexOf(inId);
return this.values[i];
},
clear: function() {
this.keys.length = 0;
this.values.length = 0;
},
// return value, key, map
forEach: function(callback, thisArg) {
this.values.forEach(function(v, i) {
callback.call(thisArg, v, this.keys[i], this);
}, this);
},
pointers: function() {
return this.keys.length;
}
};
scope.PointerMap = PointerMap;
})(window.PolymerGestures);
(function(scope) {
var CLONE_PROPS = [
// MouseEvent
'bubbles',
'cancelable',
'view',
'detail',
'screenX',
'screenY',
'clientX',
'clientY',
'ctrlKey',
'altKey',
'shiftKey',
'metaKey',
'button',
'relatedTarget',
// DOM Level 3
'buttons',
// PointerEvent
'pointerId',
'width',
'height',
'pressure',
'tiltX',
'tiltY',
'pointerType',
'hwTimestamp',
'isPrimary',
// event instance
'type',
'target',
'currentTarget',
'which',
'pageX',
'pageY',
'timeStamp',
// gesture addons
'preventTap',
'tapPrevented',
'_source'
];
var CLONE_DEFAULTS = [
// MouseEvent
false,
false,
null,
null,
0,
0,
0,
0,
false,
false,
false,
false,
0,
null,
// DOM Level 3
0,
// PointerEvent
0,
0,
0,
0,
0,
0,
'',
0,
false,
// event instance
'',
null,
null,
0,
0,
0,
0,
function(){},
false
];
var HAS_SVG_INSTANCE = (typeof SVGElementInstance !== 'undefined');
var eventFactory = scope.eventFactory;
// set of recognizers to run for the currently handled event
var currentGestures;
/**
* This module is for normalizing events. Mouse and Touch events will be
* collected here, and fire PointerEvents that have the same semantics, no
* matter the source.
* Events fired:
* - pointerdown: a pointing is added
* - pointerup: a pointer is removed
* - pointermove: a pointer is moved
* - pointerover: a pointer crosses into an element
* - pointerout: a pointer leaves an element
* - pointercancel: a pointer will no longer generate events
*/
var dispatcher = {
IS_IOS: false,
pointermap: new scope.PointerMap(),
requiredGestures: new scope.PointerMap(),
eventMap: Object.create(null),
// Scope objects for native events.
// This exists for ease of testing.
eventSources: Object.create(null),
eventSourceList: [],
gestures: [],
// map gesture event -> {listeners: int, index: gestures[int]}
dependencyMap: {
// make sure down and up are in the map to trigger "register"
down: {listeners: 0, index: -1},
up: {listeners: 0, index: -1}
},
gestureQueue: [],
/**
* Add a new event source that will generate pointer events.
*
* `inSource` must contain an array of event names named `events`, and
* functions with the names specified in the `events` array.
* @param {string} name A name for the event source
* @param {Object} source A new source of platform events.
*/
registerSource: function(name, source) {
var s = source;
var newEvents = s.events;
if (newEvents) {
newEvents.forEach(function(e) {
if (s[e]) {
this.eventMap[e] = s[e].bind(s);
}
}, this);
this.eventSources[name] = s;
this.eventSourceList.push(s);
}
},
registerGesture: function(name, source) {
var obj = Object.create(null);
obj.listeners = 0;
obj.index = this.gestures.length;
for (var i = 0, g; i < source.exposes.length; i++) {
g = source.exposes[i].toLowerCase();
this.dependencyMap[g] = obj;
}
this.gestures.push(source);
},
register: function(element, initial) {
var l = this.eventSourceList.length;
for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {
// call eventsource register
es.register.call(es, element, initial);
}
},
unregister: function(element) {
var l = this.eventSourceList.length;
for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {
// call eventsource register
es.unregister.call(es, element);
}
},
// EVENTS
down: function(inEvent) {
this.requiredGestures.set(inEvent.pointerId, currentGestures);
this.fireEvent('down', inEvent);
},
move: function(inEvent) {
// pipe move events into gesture queue directly
inEvent.type = 'move';
this.fillGestureQueue(inEvent);
},
up: function(inEvent) {
this.fireEvent('up', inEvent);
this.requiredGestures.delete(inEvent.pointerId);
},
cancel: function(inEvent) {
inEvent.tapPrevented = true;
this.fireEvent('up', inEvent);
this.requiredGestures.delete(inEvent.pointerId);
},
addGestureDependency: function(node, currentGestures) {
var gesturesWanted = node._pgEvents;
if (gesturesWanted && currentGestures) {
var gk = Object.keys(gesturesWanted);
for (var i = 0, r, ri, g; i < gk.length; i++) {
// gesture
g = gk[i];
if (gesturesWanted[g] > 0) {
// lookup gesture recognizer
r = this.dependencyMap[g];
// recognizer index
ri = r ? r.index : -1;
currentGestures[ri] = true;
}
}
}
},
// LISTENER LOGIC
eventHandler: function(inEvent) {
// This is used to prevent multiple dispatch of events from
// platform events. This can happen when two elements in different scopes
// are set up to create pointer events, which is relevant to Shadow DOM.
var type = inEvent.type;
// only generate the list of desired events on "down"
if (type === 'touchstart' || type === 'mousedown' || type === 'pointerdown' || type === 'MSPointerDown') {
if (!inEvent._handledByPG) {
currentGestures = {};
}
// in IOS mode, there is only a listener on the document, so this is not re-entrant
if (this.IS_IOS) {
var ev = inEvent;
if (type === 'touchstart') {
var ct = inEvent.changedTouches[0];
// set up a fake event to give to the path builder
ev = {target: inEvent.target, clientX: ct.clientX, clientY: ct.clientY, path: inEvent.path};
}
// use event path if available, otherwise build a path from target finding
var nodes = inEvent.path || scope.targetFinding.path(ev);
for (var i = 0, n; i < nodes.length; i++) {
n = nodes[i];
this.addGestureDependency(n, currentGestures);
}
} else {
this.addGestureDependency(inEvent.currentTarget, currentGestures);
}
}
if (inEvent._handledByPG) {
return;
}
var fn = this.eventMap && this.eventMap[type];
if (fn) {
fn(inEvent);
}
inEvent._handledByPG = true;
},
// set up event listeners
listen: function(target, events) {
for (var i = 0, l = events.length, e; (i < l) && (e = events[i]); i++) {
this.addEvent(target, e);
}
},
// remove event listeners
unlisten: function(target, events) {
for (var i = 0, l = events.length, e; (i < l) && (e = events[i]); i++) {
this.removeEvent(target, e);
}
},
addEvent: function(target, eventName) {
target.addEventListener(eventName, this.boundHandler);
},
removeEvent: function(target, eventName) {
target.removeEventListener(eventName, this.boundHandler);
},
// EVENT CREATION AND TRACKING
/**
* Creates a new Event of type `inType`, based on the information in
* `inEvent`.
*
* @param {string} inType A string representing the type of event to create
* @param {Event} inEvent A platform event with a target
* @return {Event} A PointerEvent of type `inType`
*/
makeEvent: function(inType, inEvent) {
var e = eventFactory.makePointerEvent(inType, inEvent);
e.preventDefault = inEvent.preventDefault;
e.tapPrevented = inEvent.tapPrevented;
e._target = e._target || inEvent.target;
return e;
},
// make and dispatch an event in one call
fireEvent: function(inType, inEvent) {
var e = this.makeEvent(inType, inEvent);
return this.dispatchEvent(e);
},
/**
* Returns a snapshot of inEvent, with writable properties.
*
* @param {Event} inEvent An event that contains properties to copy.
* @return {Object} An object containing shallow copies of `inEvent`'s
* properties.
*/
cloneEvent: function(inEvent) {
var eventCopy = Object.create(null), p;
for (var i = 0; i < CLONE_PROPS.length; i++) {
p = CLONE_PROPS[i];
eventCopy[p] = inEvent[p] || CLONE_DEFAULTS[i];
// Work around SVGInstanceElement shadow tree
// Return the <use> element that is represented by the instance for Safari, Chrome, IE.
// This is the behavior implemented by Firefox.
if (p === 'target' || p === 'relatedTarget') {
if (HAS_SVG_INSTANCE && eventCopy[p] instanceof SVGElementInstance) {
eventCopy[p] = eventCopy[p].correspondingUseElement;
}
}
}
// keep the semantics of preventDefault
eventCopy.preventDefault = function() {
inEvent.preventDefault();
};
return eventCopy;
},
/**
* Dispatches the event to its target.
*
* @param {Event} inEvent The event to be dispatched.
* @return {Boolean} True if an event handler returns true, false otherwise.
*/
dispatchEvent: function(inEvent) {
var t = inEvent._target;
if (t) {
t.dispatchEvent(inEvent);
// clone the event for the gesture system to process
// clone after dispatch to pick up gesture prevention code
var clone = this.cloneEvent(inEvent);
clone.target = t;
this.fillGestureQueue(clone);
}
},
gestureTrigger: function() {
// process the gesture queue
for (var i = 0, e, rg; i < this.gestureQueue.length; i++) {
e = this.gestureQueue[i];
rg = e._requiredGestures;
if (rg) {
for (var j = 0, g, fn; j < this.gestures.length; j++) {
// only run recognizer if an element in the source event's path is listening for those gestures
if (rg[j]) {
g = this.gestures[j];
fn = g[e.type];
if (fn) {
fn.call(g, e);
}
}
}
}
}
this.gestureQueue.length = 0;
},
fillGestureQueue: function(ev) {
// only trigger the gesture queue once
if (!this.gestureQueue.length) {
requestAnimationFrame(this.boundGestureTrigger);
}
ev._requiredGestures = this.requiredGestures.get(ev.pointerId);
this.gestureQueue.push(ev);
}
};
dispatcher.boundHandler = dispatcher.eventHandler.bind(dispatcher);
dispatcher.boundGestureTrigger = dispatcher.gestureTrigger.bind(dispatcher);
scope.dispatcher = dispatcher;
/**
* Listen for `gesture` on `node` with the `handler` function
*
* If `handler` is the first listener for `gesture`, the underlying gesture recognizer is then enabled.
*
* @param {Element} node
* @param {string} gesture
* @return Boolean `gesture` is a valid gesture
*/
scope.activateGesture = function(node, gesture) {
var g = gesture.toLowerCase();
var dep = dispatcher.dependencyMap[g];
if (dep) {
var recognizer = dispatcher.gestures[dep.index];
if (!node._pgListeners) {
dispatcher.register(node);
node._pgListeners = 0;
}
// TODO(dfreedm): re-evaluate bookkeeping to avoid using attributes
if (recognizer) {
var touchAction = recognizer.defaultActions && recognizer.defaultActions[g];
var actionNode;
switch(node.nodeType) {
case Node.ELEMENT_NODE:
actionNode = node;
break;
case Node.DOCUMENT_FRAGMENT_NODE:
actionNode = node.host;
break;
default:
actionNode = null;
break;
}
if (touchAction && actionNode && !actionNode.hasAttribute('touch-action')) {
actionNode.setAttribute('touch-action', touchAction);
}
}
if (!node._pgEvents) {
node._pgEvents = {};
}
node._pgEvents[g] = (node._pgEvents[g] || 0) + 1;
node._pgListeners++;
}
return Boolean(dep);
};
/**
*
* Listen for `gesture` from `node` with `handler` function.
*
* @param {Element} node
* @param {string} gesture
* @param {Function} handler
* @param {Boolean} capture
*/
scope.addEventListener = function(node, gesture, handler, capture) {
if (handler) {
scope.activateGesture(node, gesture);
node.addEventListener(gesture, handler, capture);
}
};
/**
* Tears down the gesture configuration for `node`
*
* If `handler` is the last listener for `gesture`, the underlying gesture recognizer is disabled.
*
* @param {Element} node
* @param {string} gesture
* @return Boolean `gesture` is a valid gesture
*/
scope.deactivateGesture = function(node, gesture) {
var g = gesture.toLowerCase();
var dep = dispatcher.dependencyMap[g];
if (dep) {
if (node._pgListeners > 0) {
node._pgListeners--;
}
if (node._pgListeners === 0) {
dispatcher.unregister(node);
}
if (node._pgEvents) {
if (node._pgEvents[g] > 0) {
node._pgEvents[g]--;
} else {
node._pgEvents[g] = 0;
}
}
}
return Boolean(dep);
};
/**
* Stop listening for `gesture` from `node` with `handler` function.
*
* @param {Element} node
* @param {string} gesture
* @param {Function} handler
* @param {Boolean} capture
*/
scope.removeEventListener = function(node, gesture, handler, capture) {
if (handler) {
scope.deactivateGesture(node, gesture);
node.removeEventListener(gesture, handler, capture);
}
};
})(window.PolymerGestures);
(function(scope) {
var dispatcher = scope.dispatcher;
var pointermap = dispatcher.pointermap;
// radius around touchend that swallows mouse events
var DEDUP_DIST = 25;
var WHICH_TO_BUTTONS = [0, 1, 4, 2];
var currentButtons = 0;
var FIREFOX_LINUX = /Linux.*Firefox\//i;
var HAS_BUTTONS = (function() {
// firefox on linux returns spec-incorrect values for mouseup.buttons
// https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent.buttons#See_also
// https://codereview.chromium.org/727593003/#msg16
if (FIREFOX_LINUX.test(navigator.userAgent)) {
return false;
}
try {
return new MouseEvent('test', {buttons: 1}).buttons === 1;
} catch (e) {
return false;
}
})();
// handler block for native mouse events
var mouseEvents = {
POINTER_ID: 1,
POINTER_TYPE: 'mouse',
events: [
'mousedown',
'mousemove',
'mouseup'
],
exposes: [
'down',
'up',
'move'
],
register: function(target) {
dispatcher.listen(target, this.events);
},
unregister: function(target) {
if (target === document) {
return;
}
dispatcher.unlisten(target, this.events);
},
lastTouches: [],
// collide with the global mouse listener
isEventSimulatedFromTouch: function(inEvent) {
var lts = this.lastTouches;
var x = inEvent.clientX, y = inEvent.clientY;
for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) {
// simulated mouse events will be swallowed near a primary touchend
var dx = Math.abs(x - t.x), dy = Math.abs(y - t.y);
if (dx <= DEDUP_DIST && dy <= DEDUP_DIST) {
return true;
}
}
},
prepareEvent: function(inEvent) {
var e = dispatcher.cloneEvent(inEvent);
e.pointerId = this.POINTER_ID;
e.isPrimary = true;
e.pointerType = this.POINTER_TYPE;
e._source = 'mouse';
if (!HAS_BUTTONS) {
var type = inEvent.type;
var bit = WHICH_TO_BUTTONS[inEvent.which] || 0;
if (type === 'mousedown') {
currentButtons |= bit;
} else if (type === 'mouseup') {
currentButtons &= ~bit;
}
e.buttons = currentButtons;
}
return e;
},
mousedown: function(inEvent) {
if (!this.isEventSimulatedFromTouch(inEvent)) {
var p = pointermap.has(this.POINTER_ID);
var e = this.prepareEvent(inEvent);
e.target = scope.findTarget(inEvent);
pointermap.set(this.POINTER_ID, e.target);
dispatcher.down(e);
}
},
mousemove: function(inEvent) {
if (!this.isEventSimulatedFromTouch(inEvent)) {
var target = pointermap.get(this.POINTER_ID);
if (target) {
var e = this.prepareEvent(inEvent);
e.target = target;
// handle case where we missed a mouseup
if ((HAS_BUTTONS ? e.buttons : e.which) === 0) {
if (!HAS_BUTTONS) {
currentButtons = e.buttons = 0;
}
dispatcher.cancel(e);
this.cleanupMouse(e.buttons);
} else {
dispatcher.move(e);
}
}
}
},
mouseup: function(inEvent) {
if (!this.isEventSimulatedFromTouch(inEvent)) {
var e = this.prepareEvent(inEvent);
e.relatedTarget = scope.findTarget(inEvent);
e.target = pointermap.get(this.POINTER_ID);
dispatcher.up(e);
this.cleanupMouse(e.buttons);
}
},
cleanupMouse: function(buttons) {
if (buttons === 0) {
pointermap.delete(this.POINTER_ID);
}
}
};
scope.mouseEvents = mouseEvents;
})(window.PolymerGestures);
(function(scope) {
var dispatcher = scope.dispatcher;
var allShadows = scope.targetFinding.allShadows.bind(scope.targetFinding);
var pointermap = dispatcher.pointermap;
var touchMap = Array.prototype.map.call.bind(Array.prototype.map);
// This should be long enough to ignore compat mouse events made by touch
var DEDUP_TIMEOUT = 2500;
var DEDUP_DIST = 25;
var CLICK_COUNT_TIMEOUT = 200;
var HYSTERESIS = 20;
var ATTRIB = 'touch-action';
// TODO(dfreedm): disable until http://crbug.com/399765 is resolved
// var HAS_TOUCH_ACTION = ATTRIB in document.head.style;
var HAS_TOUCH_ACTION = false;
// handler block for native touch events
var touchEvents = {
IS_IOS: false,
events: [
'touchstart',
'touchmove',
'touchend',
'touchcancel'
],
exposes: [
'down',
'up',
'move'
],
register: function(target, initial) {
if (this.IS_IOS ? initial : !initial) {
dispatcher.listen(target, this.events);
}
},
unregister: function(target) {
if (!this.IS_IOS) {
dispatcher.unlisten(target, this.events);
}
},
scrollTypes: {
EMITTER: 'none',
XSCROLLER: 'pan-x',
YSCROLLER: 'pan-y',
},
touchActionToScrollType: function(touchAction) {
var t = touchAction;
var st = this.scrollTypes;
if (t === st.EMITTER) {
return 'none';
} else if (t === st.XSCROLLER) {
return 'X';
} else if (t === st.YSCROLLER) {
return 'Y';
} else {
return 'XY';
}
},
POINTER_TYPE: 'touch',
firstTouch: null,
isPrimaryTouch: function(inTouch) {
return this.firstTouch === inTouch.identifier;
},
setPrimaryTouch: function(inTouch) {
// set primary touch if there no pointers, or the only pointer is the mouse
if (pointermap.pointers() === 0 || (pointermap.pointers() === 1 && pointermap.has(1))) {
this.firstTouch = inTouch.identifier;
this.firstXY = {X: inTouch.clientX, Y: inTouch.clientY};
this.firstTarget = inTouch.target;
this.scrolling = null;
this.cancelResetClickCount();
}
},
removePrimaryPointer: function(inPointer) {
if (inPointer.isPrimary) {
this.firstTouch = null;
this.firstXY = null;
this.resetClickCount();
}
},
clickCount: 0,
resetId: null,
resetClickCount: function() {
var fn = function() {
this.clickCount = 0;
this.resetId = null;
}.bind(this);
this.resetId = setTimeout(fn, CLICK_COUNT_TIMEOUT);
},
cancelResetClickCount: function() {
if (this.resetId) {
clearTimeout(this.resetId);
}
},
typeToButtons: function(type) {
var ret = 0;
if (type === 'touchstart' || type === 'touchmove') {
ret = 1;
}
return ret;
},
findTarget: function(touch, id) {
if (this.currentTouchEvent.type === 'touchstart') {
if (this.isPrimaryTouch(touch)) {
var fastPath = {
clientX: touch.clientX,
clientY: touch.clientY,
path: this.currentTouchEvent.path,
target: this.currentTouchEvent.target
};
return scope.findTarget(fastPath);
} else {
return scope.findTarget(touch);
}
}
// reuse target we found in touchstart
return pointermap.get(id);
},
touchToPointer: function(inTouch) {
var cte = this.currentTouchEvent;
var e = dispatcher.cloneEvent(inTouch);
// Spec specifies that pointerId 1 is reserved for Mouse.
// Touch identifiers can start at 0.
// Add 2 to the touch identifier for compatibility.
var id = e.pointerId = inTouch.identifier + 2;
e.target = this.findTarget(inTouch, id);
e.bubbles = true;
e.cancelable = true;
e.detail = this.clickCount;
e.buttons = this.typeToButtons(cte.type);
e.width = inTouch.webkitRadiusX || inTouch.radiusX || 0;
e.height = inTouch.webkitRadiusY || inTouch.radiusY || 0;
e.pressure = inTouch.webkitForce || inTouch.force || 0.5;
e.isPrimary = this.isPrimaryTouch(inTouch);
e.pointerType = this.POINTER_TYPE;
e._source = 'touch';
// forward touch preventDefaults
var self = this;
e.preventDefault = function() {
self.scrolling = false;
self.firstXY = null;
cte.preventDefault();
};
return e;
},
processTouches: function(inEvent, inFunction) {
var tl = inEvent.changedTouches;
this.currentTouchEvent = inEvent;
for (var i = 0, t, p; i < tl.length; i++) {
t = tl[i];
p = this.touchToPointer(t);
if (inEvent.type === 'touchstart') {
pointermap.set(p.pointerId, p.target);
}
if (pointermap.has(p.pointerId)) {
inFunction.call(this, p);
}
if (inEvent.type === 'touchend' || inEvent._cancel) {
this.cleanUpPointer(p);
}
}
},
// For single axis scrollers, determines whether the element should emit
// pointer events or behave as a scroller
shouldScroll: function(inEvent) {
if (this.firstXY) {
var ret;
var touchAction = scope.targetFinding.findTouchAction(inEvent);
var scrollAxis = this.touchActionToScrollType(touchAction);
if (scrollAxis === 'none') {
// this element is a touch-action: none, should never scroll
ret = false;
} else if (scrollAxis === 'XY') {
// this element should always scroll
ret = true;
} else {
var t = inEvent.changedTouches[0];
// check the intended scroll axis, and other axis
var a = scrollAxis;
var oa = scrollAxis === 'Y' ? 'X' : 'Y';
var da = Math.abs(t['client' + a] - this.firstXY[a]);
var doa = Math.abs(t['client' + oa] - this.firstXY[oa]);
// if delta in the scroll axis > delta other axis, scroll instead of
// making events
ret = da >= doa;
}
return ret;
}
},
findTouch: function(inTL, inId) {
for (var i = 0, l = inTL.length, t; i < l && (t = inTL[i]); i++) {
if (t.identifier === inId) {
return true;
}
}
},
// In some instances, a touchstart can happen without a touchend. This
// leaves the pointermap in a broken state.
// Therefore, on every touchstart, we remove the touches that did not fire a
// touchend event.
// To keep state globally consistent, we fire a
// pointercancel for this "abandoned" touch
vacuumTouches: function(inEvent) {
var tl = inEvent.touches;
// pointermap.pointers() should be < tl.length here, as the touchstart has not
// been processed yet.
if (pointermap.pointers() >= tl.length) {
var d = [];
pointermap.forEach(function(value, key) {
// Never remove pointerId == 1, which is mouse.
// Touch identifiers are 2 smaller than their pointerId, which is the
// index in pointermap.
if (key !== 1 && !this.findTouch(tl, key - 2)) {
var p = value;
d.push(p);
}
}, this);
d.forEach(function(p) {
this.cancel(p);
pointermap.delete(p.pointerId);
}, this);
}
},
touchstart: function(inEvent) {
this.vacuumTouches(inEvent);
this.setPrimaryTouch(inEvent.changedTouches[0]);
this.dedupSynthMouse(inEvent);
if (!this.scrolling) {
this.clickCount++;
this.processTouches(inEvent, this.down);
}
},
down: function(inPointer) {
dispatcher.down(inPointer);
},
touchmove: function(inEvent) {
if (HAS_TOUCH_ACTION) {
// touchevent.cancelable == false is sent when the page is scrolling under native Touch Action in Chrome 36
// https://groups.google.com/a/chromium.org/d/msg/input-dev/wHnyukcYBcA/b9kmtwM1jJQJ
if (inEvent.cancelable) {
this.processTouches(inEvent, this.move);
}
} else {
if (!this.scrolling) {
if (this.scrolling === null && this.shouldScroll(inEvent)) {
this.scrolling = true;
} else {
this.scrolling = false;
inEvent.preventDefault();
this.processTouches(inEvent, this.move);
}
} else if (this.firstXY) {
var t = inEvent.changedTouches[0];
var dx = t.clientX - this.firstXY.X;
var dy = t.clientY - this.firstXY.Y;
var dd = Math.sqrt(dx * dx + dy * dy);
if (dd >= HYSTERESIS) {
this.touchcancel(inEvent);
this.scrolling = true;
this.firstXY = null;
}
}
}
},
move: function(inPointer) {
dispatcher.move(inPointer);
},
touchend: function(inEvent) {
this.dedupSynthMouse(inEvent);
this.processTouches(inEvent, this.up);
},
up: function(inPointer) {
inPointer.relatedTarget = scope.findTarget(inPointer);
dispatcher.up(inPointer);
},
cancel: function(inPointer) {
dispatcher.cancel(inPointer);
},
touchcancel: function(inEvent) {
inEvent._cancel = true;
this.processTouches(inEvent, this.cancel);
},
cleanUpPointer: function(inPointer) {
pointermap['delete'](inPointer.pointerId);
this.removePrimaryPointer(inPointer);
},
// prevent synth mouse events from creating pointer events
dedupSynthMouse: function(inEvent) {
var lts = scope.mouseEvents.lastTouches;
var t = inEvent.changedTouches[0];
// only the primary finger will synth mouse events
if (this.isPrimaryTouch(t)) {
// remember x/y of last touch
var lt = {x: t.clientX, y: t.clientY};
lts.push(lt);
var fn = (function(lts, lt){
var i = lts.indexOf(lt);
if (i > -1) {
lts.splice(i, 1);
}
}).bind(null, lts, lt);
setTimeout(fn, DEDUP_TIMEOUT);
}
}
};
// prevent "ghost clicks" that come from elements that were removed in a touch handler
var STOP_PROP_FN = Event.prototype.stopImmediatePropagation || Event.prototype.stopPropagation;
document.addEventListener('click', function(ev) {
var x = ev.clientX, y = ev.clientY;
// check if a click is within DEDUP_DIST px radius of the touchstart
var closeTo = function(touch) {
var dx = Math.abs(x - touch.x), dy = Math.abs(y - touch.y);
return (dx <= DEDUP_DIST && dy <= DEDUP_DIST);
};
// if click coordinates are close to touch coordinates, assume the click came from a touch
var wasTouched = scope.mouseEvents.lastTouches.some(closeTo);
// if the click came from touch, and the touchstart target is not in the path of the click event,
// then the touchstart target was probably removed, and the click should be "busted"
var path = scope.targetFinding.path(ev);
if (wasTouched) {
for (var i = 0; i < path.length; i++) {
if (path[i] === touchEvents.firstTarget) {
return;
}
}
ev.preventDefault();
STOP_PROP_FN.call(ev);
}
}, true);
scope.touchEvents = touchEvents;
})(window.PolymerGestures);
(function(scope) {
var dispatcher = scope.dispatcher;
var pointermap = dispatcher.pointermap;
var HAS_BITMAP_TYPE = window.MSPointerEvent && typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE === 'number';
var msEvents = {
events: [
'MSPointerDown',
'MSPointerMove',
'MSPointerUp',
'MSPointerCancel',
],
register: function(target) {
dispatcher.listen(target, this.events);
},
unregister: function(target) {
if (target === document) {
return;
}
dispatcher.unlisten(target, this.events);
},
POINTER_TYPES: [
'',
'unavailable',
'touch',
'pen',
'mouse'
],
prepareEvent: function(inEvent) {
var e = inEvent;
e = dispatcher.cloneEvent(inEvent);
if (HAS_BITMAP_TYPE) {
e.pointerType = this.POINTER_TYPES[inEvent.pointerType];
}
e._source = 'ms';
return e;
},
cleanup: function(id) {
pointermap['delete'](id);
},
MSPointerDown: function(inEvent) {
var e = this.prepareEvent(inEvent);
e.target = scope.findTarget(inEvent);
pointermap.set(inEvent.pointerId, e.target);
dispatcher.down(e);
},
MSPointerMove: function(inEvent) {
var target = pointermap.get(inEvent.pointerId);
if (target) {
var e = this.prepareEvent(inEvent);
e.target = target;
dispatcher.move(e);
}
},
MSPointerUp: function(inEvent) {
var e = this.prepareEvent(inEvent);
e.relatedTarget = scope.findTarget(inEvent);
e.target = pointermap.get(e.pointerId);
dispatcher.up(e);
this.cleanup(inEvent.pointerId);
},
MSPointerCancel: function(inEvent) {
var e = this.prepareEvent(inEvent);
e.relatedTarget = scope.findTarget(inEvent);
e.target = pointermap.get(e.pointerId);
dispatcher.cancel(e);
this.cleanup(inEvent.pointerId);
}
};
scope.msEvents = msEvents;
})(window.PolymerGestures);
(function(scope) {
var dispatcher = scope.dispatcher;
var pointermap = dispatcher.pointermap;
var pointerEvents = {
events: [
'pointerdown',
'pointermove',
'pointerup',
'pointercancel'
],
prepareEvent: function(inEvent) {
var e = dispatcher.cloneEvent(inEvent);
e._source = 'pointer';
return e;
},
register: function(target) {
dispatcher.listen(target, this.events);
},
unregister: function(target) {
if (target === document) {
return;
}
dispatcher.unlisten(target, this.events);
},
cleanup: function(id) {
pointermap['delete'](id);
},
pointerdown: function(inEvent) {
var e = this.prepareEvent(inEvent);
e.target = scope.findTarget(inEvent);
pointermap.set(e.pointerId, e.target);
dispatcher.down(e);
},
pointermove: function(inEvent) {
var target = pointermap.get(inEvent.pointerId);
if (target) {
var e = this.prepareEvent(inEvent);
e.target = target;
dispatcher.move(e);
}
},
pointerup: function(inEvent) {
var e = this.prepareEvent(inEvent);
e.relatedTarget = scope.findTarget(inEvent);
e.target = pointermap.get(e.pointerId);
dispatcher.up(e);
this.cleanup(inEvent.pointerId);
},
pointercancel: function(inEvent) {
var e = this.prepareEvent(inEvent);
e.relatedTarget = scope.findTarget(inEvent);
e.target = pointermap.get(e.pointerId);
dispatcher.cancel(e);
this.cleanup(inEvent.pointerId);
}
};
scope.pointerEvents = pointerEvents;
})(window.PolymerGestures);
/**
* This module contains the handlers for native platform events.
* From here, the dispatcher is called to create unified pointer events.
* Included are touch events (v1), mouse events, and MSPointerEvents.
*/
(function(scope) {
var dispatcher = scope.dispatcher;
var nav = window.navigator;
if (window.PointerEvent) {
dispatcher.registerSource('pointer', scope.pointerEvents);
} else if (nav.msPointerEnabled) {
dispatcher.registerSource('ms', scope.msEvents);
} else {
dispatcher.registerSource('mouse', scope.mouseEvents);
if (window.ontouchstart !== undefined) {
dispatcher.registerSource('touch', scope.touchEvents);
}
}
// Work around iOS bugs https://bugs.webkit.org/show_bug.cgi?id=135628 and https://bugs.webkit.org/show_bug.cgi?id=136506
var ua = navigator.userAgent;
var IS_IOS = ua.match(/iPad|iPhone|iPod/) && 'ontouchstart' in window;
dispatcher.IS_IOS = IS_IOS;
scope.touchEvents.IS_IOS = IS_IOS;
dispatcher.register(document, true);
})(window.PolymerGestures);
/**
* This event denotes the beginning of a series of tracking events.
*
* @module PointerGestures
* @submodule Events
* @class trackstart
*/
/**
* Pixels moved in the x direction since trackstart.
* @type Number
* @property dx
*/
/**
* Pixes moved in the y direction since trackstart.
* @type Number
* @property dy
*/
/**
* Pixels moved in the x direction since the last track.
* @type Number
* @property ddx
*/
/**
* Pixles moved in the y direction since the last track.
* @type Number
* @property ddy
*/
/**
* The clientX position of the track gesture.
* @type Number
* @property clientX
*/
/**
* The clientY position of the track gesture.
* @type Number
* @property clientY
*/
/**
* The pageX position of the track gesture.
* @type Number
* @property pageX
*/
/**
* The pageY position of the track gesture.
* @type Number
* @property pageY
*/
/**
* The screenX position of the track gesture.
* @type Number
* @property screenX
*/
/**
* The screenY position of the track gesture.
* @type Number
* @property screenY
*/
/**
* The last x axis direction of the pointer.
* @type Number
* @property xDirection
*/
/**
* The last y axis direction of the pointer.
* @type Number
* @property yDirection
*/
/**
* A shared object between all tracking events.
* @type Object
* @property trackInfo
*/
/**
* The element currently under the pointer.
* @type Element
* @property relatedTarget
*/
/**
* The type of pointer that make the track gesture.
* @type String
* @property pointerType
*/
/**
*
* This event fires for all pointer movement being tracked.
*
* @class track
* @extends trackstart
*/
/**
* This event fires when the pointer is no longer being tracked.
*
* @class trackend
* @extends trackstart
*/
(function(scope) {
var dispatcher = scope.dispatcher;
var eventFactory = scope.eventFactory;
var pointermap = new scope.PointerMap();
var track = {
events: [
'down',
'move',
'up',
],
exposes: [
'trackstart',
'track',
'trackx',
'tracky',
'trackend'
],
defaultActions: {
'track': 'none',
'trackx': 'pan-y',
'tracky': 'pan-x'
},
WIGGLE_THRESHOLD: 4,
clampDir: function(inDelta) {
return inDelta > 0 ? 1 : -1;
},
calcPositionDelta: function(inA, inB) {
var x = 0, y = 0;
if (inA && inB) {
x = inB.pageX - inA.pageX;
y = inB.pageY - inA.pageY;
}
return {x: x, y: y};
},
fireTrack: function(inType, inEvent, inTrackingData) {
var t = inTrackingData;
var d = this.calcPositionDelta(t.downEvent, inEvent);
var dd = this.calcPositionDelta(t.lastMoveEvent, inEvent);
if (dd.x) {
t.xDirection = this.clampDir(dd.x);
} else if (inType === 'trackx') {
return;
}
if (dd.y) {
t.yDirection = this.clampDir(dd.y);
} else if (inType === 'tracky') {
return;
}
var gestureProto = {
bubbles: true,
cancelable: true,
trackInfo: t.trackInfo,
relatedTarget: inEvent.relatedTarget,
pointerType: inEvent.pointerType,
pointerId: inEvent.pointerId,
_source: 'track'
};
if (inType !== 'tracky') {
gestureProto.x = inEvent.x;
gestureProto.dx = d.x;
gestureProto.ddx = dd.x;
gestureProto.clientX = inEvent.clientX;
gestureProto.pageX = inEvent.pageX;
gestureProto.screenX = inEvent.screenX;
gestureProto.xDirection = t.xDirection;
}
if (inType !== 'trackx') {
gestureProto.dy = d.y;
gestureProto.ddy = dd.y;
gestureProto.y = inEvent.y;
gestureProto.clientY = inEvent.clientY;
gestureProto.pageY = inEvent.pageY;
gestureProto.screenY = inEvent.screenY;
gestureProto.yDirection = t.yDirection;
}
var e = eventFactory.makeGestureEvent(inType, gestureProto);
t.downTarget.dispatchEvent(e);
},
down: function(inEvent) {
if (inEvent.isPrimary && (inEvent.pointerType === 'mouse' ? inEvent.buttons === 1 : true)) {
var p = {
downEvent: inEvent,
downTarget: inEvent.target,
trackInfo: {},
lastMoveEvent: null,
xDirection: 0,
yDirection: 0,
tracking: false
};
pointermap.set(inEvent.pointerId, p);
}
},
move: function(inEvent) {
var p = pointermap.get(inEvent.pointerId);
if (p) {
if (!p.tracking) {
var d = this.calcPositionDelta(p.downEvent, inEvent);
var move = d.x * d.x + d.y * d.y;
// start tracking only if finger moves more than WIGGLE_THRESHOLD
if (move > this.WIGGLE_THRESHOLD) {
p.tracking = true;
p.lastMoveEvent = p.downEvent;
this.fireTrack('trackstart', inEvent, p);
}
}
if (p.tracking) {
this.fireTrack('track', inEvent, p);
this.fireTrack('trackx', inEvent, p);
this.fireTrack('tracky', inEvent, p);
}
p.lastMoveEvent = inEvent;
}
},
up: function(inEvent) {
var p = pointermap.get(inEvent.pointerId);
if (p) {
if (p.tracking) {
this.fireTrack('trackend', inEvent, p);
}
pointermap.delete(inEvent.pointerId);
}
}
};
dispatcher.registerGesture('track', track);
})(window.PolymerGestures);
/**
* This event is fired when a pointer is held down for 200ms.
*
* @module PointerGestures
* @submodule Events
* @class hold
*/
/**
* Type of pointer that made the holding event.
* @type String
* @property pointerType
*/
/**
* Screen X axis position of the held pointer
* @type Number
* @property clientX
*/
/**
* Screen Y axis position of the held pointer
* @type Number
* @property clientY
*/
/**
* Type of pointer that made the holding event.
* @type String
* @property pointerType
*/
/**
* This event is fired every 200ms while a pointer is held down.
*
* @class holdpulse
* @extends hold
*/
/**
* Milliseconds pointer has been held down.
* @type Number
* @property holdTime
*/
/**
* This event is fired when a held pointer is released or moved.
*
* @class release
*/
(function(scope) {
var dispatcher = scope.dispatcher;
var eventFactory = scope.eventFactory;
var hold = {
// wait at least HOLD_DELAY ms between hold and pulse events
HOLD_DELAY: 200,
// pointer can move WIGGLE_THRESHOLD pixels before not counting as a hold
WIGGLE_THRESHOLD: 16,
events: [
'down',
'move',
'up',
],
exposes: [
'hold',
'holdpulse',
'release'
],
heldPointer: null,
holdJob: null,
pulse: function() {
var hold = Date.now() - this.heldPointer.timeStamp;
var type = this.held ? 'holdpulse' : 'hold';
this.fireHold(type, hold);
this.held = true;
},
cancel: function() {
clearInterval(this.holdJob);
if (this.held) {
this.fireHold('release');
}
this.held = false;
this.heldPointer = null;
this.target = null;
this.holdJob = null;
},
down: function(inEvent) {
if (inEvent.isPrimary && !this.heldPointer) {
this.heldPointer = inEvent;
this.target = inEvent.target;
this.holdJob = setInterval(this.pulse.bind(this), this.HOLD_DELAY);
}
},
up: function(inEvent) {
if (this.heldPointer && this.heldPointer.pointerId === inEvent.pointerId) {
this.cancel();
}
},
move: function(inEvent) {
if (this.heldPointer && this.heldPointer.pointerId === inEvent.pointerId) {
var x = inEvent.clientX - this.heldPointer.clientX;
var y = inEvent.clientY - this.heldPointer.clientY;
if ((x * x + y * y) > this.WIGGLE_THRESHOLD) {
this.cancel();
}
}
},
fireHold: function(inType, inHoldTime) {
var p = {
bubbles: true,
cancelable: true,
pointerType: this.heldPointer.pointerType,
pointerId: this.heldPointer.pointerId,
x: this.heldPointer.clientX,
y: this.heldPointer.clientY,
_source: 'hold'
};
if (inHoldTime) {
p.holdTime = inHoldTime;
}
var e = eventFactory.makeGestureEvent(inType, p);
this.target.dispatchEvent(e);
}
};
dispatcher.registerGesture('hold', hold);
})(window.PolymerGestures);
/**
* This event is fired when a pointer quickly goes down and up, and is used to
* denote activation.
*
* Any gesture event can prevent the tap event from being created by calling
* `event.preventTap`.
*
* Any pointer event can prevent the tap by setting the `tapPrevented` property
* on itself.
*
* @module PointerGestures
* @submodule Events
* @class tap
*/
/**
* X axis position of the tap.
* @property x
* @type Number
*/
/**
* Y axis position of the tap.
* @property y
* @type Number
*/
/**
* Type of the pointer that made the tap.
* @property pointerType
* @type String
*/
(function(scope) {
var dispatcher = scope.dispatcher;
var eventFactory = scope.eventFactory;
var pointermap = new scope.PointerMap();
var tap = {
events: [
'down',
'up'
],
exposes: [
'tap'
],
down: function(inEvent) {
if (inEvent.isPrimary && !inEvent.tapPrevented) {
pointermap.set(inEvent.pointerId, {
target: inEvent.target,
buttons: inEvent.buttons,
x: inEvent.clientX,
y: inEvent.clientY
});
}
},
shouldTap: function(e, downState) {
var tap = true;
if (e.pointerType === 'mouse') {
// only allow left click to tap for mouse
tap = (e.buttons ^ 1) && (downState.buttons & 1);
}
return tap && !e.tapPrevented;
},
up: function(inEvent) {
var start = pointermap.get(inEvent.pointerId);
if (start && this.shouldTap(inEvent, start)) {
// up.relatedTarget is target currently under finger
var t = scope.targetFinding.LCA(start.target, inEvent.relatedTarget);
if (t) {
var e = eventFactory.makeGestureEvent('tap', {
bubbles: true,
cancelable: true,
x: inEvent.clientX,
y: inEvent.clientY,
detail: inEvent.detail,
pointerType: inEvent.pointerType,
pointerId: inEvent.pointerId,
altKey: inEvent.altKey,
ctrlKey: inEvent.ctrlKey,
metaKey: inEvent.metaKey,
shiftKey: inEvent.shiftKey,
_source: 'tap'
});
t.dispatchEvent(e);
}
}
pointermap.delete(inEvent.pointerId);
}
};
// patch eventFactory to remove id from tap's pointermap for preventTap calls
eventFactory.preventTap = function(e) {
return function() {
e.tapPrevented = true;
pointermap.delete(e.pointerId);
};
};
dispatcher.registerGesture('tap', tap);
})(window.PolymerGestures);
/*
* Basic strategy: find the farthest apart points, use as diameter of circle
* react to size change and rotation of the chord
*/
/**
* @module pointer-gestures
* @submodule Events
* @class pinch
*/
/**
* Scale of the pinch zoom gesture
* @property scale
* @type Number
*/
/**
* Center X position of pointers causing pinch
* @property centerX
* @type Number
*/
/**
* Center Y position of pointers causing pinch
* @property centerY
* @type Number
*/
/**
* @module pointer-gestures
* @submodule Events
* @class rotate
*/
/**
* Angle (in degrees) of rotation. Measured from starting positions of pointers.
* @property angle
* @type Number
*/
/**
* Center X position of pointers causing rotation
* @property centerX
* @type Number
*/
/**
* Center Y position of pointers causing rotation
* @property centerY
* @type Number
*/
(function(scope) {
var dispatcher = scope.dispatcher;
var eventFactory = scope.eventFactory;
var pointermap = new scope.PointerMap();
var RAD_TO_DEG = 180 / Math.PI;
var pinch = {
events: [
'down',
'up',
'move',
'cancel'
],
exposes: [
'pinchstart',
'pinch',
'pinchend',
'rotate'
],
defaultActions: {
'pinch': 'none',
'rotate': 'none'
},
reference: {},
down: function(inEvent) {
pointermap.set(inEvent.pointerId, inEvent);
if (pointermap.pointers() == 2) {
var points = this.calcChord();
var angle = this.calcAngle(points);
this.reference = {
angle: angle,
diameter: points.diameter,
target: scope.targetFinding.LCA(points.a.target, points.b.target)
};
this.firePinch('pinchstart', points.diameter, points);
}
},
up: function(inEvent) {
var p = pointermap.get(inEvent.pointerId);
var num = pointermap.pointers();
if (p) {
if (num === 2) {
// fire 'pinchend' before deleting pointer
var points = this.calcChord();
this.firePinch('pinchend', points.diameter, points);
}
pointermap.delete(inEvent.pointerId);
}
},
move: function(inEvent) {
if (pointermap.has(inEvent.pointerId)) {
pointermap.set(inEvent.pointerId, inEvent);
if (pointermap.pointers() > 1) {
this.calcPinchRotate();
}
}
},
cancel: function(inEvent) {
this.up(inEvent);
},
firePinch: function(type, diameter, points) {
var zoom = diameter / this.reference.diameter;
var e = eventFactory.makeGestureEvent(type, {
bubbles: true,
cancelable: true,
scale: zoom,
centerX: points.center.x,
centerY: points.center.y,
_source: 'pinch'
});
this.reference.target.dispatchEvent(e);
},
fireRotate: function(angle, points) {
var diff = Math.round((angle - this.reference.angle) % 360);
var e = eventFactory.makeGestureEvent('rotate', {
bubbles: true,
cancelable: true,
angle: diff,
centerX: points.center.x,
centerY: points.center.y,
_source: 'pinch'
});
this.reference.target.dispatchEvent(e);
},
calcPinchRotate: function() {
var points = this.calcChord();
var diameter = points.diameter;
var angle = this.calcAngle(points);
if (diameter != this.reference.diameter) {
this.firePinch('pinch', diameter, points);
}
if (angle != this.reference.angle) {
this.fireRotate(angle, points);
}
},
calcChord: function() {
var pointers = [];
pointermap.forEach(function(p) {
pointers.push(p);
});
var dist = 0;
// start with at least two pointers
var points = {a: pointers[0], b: pointers[1]};
var x, y, d;
for (var i = 0; i < pointers.length; i++) {
var a = pointers[i];
for (var j = i + 1; j < pointers.length; j++) {
var b = pointers[j];
x = Math.abs(a.clientX - b.clientX);
y = Math.abs(a.clientY - b.clientY);
d = x + y;
if (d > dist) {
dist = d;
points = {a: a, b: b};
}
}
}
x = Math.abs(points.a.clientX + points.b.clientX) / 2;
y = Math.abs(points.a.clientY + points.b.clientY) / 2;
points.center = { x: x, y: y };
points.diameter = dist;
return points;
},
calcAngle: function(points) {
var x = points.a.clientX - points.b.clientX;
var y = points.a.clientY - points.b.clientY;
return (360 + Math.atan2(y, x) * RAD_TO_DEG) % 360;
}
};
dispatcher.registerGesture('pinch', pinch);
})(window.PolymerGestures);
(function (global) {
'use strict';
var Token,
TokenName,
Syntax,
Messages,
source,
index,
length,
delegate,
lookahead,
state;
Token = {
BooleanLiteral: 1,
EOF: 2,
Identifier: 3,
Keyword: 4,
NullLiteral: 5,
NumericLiteral: 6,
Punctuator: 7,
StringLiteral: 8
};
TokenName = {};
TokenName[Token.BooleanLiteral] = 'Boolean';
TokenName[Token.EOF] = '<end>';
TokenName[Token.Identifier] = 'Identifier';
TokenName[Token.Keyword] = 'Keyword';
TokenName[Token.NullLiteral] = 'Null';
TokenName[Token.NumericLiteral] = 'Numeric';
TokenName[Token.Punctuator] = 'Punctuator';
TokenName[Token.StringLiteral] = 'String';
Syntax = {
ArrayExpression: 'ArrayExpression',
BinaryExpression: 'BinaryExpression',
CallExpression: 'CallExpression',
ConditionalExpression: 'ConditionalExpression',
EmptyStatement: 'EmptyStatement',
ExpressionStatement: 'ExpressionStatement',
Identifier: 'Identifier',
Literal: 'Literal',
LabeledStatement: 'LabeledStatement',
LogicalExpression: 'LogicalExpression',
MemberExpression: 'MemberExpression',
ObjectExpression: 'ObjectExpression',
Program: 'Program',
Property: 'Property',
ThisExpression: 'ThisExpression',
UnaryExpression: 'UnaryExpression'
};
// Error messages should be identical to V8.
Messages = {
UnexpectedToken: 'Unexpected token %0',
UnknownLabel: 'Undefined label \'%0\'',
Redeclaration: '%0 \'%1\' has already been declared'
};
// Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.
function assert(condition, message) {
if (!condition) {
throw new Error('ASSERT: ' + message);
}
}
function isDecimalDigit(ch) {
return (ch >= 48 && ch <= 57); // 0..9
}
// 7.2 White Space
function isWhiteSpace(ch) {
return (ch === 32) || // space
(ch === 9) || // tab
(ch === 0xB) ||
(ch === 0xC) ||
(ch === 0xA0) ||
(ch >= 0x1680 && '\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\uFEFF'.indexOf(String.fromCharCode(ch)) > 0);
}
// 7.3 Line Terminators
function isLineTerminator(ch) {
return (ch === 10) || (ch === 13) || (ch === 0x2028) || (ch === 0x2029);
}
// 7.6 Identifier Names and Identifiers
function isIdentifierStart(ch) {
return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
(ch >= 65 && ch <= 90) || // A..Z
(ch >= 97 && ch <= 122); // a..z
}
function isIdentifierPart(ch) {
return (ch === 36) || (ch === 95) || // $ (dollar) and _ (underscore)
(ch >= 65 && ch <= 90) || // A..Z
(ch >= 97 && ch <= 122) || // a..z
(ch >= 48 && ch <= 57); // 0..9
}
// 7.6.1.1 Keywords
function isKeyword(id) {
return (id === 'this')
}
// 7.4 Comments
function skipWhitespace() {
while (index < length && isWhiteSpace(source.charCodeAt(index))) {
++index;
}
}
function getIdentifier() {
var start, ch;
start = index++;
while (index < length) {
ch = source.charCodeAt(index);
if (isIdentifierPart(ch)) {
++index;
} else {
break;
}
}
return source.slice(start, index);
}
function scanIdentifier() {
var start, id, type;
start = index;
id = getIdentifier();
// There is no keyword or literal with only one character.
// Thus, it must be an identifier.
if (id.length === 1) {
type = Token.Identifier;
} else if (isKeyword(id)) {
type = Token.Keyword;
} else if (id === 'null') {
type = Token.NullLiteral;
} else if (id === 'true' || id === 'false') {
type = Token.BooleanLiteral;
} else {
type = Token.Identifier;
}
return {
type: type,
value: id,
range: [start, index]
};
}
// 7.7 Punctuators
function scanPunctuator() {
var start = index,
code = source.charCodeAt(index),
code2,
ch1 = source[index],
ch2;
switch (code) {
// Check for most common single-character punctuators.
case 46: // . dot
case 40: // ( open bracket
case 41: // ) close bracket
case 59: // ; semicolon
case 44: // , comma
case 123: // { open curly brace
case 125: // } close curly brace
case 91: // [
case 93: // ]
case 58: // :
case 63: // ?
++index;
return {
type: Token.Punctuator,
value: String.fromCharCode(code),
range: [start, index]
};
default:
code2 = source.charCodeAt(index + 1);
// '=' (char #61) marks an assignment or comparison operator.
if (code2 === 61) {
switch (code) {
case 37: // %
case 38: // &
case 42: // *:
case 43: // +
case 45: // -
case 47: // /
case 60: // <
case 62: // >
case 124: // |
index += 2;
return {
type: Token.Punctuator,
value: String.fromCharCode(code) + String.fromCharCode(code2),
range: [start, index]
};
case 33: // !
case 61: // =
index += 2;
// !== and ===
if (source.charCodeAt(index) === 61) {
++index;
}
return {
type: Token.Punctuator,
value: source.slice(start, index),
range: [start, index]
};
default:
break;
}
}
break;
}
// Peek more characters.
ch2 = source[index + 1];
// Other 2-character punctuators: && ||
if (ch1 === ch2 && ('&|'.indexOf(ch1) >= 0)) {
index += 2;
return {
type: Token.Punctuator,
value: ch1 + ch2,
range: [start, index]
};
}
if ('<>=!+-*%&|^/'.indexOf(ch1) >= 0) {
++index;
return {
type: Token.Punctuator,
value: ch1,
range: [start, index]
};
}
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
// 7.8.3 Numeric Literals
function scanNumericLiteral() {
var number, start, ch;
ch = source[index];
assert(isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'),
'Numeric literal must start with a decimal digit or a decimal point');
start = index;
number = '';
if (ch !== '.') {
number = source[index++];
ch = source[index];
// Hex number starts with '0x'.
// Octal number starts with '0'.
if (number === '0') {
// decimal number starts with '0' such as '09' is illegal.
if (ch && isDecimalDigit(ch.charCodeAt(0))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
while (isDecimalDigit(source.charCodeAt(index))) {
number += source[index++];
}
ch = source[index];
}
if (ch === '.') {
number += source[index++];
while (isDecimalDigit(source.charCodeAt(index))) {
number += source[index++];
}
ch = source[index];
}
if (ch === 'e' || ch === 'E') {
number += source[index++];
ch = source[index];
if (ch === '+' || ch === '-') {
number += source[index++];
}
if (isDecimalDigit(source.charCodeAt(index))) {
while (isDecimalDigit(source.charCodeAt(index))) {
number += source[index++];
}
} else {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
}
if (isIdentifierStart(source.charCodeAt(index))) {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.NumericLiteral,
value: parseFloat(number),
range: [start, index]
};
}
// 7.8.4 String Literals
function scanStringLiteral() {
var str = '', quote, start, ch, octal = false;
quote = source[index];
assert((quote === '\'' || quote === '"'),
'String literal must starts with a quote');
start = index;
++index;
while (index < length) {
ch = source[index++];
if (ch === quote) {
quote = '';
break;
} else if (ch === '\\') {
ch = source[index++];
if (!ch || !isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
str += '\n';
break;
case 'r':
str += '\r';
break;
case 't':
str += '\t';
break;
case 'b':
str += '\b';
break;
case 'f':
str += '\f';
break;
case 'v':
str += '\x0B';
break;
default:
str += ch;
break;
}
} else {
if (ch === '\r' && source[index] === '\n') {
++index;
}
}
} else if (isLineTerminator(ch.charCodeAt(0))) {
break;
} else {
str += ch;
}
}
if (quote !== '') {
throwError({}, Messages.UnexpectedToken, 'ILLEGAL');
}
return {
type: Token.StringLiteral,
value: str,
octal: octal,
range: [start, index]
};
}
function isIdentifierName(token) {
return token.type === Token.Identifier ||
token.type === Token.Keyword ||
token.type === Token.BooleanLiteral ||
token.type === Token.NullLiteral;
}
function advance() {
var ch;
skipWhitespace();
if (index >= length) {
return {
type: Token.EOF,
range: [index, index]
};
}
ch = source.charCodeAt(index);
// Very common: ( and ) and ;
if (ch === 40 || ch === 41 || ch === 58) {
return scanPunctuator();
}
// String literal starts with single quote (#39) or double quote (#34).
if (ch === 39 || ch === 34) {
return scanStringLiteral();
}
if (isIdentifierStart(ch)) {
return scanIdentifier();
}
// Dot (.) char #46 can also start a floating-point number, hence the need
// to check the next character.
if (ch === 46) {
if (isDecimalDigit(source.charCodeAt(index + 1))) {
return scanNumericLiteral();
}
return scanPunctuator();
}
if (isDecimalDigit(ch)) {
return scanNumericLiteral();
}
return scanPunctuator();
}
function lex() {
var token;
token = lookahead;
index = token.range[1];
lookahead = advance();
index = token.range[1];
return token;
}
function peek() {
var pos;
pos = index;
lookahead = advance();
index = pos;
}
// Throw an exception
function throwError(token, messageFormat) {
var error,
args = Array.prototype.slice.call(arguments, 2),
msg = messageFormat.replace(
/%(\d)/g,
function (whole, index) {
assert(index < args.length, 'Message reference must be in range');
return args[index];
}
);
error = new Error(msg);
error.index = index;
error.description = msg;
throw error;
}
// Throw an exception because of the token.
function throwUnexpected(token) {
throwError(token, Messages.UnexpectedToken, token.value);
}
// Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.
function expect(value) {
var token = lex();
if (token.type !== Token.Punctuator || token.value !== value) {
throwUnexpected(token);
}
}
// Return true if the next token matches the specified punctuator.
function match(value) {
return lookahead.type === Token.Punctuator && lookahead.value === value;
}
// Return true if the next token matches the specified keyword
function matchKeyword(keyword) {
return lookahead.type === Token.Keyword && lookahead.value === keyword;
}
function consumeSemicolon() {
// Catch the very common case first: immediately a semicolon (char #59).
if (source.charCodeAt(index) === 59) {
lex();
return;
}
skipWhitespace();
if (match(';')) {
lex();
return;
}
if (lookahead.type !== Token.EOF && !match('}')) {
throwUnexpected(lookahead);
}
}
// 11.1.4 Array Initialiser
function parseArrayInitialiser() {
var elements = [];
expect('[');
while (!match(']')) {
if (match(',')) {
lex();
elements.push(null);
} else {
elements.push(parseExpression());
if (!match(']')) {
expect(',');
}
}
}
expect(']');
return delegate.createArrayExpression(elements);
}
// 11.1.5 Object Initialiser
function parseObjectPropertyKey() {
var token;
skipWhitespace();
token = lex();
// Note: This function is called only from parseObjectProperty(), where
// EOF and Punctuator tokens are already filtered out.
if (token.type === Token.StringLiteral || token.type === Token.NumericLiteral) {
return delegate.createLiteral(token);
}
return delegate.createIdentifier(token.value);
}
function parseObjectProperty() {
var token, key;
token = lookahead;
skipWhitespace();
if (token.type === Token.EOF || token.type === Token.Punctuator) {
throwUnexpected(token);
}
key = parseObjectPropertyKey();
expect(':');
return delegate.createProperty('init', key, parseExpression());
}
function parseObjectInitialiser() {
var properties = [];
expect('{');
while (!match('}')) {
properties.push(parseObjectProperty());
if (!match('}')) {
expect(',');
}
}
expect('}');
return delegate.createObjectExpression(properties);
}
// 11.1.6 The Grouping Operator
function parseGroupExpression() {
var expr;
expect('(');
expr = parseExpression();
expect(')');
return expr;
}
// 11.1 Primary Expressions
function parsePrimaryExpression() {
var type, token, expr;
if (match('(')) {
return parseGroupExpression();
}
type = lookahead.type;
if (type === Token.Identifier) {
expr = delegate.createIdentifier(lex().value);
} else if (type === Token.StringLiteral || type === Token.NumericLiteral) {
expr = delegate.createLiteral(lex());
} else if (type === Token.Keyword) {
if (matchKeyword('this')) {
lex();
expr = delegate.createThisExpression();
}
} else if (type === Token.BooleanLiteral) {
token = lex();
token.value = (token.value === 'true');
expr = delegate.createLiteral(token);
} else if (type === Token.NullLiteral) {
token = lex();
token.value = null;
expr = delegate.createLiteral(token);
} else if (match('[')) {
expr = parseArrayInitialiser();
} else if (match('{')) {
expr = parseObjectInitialiser();
}
if (expr) {
return expr;
}
throwUnexpected(lex());
}
// 11.2 Left-Hand-Side Expressions
function parseArguments() {
var args = [];
expect('(');
if (!match(')')) {
while (index < length) {
args.push(parseExpression());
if (match(')')) {
break;
}
expect(',');
}
}
expect(')');
return args;
}
function parseNonComputedProperty() {
var token;
token = lex();
if (!isIdentifierName(token)) {
throwUnexpected(token);
}
return delegate.createIdentifier(token.value);
}
function parseNonComputedMember() {
expect('.');
return parseNonComputedProperty();
}
function parseComputedMember() {
var expr;
expect('[');
expr = parseExpression();
expect(']');
return expr;
}
function parseLeftHandSideExpression() {
var expr, args, property;
expr = parsePrimaryExpression();
while (true) {
if (match('[')) {
property = parseComputedMember();
expr = delegate.createMemberExpression('[', expr, property);
} else if (match('.')) {
property = parseNonComputedMember();
expr = delegate.createMemberExpression('.', expr, property);
} else if (match('(')) {
args = parseArguments();
expr = delegate.createCallExpression(expr, args);
} else {
break;
}
}
return expr;
}
// 11.3 Postfix Expressions
var parsePostfixExpression = parseLeftHandSideExpression;
// 11.4 Unary Operators
function parseUnaryExpression() {
var token, expr;
if (lookahead.type !== Token.Punctuator && lookahead.type !== Token.Keyword) {
expr = parsePostfixExpression();
} else if (match('+') || match('-') || match('!')) {
token = lex();
expr = parseUnaryExpression();
expr = delegate.createUnaryExpression(token.value, expr);
} else if (matchKeyword('delete') || matchKeyword('void') || matchKeyword('typeof')) {
throwError({}, Messages.UnexpectedToken);
} else {
expr = parsePostfixExpression();
}
return expr;
}
function binaryPrecedence(token) {
var prec = 0;
if (token.type !== Token.Punctuator && token.type !== Token.Keyword) {
return 0;
}
switch (token.value) {
case '||':
prec = 1;
break;
case '&&':
prec = 2;
break;
case '==':
case '!=':
case '===':
case '!==':
prec = 6;
break;
case '<':
case '>':
case '<=':
case '>=':
case 'instanceof':
prec = 7;
break;
case 'in':
prec = 7;
break;
case '+':
case '-':
prec = 9;
break;
case '*':
case '/':
case '%':
prec = 11;
break;
default:
break;
}
return prec;
}
// 11.5 Multiplicative Operators
// 11.6 Additive Operators
// 11.7 Bitwise Shift Operators
// 11.8 Relational Operators
// 11.9 Equality Operators
// 11.10 Binary Bitwise Operators
// 11.11 Binary Logical Operators
function parseBinaryExpression() {
var expr, token, prec, stack, right, operator, left, i;
left = parseUnaryExpression();
token = lookahead;
prec = binaryPrecedence(token);
if (prec === 0) {
return left;
}
token.prec = prec;
lex();
right = parseUnaryExpression();
stack = [left, token, right];
while ((prec = binaryPrecedence(lookahead)) > 0) {
// Reduce: make a binary expression from the three topmost entries.
while ((stack.length > 2) && (prec <= stack[stack.length - 2].prec)) {
right = stack.pop();
operator = stack.pop().value;
left = stack.pop();
expr = delegate.createBinaryExpression(operator, left, right);
stack.push(expr);
}
// Shift.
token = lex();
token.prec = prec;
stack.push(token);
expr = parseUnaryExpression();
stack.push(expr);
}
// Final reduce to clean-up the stack.
i = stack.length - 1;
expr = stack[i];
while (i > 1) {
expr = delegate.createBinaryExpression(stack[i - 1].value, stack[i - 2], expr);
i -= 2;
}
return expr;
}
// 11.12 Conditional Operator
function parseConditionalExpression() {
var expr, consequent, alternate;
expr = parseBinaryExpression();
if (match('?')) {
lex();
consequent = parseConditionalExpression();
expect(':');
alternate = parseConditionalExpression();
expr = delegate.createConditionalExpression(expr, consequent, alternate);
}
return expr;
}
// Simplification since we do not support AssignmentExpression.
var parseExpression = parseConditionalExpression;
// Polymer Syntax extensions
// Filter ::
// Identifier
// Identifier "(" ")"
// Identifier "(" FilterArguments ")"
function parseFilter() {
var identifier, args;
identifier = lex();
if (identifier.type !== Token.Identifier) {
throwUnexpected(identifier);
}
args = match('(') ? parseArguments() : [];
return delegate.createFilter(identifier.value, args);
}
// Filters ::
// "|" Filter
// Filters "|" Filter
function parseFilters() {
while (match('|')) {
lex();
parseFilter();
}
}
// TopLevel ::
// LabelledExpressions
// AsExpression
// InExpression
// FilterExpression
// AsExpression ::
// FilterExpression as Identifier
// InExpression ::
// Identifier, Identifier in FilterExpression
// Identifier in FilterExpression
// FilterExpression ::
// Expression
// Expression Filters
function parseTopLevel() {
skipWhitespace();
peek();
var expr = parseExpression();
if (expr) {
if (lookahead.value === ',' || lookahead.value == 'in' &&
expr.type === Syntax.Identifier) {
parseInExpression(expr);
} else {
parseFilters();
if (lookahead.value === 'as') {
parseAsExpression(expr);
} else {
delegate.createTopLevel(expr);
}
}
}
if (lookahead.type !== Token.EOF) {
throwUnexpected(lookahead);
}
}
function parseAsExpression(expr) {
lex(); // as
var identifier = lex().value;
delegate.createAsExpression(expr, identifier);
}
function parseInExpression(identifier) {
var indexName;
if (lookahead.value === ',') {
lex();
if (lookahead.type !== Token.Identifier)
throwUnexpected(lookahead);
indexName = lex().value;
}
lex(); // in
var expr = parseExpression();
parseFilters();
delegate.createInExpression(identifier.name, indexName, expr);
}
function parse(code, inDelegate) {
delegate = inDelegate;
source = code;
index = 0;
length = source.length;
lookahead = null;
state = {
labelSet: {}
};
return parseTopLevel();
}
global.esprima = {
parse: parse
};
})(this);
// Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
// This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
// The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
// The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
// Code distributed by Google as part of the polymer project is also
// subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
(function (global) {
'use strict';
function prepareBinding(expressionText, name, node, filterRegistry) {
var expression;
try {
expression = getExpression(expressionText);
if (expression.scopeIdent &&
(node.nodeType !== Node.ELEMENT_NODE ||
node.tagName !== 'TEMPLATE' ||
(name !== 'bind' && name !== 'repeat'))) {
throw Error('as and in can only be used within <template bind/repeat>');
}
} catch (ex) {
console.error('Invalid expression syntax: ' + expressionText, ex);
return;
}
return function(model, node, oneTime) {
var binding = expression.getBinding(model, filterRegistry, oneTime);
if (expression.scopeIdent && binding) {
node.polymerExpressionScopeIdent_ = expression.scopeIdent;
if (expression.indexIdent)
node.polymerExpressionIndexIdent_ = expression.indexIdent;
}
return binding;
}
}
// TODO(rafaelw): Implement simple LRU.
var expressionParseCache = Object.create(null);
function getExpression(expressionText) {
var expression = expressionParseCache[expressionText];
if (!expression) {
var delegate = new ASTDelegate();
esprima.parse(expressionText, delegate);
expression = new Expression(delegate);
expressionParseCache[expressionText] = expression;
}
return expression;
}
function Literal(value) {
this.value = value;
this.valueFn_ = undefined;
}
Literal.prototype = {
valueFn: function() {
if (!this.valueFn_) {
var value = this.value;
this.valueFn_ = function() {
return value;
}
}
return this.valueFn_;
}
}
function IdentPath(name) {
this.name = name;
this.path = Path.get(name);
}
IdentPath.prototype = {
valueFn: function() {
if (!this.valueFn_) {
var name = this.name;
var path = this.path;
this.valueFn_ = function(model, observer) {
if (observer)
observer.addPath(model, path);
return path.getValueFrom(model);
}
}
return this.valueFn_;
},
setValue: function(model, newValue) {
if (this.path.length == 1)
model = findScope(model, this.path[0]);
return this.path.setValueFrom(model, newValue);
}
};
function MemberExpression(object, property, accessor) {
this.computed = accessor == '[';
this.dynamicDeps = typeof object == 'function' ||
object.dynamicDeps ||
(this.computed && !(property instanceof Literal));
this.simplePath =
!this.dynamicDeps &&
(property instanceof IdentPath || property instanceof Literal) &&
(object instanceof MemberExpression || object instanceof IdentPath);
this.object = this.simplePath ? object : getFn(object);
this.property = !this.computed || this.simplePath ?
property : getFn(property);
}
MemberExpression.prototype = {
get fullPath() {
if (!this.fullPath_) {
var parts = this.object instanceof MemberExpression ?
this.object.fullPath.slice() : [this.object.name];
parts.push(this.property instanceof IdentPath ?
this.property.name : this.property.value);
this.fullPath_ = Path.get(parts);
}
return this.fullPath_;
},
valueFn: function() {
if (!this.valueFn_) {
var object = this.object;
if (this.simplePath) {
var path = this.fullPath;
this.valueFn_ = function(model, observer) {
if (observer)
observer.addPath(model, path);
return path.getValueFrom(model);
};
} else if (!this.computed) {
var path = Path.get(this.property.name);
this.valueFn_ = function(model, observer, filterRegistry) {
var context = object(model, observer, filterRegistry);
if (observer)
observer.addPath(context, path);
return path.getValueFrom(context);
}
} else {
// Computed property.
var property = this.property;
this.valueFn_ = function(model, observer, filterRegistry) {
var context = object(model, observer, filterRegistry);
var propName = property(model, observer, filterRegistry);
if (observer)
observer.addPath(context, [propName]);
return context ? context[propName] : undefined;
};
}
}
return this.valueFn_;
},
setValue: function(model, newValue) {
if (this.simplePath) {
this.fullPath.setValueFrom(model, newValue);
return newValue;
}
var object = this.object(model);
var propName = this.property instanceof IdentPath ? this.property.name :
this.property(model);
return object[propName] = newValue;
}
};
function Filter(name, args) {
this.name = name;
this.args = [];
for (var i = 0; i < args.length; i++) {
this.args[i] = getFn(args[i]);
}
}
Filter.prototype = {
transform: function(model, observer, filterRegistry, toModelDirection,
initialArgs) {
var fn = filterRegistry[this.name];
var context = model;
if (fn) {
context = undefined;
} else {
fn = context[this.name];
if (!fn) {
console.error('Cannot find function or filter: ' + this.name);
return;
}
}
// If toModelDirection is falsey, then the "normal" (dom-bound) direction
// is used. Otherwise, it looks for a 'toModel' property function on the
// object.
if (toModelDirection) {
fn = fn.toModel;
} else if (typeof fn.toDOM == 'function') {
fn = fn.toDOM;
}
if (typeof fn != 'function') {
console.error('Cannot find function or filter: ' + this.name);
return;
}
var args = initialArgs || [];
for (var i = 0; i < this.args.length; i++) {
args.push(getFn(this.args[i])(model, observer, filterRegistry));
}
return fn.apply(context, args);
}
};
function notImplemented() { throw Error('Not Implemented'); }
var unaryOperators = {
'+': function(v) { return +v; },
'-': function(v) { return -v; },
'!': function(v) { return !v; }
};
var binaryOperators = {
'+': function(l, r) { return l+r; },
'-': function(l, r) { return l-r; },
'*': function(l, r) { return l*r; },
'/': function(l, r) { return l/r; },
'%': function(l, r) { return l%r; },
'<': function(l, r) { return l<r; },
'>': function(l, r) { return l>r; },
'<=': function(l, r) { return l<=r; },
'>=': function(l, r) { return l>=r; },
'==': function(l, r) { return l==r; },
'!=': function(l, r) { return l!=r; },
'===': function(l, r) { return l===r; },
'!==': function(l, r) { return l!==r; },
'&&': function(l, r) { return l&&r; },
'||': function(l, r) { return l||r; },
};
function getFn(arg) {
return typeof arg == 'function' ? arg : arg.valueFn();
}
function ASTDelegate() {
this.expression = null;
this.filters = [];
this.deps = {};
this.currentPath = undefined;
this.scopeIdent = undefined;
this.indexIdent = undefined;
this.dynamicDeps = false;
}
ASTDelegate.prototype = {
createUnaryExpression: function(op, argument) {
if (!unaryOperators[op])
throw Error('Disallowed operator: ' + op);
argument = getFn(argument);
return function(model, observer, filterRegistry) {
return unaryOperators[op](argument(model, observer, filterRegistry));
};
},
createBinaryExpression: function(op, left, right) {
if (!binaryOperators[op])
throw Error('Disallowed operator: ' + op);
left = getFn(left);
right = getFn(right);
switch (op) {
case '||':
this.dynamicDeps = true;
return function(model, observer, filterRegistry) {
return left(model, observer, filterRegistry) ||
right(model, observer, filterRegistry);
};
case '&&':
this.dynamicDeps = true;
return function(model, observer, filterRegistry) {
return left(model, observer, filterRegistry) &&
right(model, observer, filterRegistry);
};
}
return function(model, observer, filterRegistry) {
return binaryOperators[op](left(model, observer, filterRegistry),
right(model, observer, filterRegistry));
};
},
createConditionalExpression: function(test, consequent, alternate) {
test = getFn(test);
consequent = getFn(consequent);
alternate = getFn(alternate);
this.dynamicDeps = true;
return function(model, observer, filterRegistry) {
return test(model, observer, filterRegistry) ?
consequent(model, observer, filterRegistry) :
alternate(model, observer, filterRegistry);
}
},
createIdentifier: function(name) {
var ident = new IdentPath(name);
ident.type = 'Identifier';
return ident;
},
createMemberExpression: function(accessor, object, property) {
var ex = new MemberExpression(object, property, accessor);
if (ex.dynamicDeps)
this.dynamicDeps = true;
return ex;
},
createCallExpression: function(expression, args) {
if (!(expression instanceof IdentPath))
throw Error('Only identifier function invocations are allowed');
var filter = new Filter(expression.name, args);
return function(model, observer, filterRegistry) {
return filter.transform(model, observer, filterRegistry, false);
};
},
createLiteral: function(token) {
return new Literal(token.value);
},
createArrayExpression: function(elements) {
for (var i = 0; i < elements.length; i++)
elements[i] = getFn(elements[i]);
return function(model, observer, filterRegistry) {
var arr = []
for (var i = 0; i < elements.length; i++)
arr.push(elements[i](model, observer, filterRegistry));
return arr;
}
},
createProperty: function(kind, key, value) {
return {
key: key instanceof IdentPath ? key.name : key.value,
value: value
};
},
createObjectExpression: function(properties) {
for (var i = 0; i < properties.length; i++)
properties[i].value = getFn(properties[i].value);
return function(model, observer, filterRegistry) {
var obj = {};
for (var i = 0; i < properties.length; i++)
obj[properties[i].key] =
properties[i].value(model, observer, filterRegistry);
return obj;
}
},
createFilter: function(name, args) {
this.filters.push(new Filter(name, args));
},
createAsExpression: function(expression, scopeIdent) {
this.expression = expression;
this.scopeIdent = scopeIdent;
},
createInExpression: function(scopeIdent, indexIdent, expression) {
this.expression = expression;
this.scopeIdent = scopeIdent;
this.indexIdent = indexIdent;
},
createTopLevel: function(expression) {
this.expression = expression;
},
createThisExpression: notImplemented
}
function ConstantObservable(value) {
this.value_ = value;
}
ConstantObservable.prototype = {
open: function() { return this.value_; },
discardChanges: function() { return this.value_; },
deliver: function() {},
close: function() {},
}
function Expression(delegate) {
this.scopeIdent = delegate.scopeIdent;
this.indexIdent = delegate.indexIdent;
if (!delegate.expression)
throw Error('No expression found.');
this.expression = delegate.expression;
getFn(this.expression); // forces enumeration of path dependencies
this.filters = delegate.filters;
this.dynamicDeps = delegate.dynamicDeps;
}
Expression.prototype = {
getBinding: function(model, filterRegistry, oneTime) {
if (oneTime)
return this.getValue(model, undefined, filterRegistry);
var observer = new CompoundObserver();
// captures deps.
var firstValue = this.getValue(model, observer, filterRegistry);
var firstTime = true;
var self = this;
function valueFn() {
// deps cannot have changed on first value retrieval.
if (firstTime) {
firstTime = false;
return firstValue;
}
if (self.dynamicDeps)
observer.startReset();
var value = self.getValue(model,
self.dynamicDeps ? observer : undefined,
filterRegistry);
if (self.dynamicDeps)
observer.finishReset();
return value;
}
function setValueFn(newValue) {
self.setValue(model, newValue, filterRegistry);
return newValue;
}
return new ObserverTransform(observer, valueFn, setValueFn, true);
},
getValue: function(model, observer, filterRegistry) {
var value = getFn(this.expression)(model, observer, filterRegistry);
for (var i = 0; i < this.filters.length; i++) {
value = this.filters[i].transform(model, observer, filterRegistry,
false, [value]);
}
return value;
},
setValue: function(model, newValue, filterRegistry) {
var count = this.filters ? this.filters.length : 0;
while (count-- > 0) {
newValue = this.filters[count].transform(model, undefined,
filterRegistry, true, [newValue]);
}
if (this.expression.setValue)
return this.expression.setValue(model, newValue);
}
}
/**
* Converts a style property name to a css property name. For example:
* "WebkitUserSelect" to "-webkit-user-select"
*/
function convertStylePropertyName(name) {
return String(name).replace(/[A-Z]/g, function(c) {
return '-' + c.toLowerCase();
});
}
var parentScopeName = '@' + Math.random().toString(36).slice(2);
// Single ident paths must bind directly to the appropriate scope object.
// I.e. Pushed values in two-bindings need to be assigned to the actual model
// object.
function findScope(model, prop) {
while (model[parentScopeName] &&
!Object.prototype.hasOwnProperty.call(model, prop)) {
model = model[parentScopeName];
}
return model;
}
function isLiteralExpression(pathString) {
switch (pathString) {
case '':
return false;
case 'false':
case 'null':
case 'true':
return true;
}
if (!isNaN(Number(pathString)))
return true;
return false;
};
function PolymerExpressions() {}
PolymerExpressions.prototype = {
// "built-in" filters
styleObject: function(value) {
var parts = [];
for (var key in value) {
parts.push(convertStylePropertyName(key) + ': ' + value[key]);
}
return parts.join('; ');
},
tokenList: function(value) {
var tokens = [];
for (var key in value) {
if (value[key])
tokens.push(key);
}
return tokens.join(' ');
},
// binding delegate API
prepareInstancePositionChanged: function(template) {
var indexIdent = template.polymerExpressionIndexIdent_;
if (!indexIdent)
return;
return function(templateInstance, index) {
templateInstance.model[indexIdent] = index;
};
},
prepareBinding: function(pathString, name, node) {
var path = Path.get(pathString);
if (!isLiteralExpression(pathString) && path.valid) {
if (path.length == 1) {
return function(model, node, oneTime) {
if (oneTime)
return path.getValueFrom(model);
var scope = findScope(model, path[0]);
return new PathObserver(scope, path);
};
}
return; // bail out early if pathString is simple path.
}
return prepareBinding(pathString, name, node, this);
},
prepareInstanceModel: function(template) {
var scopeName = template.polymerExpressionScopeIdent_;
if (!scopeName)
return;
var parentScope = template.templateInstance ?
template.templateInstance.model :
template.model;
var indexName = template.polymerExpressionIndexIdent_;
return function(model) {
return createScopeObject(parentScope, model, scopeName, indexName);
};
}
};
var createScopeObject = ('__proto__' in {}) ?
function(parentScope, model, scopeName, indexName) {
var scope = {};
scope[scopeName] = model;
scope[indexName] = undefined;
scope[parentScopeName] = parentScope;
scope.__proto__ = parentScope;
return scope;
} :
function(parentScope, model, scopeName, indexName) {
var scope = Object.create(parentScope);
Object.defineProperty(scope, scopeName,
{ value: model, configurable: true, writable: true });
Object.defineProperty(scope, indexName,
{ value: undefined, configurable: true, writable: true });
Object.defineProperty(scope, parentScopeName,
{ value: parentScope, configurable: true, writable: true });
return scope;
};
global.PolymerExpressions = PolymerExpressions;
PolymerExpressions.getExpression = getExpression;
})(this);
Polymer = {
version: '0.5.3'
};
// TODO(sorvell): this ensures Polymer is an object and not a function
// Platform is currently defining it as a function to allow for async loading
// of polymer; once we refine the loading process this likely goes away.
if (typeof window.Polymer === 'function') {
Polymer = {};
}
(function(scope) {
function withDependencies(task, depends) {
depends = depends || [];
if (!depends.map) {
depends = [depends];
}
return task.apply(this, depends.map(marshal));
}
function module(name, dependsOrFactory, moduleFactory) {
var module;
switch (arguments.length) {
case 0:
return;
case 1:
module = null;
break;
case 2:
// dependsOrFactory is `factory` in this case
module = dependsOrFactory.apply(this);
break;
default:
// dependsOrFactory is `depends` in this case
module = withDependencies(moduleFactory, dependsOrFactory);
break;
}
modules[name] = module;
};
function marshal(name) {
return modules[name];
}
var modules = {};
function using(depends, task) {
HTMLImports.whenImportsReady(function() {
withDependencies(task, depends);
});
};
// exports
scope.marshal = marshal;
// `module` confuses commonjs detectors
scope.modularize = module;
scope.using = using;
})(window);
/*
Build only script.
Ensures scripts needed for basic x-platform compatibility
will be run when platform.js is not loaded.
*/
if (!window.WebComponents) {
/*
On supported platforms, platform.js is not needed. To retain compatibility
with the polyfills, we stub out minimal functionality.
*/
if (!window.WebComponents) {
WebComponents = {
flush: function() {},
flags: {log: {}}
};
Platform = WebComponents;
CustomElements = {
useNative: true,
ready: true,
takeRecords: function() {},
instanceof: function(obj, base) {
return obj instanceof base;
}
};
HTMLImports = {
useNative: true
};
addEventListener('HTMLImportsLoaded', function() {
document.dispatchEvent(
new CustomEvent('WebComponentsReady', {bubbles: true})
);
});
// ShadowDOM
ShadowDOMPolyfill = null;
wrap = unwrap = function(n){
return n;
};
}
/*
Create polyfill scope and feature detect native support.
*/
window.HTMLImports = window.HTMLImports || {flags:{}};
(function(scope) {
/**
Basic setup and simple module executer. We collect modules and then execute
the code later, only if it's necessary for polyfilling.
*/
var IMPORT_LINK_TYPE = 'import';
var useNative = Boolean(IMPORT_LINK_TYPE in document.createElement('link'));
/**
Support `currentScript` on all browsers as `document._currentScript.`
NOTE: We cannot polyfill `document.currentScript` because it's not possible
both to override and maintain the ability to capture the native value.
Therefore we choose to expose `_currentScript` both when native imports
and the polyfill are in use.
*/
// NOTE: ShadowDOMPolyfill intrusion.
var hasShadowDOMPolyfill = Boolean(window.ShadowDOMPolyfill);
var wrap = function(node) {
return hasShadowDOMPolyfill ? ShadowDOMPolyfill.wrapIfNeeded(node) : node;
};
var rootDocument = wrap(document);
var currentScriptDescriptor = {
get: function() {
var script = HTMLImports.currentScript || document.currentScript ||
// NOTE: only works when called in synchronously executing code.
// readyState should check if `loading` but IE10 is
// interactive when scripts run so we cheat.
(document.readyState !== 'complete' ?
document.scripts[document.scripts.length - 1] : null);
return wrap(script);
},
configurable: true
};
Object.defineProperty(document, '_currentScript', currentScriptDescriptor);
Object.defineProperty(rootDocument, '_currentScript', currentScriptDescriptor);
/**
Add support for the `HTMLImportsLoaded` event and the `HTMLImports.whenReady`
method. This api is necessary because unlike the native implementation,
script elements do not force imports to resolve. Instead, users should wrap
code in either an `HTMLImportsLoaded` hander or after load time in an
`HTMLImports.whenReady(callback)` call.
NOTE: This module also supports these apis under the native implementation.
Therefore, if this file is loaded, the same code can be used under both
the polyfill and native implementation.
*/
var isIE = /Trident/.test(navigator.userAgent);
// call a callback when all HTMLImports in the document at call time
// (or at least document ready) have loaded.
// 1. ensure the document is in a ready state (has dom), then
// 2. watch for loading of imports and call callback when done
function whenReady(callback, doc) {
doc = doc || rootDocument;
// if document is loading, wait and try again
whenDocumentReady(function() {
watchImportsLoad(callback, doc);
}, doc);
}
// call the callback when the document is in a ready state (has dom)
var requiredReadyState = isIE ? 'complete' : 'interactive';
var READY_EVENT = 'readystatechange';
function isDocumentReady(doc) {
return (doc.readyState === 'complete' ||
doc.readyState === requiredReadyState);
}
// call <callback> when we ensure the document is in a ready state
function whenDocumentReady(callback, doc) {
if (!isDocumentReady(doc)) {
var checkReady = function() {
if (doc.readyState === 'complete' ||
doc.readyState === requiredReadyState) {
doc.removeEventListener(READY_EVENT, checkReady);
whenDocumentReady(callback, doc);
}
};
doc.addEventListener(READY_EVENT, checkReady);
} else if (callback) {
callback();
}
}
function markTargetLoaded(event) {
event.target.__loaded = true;
}
// call <callback> when we ensure all imports have loaded
function watchImportsLoad(callback, doc) {
var imports = doc.querySelectorAll('link[rel=import]');
var loaded = 0, l = imports.length;
function checkDone(d) {
if ((loaded == l) && callback) {
callback();
}
}
function loadedImport(e) {
markTargetLoaded(e);
loaded++;
checkDone();
}
if (l) {
for (var i=0, imp; (i<l) && (imp=imports[i]); i++) {
if (isImportLoaded(imp)) {
loadedImport.call(imp, {target: imp});
} else {
imp.addEventListener('load', loadedImport);
imp.addEventListener('error', loadedImport);
}
}
} else {
checkDone();
}
}
// NOTE: test for native imports loading is based on explicitly watching
// all imports (see below).
// However, we cannot rely on this entirely without watching the entire document
// for import links. For perf reasons, currently only head is watched.
// Instead, we fallback to checking if the import property is available
// and the document is not itself loading.
function isImportLoaded(link) {
return useNative ? link.__loaded ||
(link.import && link.import.readyState !== 'loading') :
link.__importParsed;
}
// TODO(sorvell): Workaround for
// https://www.w3.org/Bugs/Public/show_bug.cgi?id=25007, should be removed when
// this bug is addressed.
// (1) Install a mutation observer to see when HTMLImports have loaded
// (2) if this script is run during document load it will watch any existing
// imports for loading.
//
// NOTE: The workaround has restricted functionality: (1) it's only compatible
// with imports that are added to document.head since the mutation observer
// watches only head for perf reasons, (2) it requires this script
// to run before any imports have completed loading.
if (useNative) {
new MutationObserver(function(mxns) {
for (var i=0, l=mxns.length, m; (i < l) && (m=mxns[i]); i++) {
if (m.addedNodes) {
handleImports(m.addedNodes);
}
}
}).observe(document.head, {childList: true});
function handleImports(nodes) {
for (var i=0, l=nodes.length, n; (i<l) && (n=nodes[i]); i++) {
if (isImport(n)) {
handleImport(n);
}
}
}
function isImport(element) {
return element.localName === 'link' && element.rel === 'import';
}
function handleImport(element) {
var loaded = element.import;
if (loaded) {
markTargetLoaded({target: element});
} else {
element.addEventListener('load', markTargetLoaded);
element.addEventListener('error', markTargetLoaded);
}
}
// make sure to catch any imports that are in the process of loading
// when this script is run.
(function() {
if (document.readyState === 'loading') {
var imports = document.querySelectorAll('link[rel=import]');
for (var i=0, l=imports.length, imp; (i<l) && (imp=imports[i]); i++) {
handleImport(imp);
}
}
})();
}
// Fire the 'HTMLImportsLoaded' event when imports in document at load time
// have loaded. This event is required to simulate the script blocking
// behavior of native imports. A main document script that needs to be sure
// imports have loaded should wait for this event.
whenReady(function() {
HTMLImports.ready = true;
HTMLImports.readyTime = new Date().getTime();
rootDocument.dispatchEvent(
new CustomEvent('HTMLImportsLoaded', {bubbles: true})
);
});
// exports
scope.IMPORT_LINK_TYPE = IMPORT_LINK_TYPE;
scope.useNative = useNative;
scope.rootDocument = rootDocument;
scope.whenReady = whenReady;
scope.isIE = isIE;
})(HTMLImports);
(function(scope) {
// TODO(sorvell): It's desireable to provide a default stylesheet
// that's convenient for styling unresolved elements, but
// it's cumbersome to have to include this manually in every page.
// It would make sense to put inside some HTMLImport but
// the HTMLImports polyfill does not allow loading of stylesheets
// that block rendering. Therefore this injection is tolerated here.
var style = document.createElement('style');
style.textContent = ''
+ 'body {'
+ 'transition: opacity ease-in 0.2s;'
+ ' } \n'
+ 'body[unresolved] {'
+ 'opacity: 0; display: block; overflow: hidden;'
+ ' } \n'
;
var head = document.querySelector('head');
head.insertBefore(style, head.firstChild);
})(Platform);
/*
Build only script.
Ensures scripts needed for basic x-platform compatibility
will be run when platform.js is not loaded.
*/
}
(function(global) {
'use strict';
var testingExposeCycleCount = global.testingExposeCycleCount;
// Detect and do basic sanity checking on Object/Array.observe.
function detectObjectObserve() {
if (typeof Object.observe !== 'function' ||
typeof Array.observe !== 'function') {
return false;
}
var records = [];
function callback(recs) {
records = recs;
}
var test = {};
var arr = [];
Object.observe(test, callback);
Array.observe(arr, callback);
test.id = 1;
test.id = 2;
delete test.id;
arr.push(1, 2);
arr.length = 0;
Object.deliverChangeRecords(callback);
if (records.length !== 5)
return false;
if (records[0].type != 'add' ||
records[1].type != 'update' ||
records[2].type != 'delete' ||
records[3].type != 'splice' ||
records[4].type != 'splice') {
return false;
}
Object.unobserve(test, callback);
Array.unobserve(arr, callback);
return true;
}
var hasObserve = detectObjectObserve();
function detectEval() {
// Don't test for eval if we're running in a Chrome App environment.
// We check for APIs set that only exist in a Chrome App context.
if (typeof chrome !== 'undefined' && chrome.app && chrome.app.runtime) {
return false;
}
// Firefox OS Apps do not allow eval. This feature detection is very hacky
// but even if some other platform adds support for this function this code
// will continue to work.
if (typeof navigator != 'undefined' && navigator.getDeviceStorage) {
return false;
}
try {
var f = new Function('', 'return true;');
return f();
} catch (ex) {
return false;
}
}
var hasEval = detectEval();
function isIndex(s) {
return +s === s >>> 0 && s !== '';
}
function toNumber(s) {
return +s;
}
function isObject(obj) {
return obj === Object(obj);
}
var numberIsNaN = global.Number.isNaN || function(value) {
return typeof value === 'number' && global.isNaN(value);
}
function areSameValue(left, right) {
if (left === right)
return left !== 0 || 1 / left === 1 / right;
if (numberIsNaN(left) && numberIsNaN(right))
return true;
return left !== left && right !== right;
}
var createObject = ('__proto__' in {}) ?
function(obj) { return obj; } :
function(obj) {
var proto = obj.__proto__;
if (!proto)
return obj;
var newObject = Object.create(proto);
Object.getOwnPropertyNames(obj).forEach(function(name) {
Object.defineProperty(newObject, name,
Object.getOwnPropertyDescriptor(obj, name));
});
return newObject;
};
var identStart = '[\$_a-zA-Z]';
var identPart = '[\$_a-zA-Z0-9]';
var identRegExp = new RegExp('^' + identStart + '+' + identPart + '*' + '$');
function getPathCharType(char) {
if (char === undefined)
return 'eof';
var code = char.charCodeAt(0);
switch(code) {
case 0x5B: // [
case 0x5D: // ]
case 0x2E: // .
case 0x22: // "
case 0x27: // '
case 0x30: // 0
return char;
case 0x5F: // _
case 0x24: // $
return 'ident';
case 0x20: // Space
case 0x09: // Tab
case 0x0A: // Newline
case 0x0D: // Return
case 0xA0: // No-break space
case 0xFEFF: // Byte Order Mark
case 0x2028: // Line Separator
case 0x2029: // Paragraph Separator
return 'ws';
}
// a-z, A-Z
if ((0x61 <= code && code <= 0x7A) || (0x41 <= code && code <= 0x5A))
return 'ident';
// 1-9
if (0x31 <= code && code <= 0x39)
return 'number';
return 'else';
}
var pathStateMachine = {
'beforePath': {
'ws': ['beforePath'],
'ident': ['inIdent', 'append'],
'[': ['beforeElement'],
'eof': ['afterPath']
},
'inPath': {
'ws': ['inPath'],
'.': ['beforeIdent'],
'[': ['beforeElement'],
'eof': ['afterPath']
},
'beforeIdent': {
'ws': ['beforeIdent'],
'ident': ['inIdent', 'append']
},
'inIdent': {
'ident': ['inIdent', 'append'],
'0': ['inIdent', 'append'],
'number': ['inIdent', 'append'],
'ws': ['inPath', 'push'],
'.': ['beforeIdent', 'push'],
'[': ['beforeElement', 'push'],
'eof': ['afterPath', 'push']
},
'beforeElement': {
'ws': ['beforeElement'],
'0': ['afterZero', 'append'],
'number': ['inIndex', 'append'],
"'": ['inSingleQuote', 'append', ''],
'"': ['inDoubleQuote', 'append', '']
},
'afterZero': {
'ws': ['afterElement', 'push'],
']': ['inPath', 'push']
},
'inIndex': {
'0': ['inIndex', 'append'],
'number': ['inIndex', 'append'],
'ws': ['afterElement'],
']': ['inPath', 'push']
},
'inSingleQuote': {
"'": ['afterElement'],
'eof': ['error'],
'else': ['inSingleQuote', 'append']
},
'inDoubleQuote': {
'"': ['afterElement'],
'eof': ['error'],
'else': ['inDoubleQuote', 'append']
},
'afterElement': {
'ws': ['afterElement'],
']': ['inPath', 'push']
}
}
function noop() {}
function parsePath(path) {
var keys = [];
var index = -1;
var c, newChar, key, type, transition, action, typeMap, mode = 'beforePath';
var actions = {
push: function() {
if (key === undefined)
return;
keys.push(key);
key = undefined;
},
append: function() {
if (key === undefined)
key = newChar
else
key += newChar;
}
};
function maybeUnescapeQuote() {
if (index >= path.length)
return;
var nextChar = path[index + 1];
if ((mode == 'inSingleQuote' && nextChar == "'") ||
(mode == 'inDoubleQuote' && nextChar == '"')) {
index++;
newChar = nextChar;
actions.append();
return true;
}
}
while (mode) {
index++;
c = path[index];
if (c == '\\' && maybeUnescapeQuote(mode))
continue;
type = getPathCharType(c);
typeMap = pathStateMachine[mode];
transition = typeMap[type] || typeMap['else'] || 'error';
if (transition == 'error')
return; // parse error;
mode = transition[0];
action = actions[transition[1]] || noop;
newChar = transition[2] === undefined ? c : transition[2];
action();
if (mode === 'afterPath') {
return keys;
}
}
return; // parse error
}
function isIdent(s) {
return identRegExp.test(s);
}
var constructorIsPrivate = {};
function Path(parts, privateToken) {
if (privateToken !== constructorIsPrivate)
throw Error('Use Path.get to retrieve path objects');
for (var i = 0; i < parts.length; i++) {
this.push(String(parts[i]));
}
if (hasEval && this.length) {
this.getValueFrom = this.compiledGetValueFromFn();
}
}
// TODO(rafaelw): Make simple LRU cache
var pathCache = {};
function getPath(pathString) {
if (pathString instanceof Path)
return pathString;
if (pathString == null || pathString.length == 0)
pathString = '';
if (typeof pathString != 'string') {
if (isIndex(pathString.length)) {
// Constructed with array-like (pre-parsed) keys
return new Path(pathString, constructorIsPrivate);
}
pathString = String(pathString);
}
var path = pathCache[pathString];
if (path)
return path;
var parts = parsePath(pathString);
if (!parts)
return invalidPath;
var path = new Path(parts, constructorIsPrivate);
pathCache[pathString] = path;
return path;
}
Path.get = getPath;
function formatAccessor(key) {
if (isIndex(key)) {
return '[' + key + ']';
} else {
return '["' + key.replace(/"/g, '\\"') + '"]';
}
}
Path.prototype = createObject({
__proto__: [],
valid: true,
toString: function() {
var pathString = '';
for (var i = 0; i < this.length; i++) {
var key = this[i];
if (isIdent(key)) {
pathString += i ? '.' + key : key;
} else {
pathString += formatAccessor(key);
}
}
return pathString;
},
getValueFrom: function(obj, directObserver) {
for (var i = 0; i < this.length; i++) {
if (obj == null)
return;
obj = obj[this[i]];
}
return obj;
},
iterateObjects: function(obj, observe) {
for (var i = 0; i < this.length; i++) {
if (i)
obj = obj[this[i - 1]];
if (!isObject(obj))
return;
observe(obj, this[i]);
}
},
compiledGetValueFromFn: function() {
var str = '';
var pathString = 'obj';
str += 'if (obj != null';
var i = 0;
var key;
for (; i < (this.length - 1); i++) {
key = this[i];
pathString += isIdent(key) ? '.' + key : formatAccessor(key);
str += ' &&\n ' + pathString + ' != null';
}
str += ')\n';
var key = this[i];
pathString += isIdent(key) ? '.' + key : formatAccessor(key);
str += ' return ' + pathString + ';\nelse\n return undefined;';
return new Function('obj', str);
},
setValueFrom: function(obj, value) {
if (!this.length)
return false;
for (var i = 0; i < this.length - 1; i++) {
if (!isObject(obj))
return false;
obj = obj[this[i]];
}
if (!isObject(obj))
return false;
obj[this[i]] = value;
return true;
}
});
var invalidPath = new Path('', constructorIsPrivate);
invalidPath.valid = false;
invalidPath.getValueFrom = invalidPath.setValueFrom = function() {};
var MAX_DIRTY_CHECK_CYCLES = 1000;
function dirtyCheck(observer) {
var cycles = 0;
while (cycles < MAX_DIRTY_CHECK_CYCLES && observer.check_()) {
cycles++;
}
if (testingExposeCycleCount)
global.dirtyCheckCycleCount = cycles;
return cycles > 0;
}
function objectIsEmpty(object) {
for (var prop in object)
return false;
return true;
}
function diffIsEmpty(diff) {
return objectIsEmpty(diff.added) &&
objectIsEmpty(diff.removed) &&
objectIsEmpty(diff.changed);
}
function diffObjectFromOldObject(object, oldObject) {
var added = {};
var removed = {};
var changed = {};
for (var prop in oldObject) {
var newValue = object[prop];
if (newValue !== undefined && newValue === oldObject[prop])
continue;
if (!(prop in object)) {
removed[prop] = undefined;
continue;
}
if (newValue !== oldObject[prop])
changed[prop] = newValue;
}
for (var prop in object) {
if (prop in oldObject)
continue;
added[prop] = object[prop];
}
if (Array.isArray(object) && object.length !== oldObject.length)
changed.length = object.length;
return {
added: added,
removed: removed,
changed: changed
};
}
var eomTasks = [];
function runEOMTasks() {
if (!eomTasks.length)
return false;
for (var i = 0; i < eomTasks.length; i++) {
eomTasks[i]();
}
eomTasks.length = 0;
return true;
}
var runEOM = hasObserve ? (function(){
return function(fn) {
return Promise.resolve().then(fn);
}
})() :
(function() {
return function(fn) {
eomTasks.push(fn);
};
})();
var observedObjectCache = [];
function newObservedObject() {
var observer;
var object;
var discardRecords = false;
var first = true;
function callback(records) {
if (observer && observer.state_ === OPENED && !discardRecords)
observer.check_(records);
}
return {
open: function(obs) {
if (observer)
throw Error('ObservedObject in use');
if (!first)
Object.deliverChangeRecords(callback);
observer = obs;
first = false;
},
observe: function(obj, arrayObserve) {
object = obj;
if (arrayObserve)
Array.observe(object, callback);
else
Object.observe(object, callback);
},
deliver: function(discard) {
discardRecords = discard;
Object.deliverChangeRecords(callback);
discardRecords = false;
},
close: function() {
observer = undefined;
Object.unobserve(object, callback);
observedObjectCache.push(this);
}
};
}
/*
* The observedSet abstraction is a perf optimization which reduces the total
* number of Object.observe observations of a set of objects. The idea is that
* groups of Observers will have some object dependencies in common and this
* observed set ensures that each object in the transitive closure of
* dependencies is only observed once. The observedSet acts as a write barrier
* such that whenever any change comes through, all Observers are checked for
* changed values.
*
* Note that this optimization is explicitly moving work from setup-time to
* change-time.
*
* TODO(rafaelw): Implement "garbage collection". In order to move work off
* the critical path, when Observers are closed, their observed objects are
* not Object.unobserve(d). As a result, it's possible that if the observedSet
* is kept open, but some Observers have been closed, it could cause "leaks"
* (prevent otherwise collectable objects from being collected). At some
* point, we should implement incremental "gc" which keeps a list of
* observedSets which may need clean-up and does small amounts of cleanup on a
* timeout until all is clean.
*/
function getObservedObject(observer, object, arrayObserve) {
var dir = observedObjectCache.pop() || newObservedObject();
dir.open(observer);
dir.observe(object, arrayObserve);
return dir;
}
var observedSetCache = [];
function newObservedSet() {
var observerCount = 0;
var observers = [];
var objects = [];
var rootObj;
var rootObjProps;
function observe(obj, prop) {
if (!obj)
return;
if (obj === rootObj)
rootObjProps[prop] = true;
if (objects.indexOf(obj) < 0) {
objects.push(obj);
Object.observe(obj, callback);
}
observe(Object.getPrototypeOf(obj), prop);
}
function allRootObjNonObservedProps(recs) {
for (var i = 0; i < recs.length; i++) {
var rec = recs[i];
if (rec.object !== rootObj ||
rootObjProps[rec.name] ||
rec.type === 'setPrototype') {
return false;
}
}
return true;
}
function callback(recs) {
if (allRootObjNonObservedProps(recs))
return;
var observer;
for (var i = 0; i < observers.length; i++) {
observer = observers[i];
if (observer.state_ == OPENED) {
observer.iterateObjects_(observe);
}
}
for (var i = 0; i < observers.length; i++) {
observer = observers[i];
if (observer.state_ == OPENED) {
observer.check_();
}
}
}
var record = {
objects: objects,
get rootObject() { return rootObj; },
set rootObject(value) {
rootObj = value;
rootObjProps = {};
},
open: function(obs, object) {
observers.push(obs);
observerCount++;
obs.iterateObjects_(observe);
},
close: function(obs) {
observerCount--;
if (observerCount > 0) {
return;
}
for (var i = 0; i < objects.length; i++) {
Object.unobserve(objects[i], callback);
Observer.unobservedCount++;
}
observers.length = 0;
objects.length = 0;
rootObj = undefined;
rootObjProps = undefined;
observedSetCache.push(this);
if (lastObservedSet === this)
lastObservedSet = null;
},
};
return record;
}
var lastObservedSet;
function getObservedSet(observer, obj) {
if (!lastObservedSet || lastObservedSet.rootObject !== obj) {
lastObservedSet = observedSetCache.pop() || newObservedSet();
lastObservedSet.rootObject = obj;
}
lastObservedSet.open(observer, obj);
return lastObservedSet;
}
var UNOPENED = 0;
var OPENED = 1;
var CLOSED = 2;
var RESETTING = 3;
var nextObserverId = 1;
function Observer() {
this.state_ = UNOPENED;
this.callback_ = undefined;
this.target_ = undefined; // TODO(rafaelw): Should be WeakRef
this.directObserver_ = undefined;
this.value_ = undefined;
this.id_ = nextObserverId++;
}
Observer.prototype = {
open: function(callback, target) {
if (this.state_ != UNOPENED)
throw Error('Observer has already been opened.');
addToAll(this);
this.callback_ = callback;
this.target_ = target;
this.connect_();
this.state_ = OPENED;
return this.value_;
},
close: function() {
if (this.state_ != OPENED)
return;
removeFromAll(this);
this.disconnect_();
this.value_ = undefined;
this.callback_ = undefined;
this.target_ = undefined;
this.state_ = CLOSED;
},
deliver: function() {
if (this.state_ != OPENED)
return;
dirtyCheck(this);
},
report_: function(changes) {
try {
this.callback_.apply(this.target_, changes);
} catch (ex) {
Observer._errorThrownDuringCallback = true;
console.error('Exception caught during observer callback: ' +
(ex.stack || ex));
}
},
discardChanges: function() {
this.check_(undefined, true);
return this.value_;
}
}
var collectObservers = !hasObserve;
var allObservers;
Observer._allObserversCount = 0;
if (collectObservers) {
allObservers = [];
}
function addToAll(observer) {
Observer._allObserversCount++;
if (!collectObservers)
return;
allObservers.push(observer);
}
function removeFromAll(observer) {
Observer._allObserversCount--;
}
var runningMicrotaskCheckpoint = false;
global.Platform = global.Platform || {};
global.Platform.performMicrotaskCheckpoint = function() {
if (runningMicrotaskCheckpoint)
return;
if (!collectObservers)
return;
runningMicrotaskCheckpoint = true;
var cycles = 0;
var anyChanged, toCheck;
do {
cycles++;
toCheck = allObservers;
allObservers = [];
anyChanged = false;
for (var i = 0; i < toCheck.length; i++) {
var observer = toCheck[i];
if (observer.state_ != OPENED)
continue;
if (observer.check_())
anyChanged = true;
allObservers.push(observer);
}
if (runEOMTasks())
anyChanged = true;
} while (cycles < MAX_DIRTY_CHECK_CYCLES && anyChanged);
if (testingExposeCycleCount)
global.dirtyCheckCycleCount = cycles;
runningMicrotaskCheckpoint = false;
};
if (collectObservers) {
global.Platform.clearObservers = function() {
allObservers = [];
};
}
function ObjectObserver(object) {
Observer.call(this);
this.value_ = object;
this.oldObject_ = undefined;
}
ObjectObserver.prototype = createObject({
__proto__: Observer.prototype,
arrayObserve: false,
connect_: function(callback, target) {
if (hasObserve) {
this.directObserver_ = getObservedObject(this, this.value_,
this.arrayObserve);
} else {
this.oldObject_ = this.copyObject(this.value_);
}
},
copyObject: function(object) {
var copy = Array.isArray(object) ? [] : {};
for (var prop in object) {
copy[prop] = object[prop];
};
if (Array.isArray(object))
copy.length = object.length;
return copy;
},
check_: function(changeRecords, skipChanges) {
var diff;
var oldValues;
if (hasObserve) {
if (!changeRecords)
return false;
oldValues = {};
diff = diffObjectFromChangeRecords(this.value_, changeRecords,
oldValues);
} else {
oldValues = this.oldObject_;
diff = diffObjectFromOldObject(this.value_, this.oldObject_);
}
if (diffIsEmpty(diff))
return false;
if (!hasObserve)
this.oldObject_ = this.copyObject(this.value_);
this.report_([
diff.added || {},
diff.removed || {},
diff.changed || {},
function(property) {
return oldValues[property];
}
]);
return true;
},
disconnect_: function() {
if (hasObserve) {
this.directObserver_.close();
this.directObserver_ = undefined;
} else {
this.oldObject_ = undefined;
}
},
deliver: function() {
if (this.state_ != OPENED)
return;
if (hasObserve)
this.directObserver_.deliver(false);
else
dirtyCheck(this);
},
discardChanges: function() {
if (this.directObserver_)
this.directObserver_.deliver(true);
else
this.oldObject_ = this.copyObject(this.value_);
return this.value_;
}
});
function ArrayObserver(array) {
if (!Array.isArray(array))
throw Error('Provided object is not an Array');
ObjectObserver.call(this, array);
}
ArrayObserver.prototype = createObject({
__proto__: ObjectObserver.prototype,
arrayObserve: true,
copyObject: function(arr) {
return arr.slice();
},
check_: function(changeRecords) {
var splices;
if (hasObserve) {
if (!changeRecords)
return false;
splices = projectArraySplices(this.value_, changeRecords);
} else {
splices = calcSplices(this.value_, 0, this.value_.length,
this.oldObject_, 0, this.oldObject_.length);
}
if (!splices || !splices.length)
return false;
if (!hasObserve)
this.oldObject_ = this.copyObject(this.value_);
this.report_([splices]);
return true;
}
});
ArrayObserver.applySplices = function(previous, current, splices) {
splices.forEach(function(splice) {
var spliceArgs = [splice.index, splice.removed.length];
var addIndex = splice.index;
while (addIndex < splice.index + splice.addedCount) {
spliceArgs.push(current[addIndex]);
addIndex++;
}
Array.prototype.splice.apply(previous, spliceArgs);
});
};
function PathObserver(object, path) {
Observer.call(this);
this.object_ = object;
this.path_ = getPath(path);
this.directObserver_ = undefined;
}
PathObserver.prototype = createObject({
__proto__: Observer.prototype,
get path() {
return this.path_;
},
connect_: function() {
if (hasObserve)
this.directObserver_ = getObservedSet(this, this.object_);
this.check_(undefined, true);
},
disconnect_: function() {
this.value_ = undefined;
if (this.directObserver_) {
this.directObserver_.close(this);
this.directObserver_ = undefined;
}
},
iterateObjects_: function(observe) {
this.path_.iterateObjects(this.object_, observe);
},
check_: function(changeRecords, skipChanges) {
var oldValue = this.value_;
this.value_ = this.path_.getValueFrom(this.object_);
if (skipChanges || areSameValue(this.value_, oldValue))
return false;
this.report_([this.value_, oldValue, this]);
return true;
},
setValue: function(newValue) {
if (this.path_)
this.path_.setValueFrom(this.object_, newValue);
}
});
function CompoundObserver(reportChangesOnOpen) {
Observer.call(this);
this.reportChangesOnOpen_ = reportChangesOnOpen;
this.value_ = [];
this.directObserver_ = undefined;
this.observed_ = [];
}
var observerSentinel = {};
CompoundObserver.prototype = createObject({
__proto__: Observer.prototype,
connect_: function() {
if (hasObserve) {
var object;
var needsDirectObserver = false;
for (var i = 0; i < this.observed_.length; i += 2) {
object = this.observed_[i]
if (object !== observerSentinel) {
needsDirectObserver = true;
break;
}
}
if (needsDirectObserver)
this.directObserver_ = getObservedSet(this, object);
}
this.check_(undefined, !this.reportChangesOnOpen_);
},
disconnect_: function() {
for (var i = 0; i < this.observed_.length; i += 2) {
if (this.observed_[i] === observerSentinel)
this.observed_[i + 1].close();
}
this.observed_.length = 0;
this.value_.length = 0;
if (this.directObserver_) {
this.directObserver_.close(this);
this.directObserver_ = undefined;
}
},
addPath: function(object, path) {
if (this.state_ != UNOPENED && this.state_ != RESETTING)
throw Error('Cannot add paths once started.');
var path = getPath(path);
this.observed_.push(object, path);
if (!this.reportChangesOnOpen_)
return;
var index = this.observed_.length / 2 - 1;
this.value_[index] = path.getValueFrom(object);
},
addObserver: function(observer) {
if (this.state_ != UNOPENED && this.state_ != RESETTING)
throw Error('Cannot add observers once started.');
this.observed_.push(observerSentinel, observer);
if (!this.reportChangesOnOpen_)
return;
var index = this.observed_.length / 2 - 1;
this.value_[index] = observer.open(this.deliver, this);
},
startReset: function() {
if (this.state_ != OPENED)
throw Error('Can only reset while open');
this.state_ = RESETTING;
this.disconnect_();
},
finishReset: function() {
if (this.state_ != RESETTING)
throw Error('Can only finishReset after startReset');
this.state_ = OPENED;
this.connect_();
return this.value_;
},
iterateObjects_: function(observe) {
var object;
for (var i = 0; i < this.observed_.length; i += 2) {
object = this.observed_[i]
if (object !== observerSentinel)
this.observed_[i + 1].iterateObjects(object, observe)
}
},
check_: function(changeRecords, skipChanges) {
var oldValues;
for (var i = 0; i < this.observed_.length; i += 2) {
var object = this.observed_[i];
var path = this.observed_[i+1];
var value;
if (object === observerSentinel) {
var observable = path;
value = this.state_ === UNOPENED ?
observable.open(this.deliver, this) :
observable.discardChanges();
} else {
value = path.getValueFrom(object);
}
if (skipChanges) {
this.value_[i / 2] = value;
continue;
}
if (areSameValue(value, this.value_[i / 2]))
continue;
oldValues = oldValues || [];
oldValues[i / 2] = this.value_[i / 2];
this.value_[i / 2] = value;
}
if (!oldValues)
return false;
// TODO(rafaelw): Having observed_ as the third callback arg here is
// pretty lame API. Fix.
this.report_([this.value_, oldValues, this.observed_]);
return true;
}
});
function identFn(value) { return value; }
function ObserverTransform(observable, getValueFn, setValueFn,
dontPassThroughSet) {
this.callback_ = undefined;
this.target_ = undefined;
this.value_ = undefined;
this.observable_ = observable;
this.getValueFn_ = getValueFn || identFn;
this.setValueFn_ = setValueFn || identFn;
// TODO(rafaelw): This is a temporary hack. PolymerExpressions needs this
// at the moment because of a bug in it's dependency tracking.
this.dontPassThroughSet_ = dontPassThroughSet;
}
ObserverTransform.prototype = {
open: function(callback, target) {
this.callback_ = callback;
this.target_ = target;
this.value_ =
this.getValueFn_(this.observable_.open(this.observedCallback_, this));
return this.value_;
},
observedCallback_: function(value) {
value = this.getValueFn_(value);
if (areSameValue(value, this.value_))
return;
var oldValue = this.value_;
this.value_ = value;
this.callback_.call(this.target_, this.value_, oldValue);
},
discardChanges: function() {
this.value_ = this.getValueFn_(this.observable_.discardChanges());
return this.value_;
},
deliver: function() {
return this.observable_.deliver();
},
setValue: function(value) {
value = this.setValueFn_(value);
if (!this.dontPassThroughSet_ && this.observable_.setValue)
return this.observable_.setValue(value);
},
close: function() {
if (this.observable_)
this.observable_.close();
this.callback_ = undefined;
this.target_ = undefined;
this.observable_ = undefined;
this.value_ = undefined;
this.getValueFn_ = undefined;
this.setValueFn_ = undefined;
}
}
var expectedRecordTypes = {
add: true,
update: true,
delete: true
};
function diffObjectFromChangeRecords(object, changeRecords, oldValues) {
var added = {};
var removed = {};
for (var i = 0; i < changeRecords.length; i++) {
var record = changeRecords[i];
if (!expectedRecordTypes[record.type]) {
console.error('Unknown changeRecord type: ' + record.type);
console.error(record);
continue;
}
if (!(record.name in oldValues))
oldValues[record.name] = record.oldValue;
if (record.type == 'update')
continue;
if (record.type == 'add') {
if (record.name in removed)
delete removed[record.name];
else
added[record.name] = true;
continue;
}
// type = 'delete'
if (record.name in added) {
delete added[record.name];
delete oldValues[record.name];
} else {
removed[record.name] = true;
}
}
for (var prop in added)
added[prop] = object[prop];
for (var prop in removed)
removed[prop] = undefined;
var changed = {};
for (var prop in oldValues) {
if (prop in added || prop in removed)
continue;
var newValue = object[prop];
if (oldValues[prop] !== newValue)
changed[prop] = newValue;
}
return {
added: added,
removed: removed,
changed: changed
};
}
function newSplice(index, removed, addedCount) {
return {
index: index,
removed: removed,
addedCount: addedCount
};
}
var EDIT_LEAVE = 0;
var EDIT_UPDATE = 1;
var EDIT_ADD = 2;
var EDIT_DELETE = 3;
function ArraySplice() {}
ArraySplice.prototype = {
// Note: This function is *based* on the computation of the Levenshtein
// "edit" distance. The one change is that "updates" are treated as two
// edits - not one. With Array splices, an update is really a delete
// followed by an add. By retaining this, we optimize for "keeping" the
// maximum array items in the original array. For example:
//
// 'xxxx123' -> '123yyyy'
//
// With 1-edit updates, the shortest path would be just to update all seven
// characters. With 2-edit updates, we delete 4, leave 3, and add 4. This
// leaves the substring '123' intact.
calcEditDistances: function(current, currentStart, currentEnd,
old, oldStart, oldEnd) {
// "Deletion" columns
var rowCount = oldEnd - oldStart + 1;
var columnCount = currentEnd - currentStart + 1;
var distances = new Array(rowCount);
// "Addition" rows. Initialize null column.
for (var i = 0; i < rowCount; i++) {
distances[i] = new Array(columnCount);
distances[i][0] = i;
}
// Initialize null row
for (var j = 0; j < columnCount; j++)
distances[0][j] = j;
for (var i = 1; i < rowCount; i++) {
for (var j = 1; j < columnCount; j++) {
if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1]))
distances[i][j] = distances[i - 1][j - 1];
else {
var north = distances[i - 1][j] + 1;
var west = distances[i][j - 1] + 1;
distances[i][j] = north < west ? north : west;
}
}
}
return distances;
},
// This starts at the final weight, and walks "backward" by finding
// the minimum previous weight recursively until the origin of the weight
// matrix.
spliceOperationsFromEditDistances: function(distances) {
var i = distances.length - 1;
var j = distances[0].length - 1;
var current = distances[i][j];
var edits = [];
while (i > 0 || j > 0) {
if (i == 0) {
edits.push(EDIT_ADD);
j--;
continue;
}
if (j == 0) {
edits.push(EDIT_DELETE);
i--;
continue;
}
var northWest = distances[i - 1][j - 1];
var west = distances[i - 1][j];
var north = distances[i][j - 1];
var min;
if (west < north)
min = west < northWest ? west : northWest;
else
min = north < northWest ? north : northWest;
if (min == northWest) {
if (northWest == current) {
edits.push(EDIT_LEAVE);
} else {
edits.push(EDIT_UPDATE);
current = northWest;
}
i--;
j--;
} else if (min == west) {
edits.push(EDIT_DELETE);
i--;
current = west;
} else {
edits.push(EDIT_ADD);
j--;
current = north;
}
}
edits.reverse();
return edits;
},
/**
* Splice Projection functions:
*
* A splice map is a representation of how a previous array of items
* was transformed into a new array of items. Conceptually it is a list of
* tuples of
*
* <index, removed, addedCount>
*
* which are kept in ascending index order of. The tuple represents that at
* the |index|, |removed| sequence of items were removed, and counting forward
* from |index|, |addedCount| items were added.
*/
/**
* Lacking individual splice mutation information, the minimal set of
* splices can be synthesized given the previous state and final state of an
* array. The basic approach is to calculate the edit distance matrix and
* choose the shortest path through it.
*
* Complexity: O(l * p)
* l: The length of the current array
* p: The length of the old array
*/
calcSplices: function(current, currentStart, currentEnd,
old, oldStart, oldEnd) {
var prefixCount = 0;
var suffixCount = 0;
var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
if (currentStart == 0 && oldStart == 0)
prefixCount = this.sharedPrefix(current, old, minLength);
if (currentEnd == current.length && oldEnd == old.length)
suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
currentStart += prefixCount;
oldStart += prefixCount;
currentEnd -= suffixCount;
oldEnd -= suffixCount;
if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)
return [];
if (currentStart == currentEnd) {
var splice = newSplice(currentStart, [], 0);
while (oldStart < oldEnd)
splice.removed.push(old[oldStart++]);
return [ splice ];
} else if (oldStart == oldEnd)
return [ newSplice(currentStart, [], currentEnd - currentStart) ];
var ops = this.spliceOperationsFromEditDistances(
this.calcEditDistances(current, currentStart, currentEnd,
old, oldStart, oldEnd));
var splice = undefined;
var splices = [];
var index = currentStart;
var oldIndex = oldStart;
for (var i = 0; i < ops.length; i++) {
switch(ops[i]) {
case EDIT_LEAVE:
if (splice) {
splices.push(splice);
splice = undefined;
}
index++;
oldIndex++;
break;
case EDIT_UPDATE:
if (!splice)
splice = newSplice(index, [], 0);
splice.addedCount++;
index++;
splice.removed.push(old[oldIndex]);
oldIndex++;
break;
case EDIT_ADD:
if (!splice)
splice = newSplice(index, [], 0);
splice.addedCount++;
index++;
break;
case EDIT_DELETE:
if (!splice)
splice = newSplice(index, [], 0);
splice.removed.push(old[oldIndex]);
oldIndex++;
break;
}
}
if (splice) {
splices.push(splice);
}
return splices;
},
sharedPrefix: function(current, old, searchLength) {
for (var i = 0; i < searchLength; i++)
if (!this.equals(current[i], old[i]))
return i;
return searchLength;
},
sharedSuffix: function(current, old, searchLength) {
var index1 = current.length;
var index2 = old.length;
var count = 0;
while (count < searchLength && this.equals(current[--index1], old[--index2]))
count++;
return count;
},
calculateSplices: function(current, previous) {
return this.calcSplices(current, 0, current.length, previous, 0,
previous.length);
},
equals: function(currentValue, previousValue) {
return currentValue === previousValue;
}
};
var arraySplice = new ArraySplice();
function calcSplices(current, currentStart, currentEnd,
old, oldStart, oldEnd) {
return arraySplice.calcSplices(current, currentStart, currentEnd,
old, oldStart, oldEnd);
}
function intersect(start1, end1, start2, end2) {
// Disjoint
if (end1 < start2 || end2 < start1)
return -1;
// Adjacent
if (end1 == start2 || end2 == start1)
return 0;
// Non-zero intersect, span1 first
if (start1 < start2) {
if (end1 < end2)
return end1 - start2; // Overlap
else
return end2 - start2; // Contained
} else {
// Non-zero intersect, span2 first
if (end2 < end1)
return end2 - start1; // Overlap
else
return end1 - start1; // Contained
}
}
function mergeSplice(splices, index, removed, addedCount) {
var splice = newSplice(index, removed, addedCount);
var inserted = false;
var insertionOffset = 0;
for (var i = 0; i < splices.length; i++) {
var current = splices[i];
current.index += insertionOffset;
if (inserted)
continue;
var intersectCount = intersect(splice.index,
splice.index + splice.removed.length,
current.index,
current.index + current.addedCount);
if (intersectCount >= 0) {
// Merge the two splices
splices.splice(i, 1);
i--;
insertionOffset -= current.addedCount - current.removed.length;
splice.addedCount += current.addedCount - intersectCount;
var deleteCount = splice.removed.length +
current.removed.length - intersectCount;
if (!splice.addedCount && !deleteCount) {
// merged splice is a noop. discard.
inserted = true;
} else {
var removed = current.removed;
if (splice.index < current.index) {
// some prefix of splice.removed is prepended to current.removed.
var prepend = splice.removed.slice(0, current.index - splice.index);
Array.prototype.push.apply(prepend, removed);
removed = prepend;
}
if (splice.index + splice.removed.length > current.index + current.addedCount) {
// some suffix of splice.removed is appended to current.removed.
var append = splice.removed.slice(current.index + current.addedCount - splice.index);
Array.prototype.push.apply(removed, append);
}
splice.removed = removed;
if (current.index < splice.index) {
splice.index = current.index;
}
}
} else if (splice.index < current.index) {
// Insert splice here.
inserted = true;
splices.splice(i, 0, splice);
i++;
var offset = splice.addedCount - splice.removed.length
current.index += offset;
insertionOffset += offset;
}
}
if (!inserted)
splices.push(splice);
}
function createInitialSplices(array, changeRecords) {
var splices = [];
for (var i = 0; i < changeRecords.length; i++) {
var record = changeRecords[i];
switch(record.type) {
case 'splice':
mergeSplice(splices, record.index, record.removed.slice(), record.addedCount);
break;
case 'add':
case 'update':
case 'delete':
if (!isIndex(record.name))
continue;
var index = toNumber(record.name);
if (index < 0)
continue;
mergeSplice(splices, index, [record.oldValue], 1);
break;
default:
console.error('Unexpected record type: ' + JSON.stringify(record));
break;
}
}
return splices;
}
function projectArraySplices(array, changeRecords) {
var splices = [];
createInitialSplices(array, changeRecords).forEach(function(splice) {
if (splice.addedCount == 1 && splice.removed.length == 1) {
if (splice.removed[0] !== array[splice.index])
splices.push(splice);
return
};
splices = splices.concat(calcSplices(array, splice.index, splice.index + splice.addedCount,
splice.removed, 0, splice.removed.length));
});
return splices;
}
// Export the observe-js object for **Node.js**, with
// backwards-compatibility for the old `require()` API. If we're in
// the browser, export as a global object.
var expose = global;
if (typeof exports !== 'undefined') {
if (typeof module !== 'undefined' && module.exports) {
expose = exports = module.exports;
}
expose = exports;
}
expose.Observer = Observer;
expose.Observer.runEOM_ = runEOM;
expose.Observer.observerSentinel_ = observerSentinel; // for testing.
expose.Observer.hasObjectObserve = hasObserve;
expose.ArrayObserver = ArrayObserver;
expose.ArrayObserver.calculateSplices = function(current, previous) {
return arraySplice.calculateSplices(current, previous);
};
expose.ArraySplice = ArraySplice;
expose.ObjectObserver = ObjectObserver;
expose.PathObserver = PathObserver;
expose.CompoundObserver = CompoundObserver;
expose.Path = Path;
expose.ObserverTransform = ObserverTransform;
})(typeof global !== 'undefined' && global && typeof module !== 'undefined' && module ? global : this || window);
// Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
// This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
// The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
// The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
// Code distributed by Google as part of the polymer project is also
// subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
(function(global) {
'use strict';
var filter = Array.prototype.filter.call.bind(Array.prototype.filter);
function getTreeScope(node) {
while (node.parentNode) {
node = node.parentNode;
}
return typeof node.getElementById === 'function' ? node : null;
}
Node.prototype.bind = function(name, observable) {
console.error('Unhandled binding to Node: ', this, name, observable);
};
Node.prototype.bindFinished = function() {};
function updateBindings(node, name, binding) {
var bindings = node.bindings_;
if (!bindings)
bindings = node.bindings_ = {};
if (bindings[name])
binding[name].close();
return bindings[name] = binding;
}
function returnBinding(node, name, binding) {
return binding;
}
function sanitizeValue(value) {
return value == null ? '' : value;
}
function updateText(node, value) {
node.data = sanitizeValue(value);
}
function textBinding(node) {
return function(value) {
return updateText(node, value);
};
}
var maybeUpdateBindings = returnBinding;
Object.defineProperty(Platform, 'enableBindingsReflection', {
get: function() {
return maybeUpdateBindings === updateBindings;
},
set: function(enable) {
maybeUpdateBindings = enable ? updateBindings : returnBinding;
return enable;
},
configurable: true
});
Text.prototype.bind = function(name, value, oneTime) {
if (name !== 'textContent')
return Node.prototype.bind.call(this, name, value, oneTime);
if (oneTime)
return updateText(this, value);
var observable = value;
updateText(this, observable.open(textBinding(this)));
return maybeUpdateBindings(this, name, observable);
}
function updateAttribute(el, name, conditional, value) {
if (conditional) {
if (value)
el.setAttribute(name, '');
else
el.removeAttribute(name);
return;
}
el.setAttribute(name, sanitizeValue(value));
}
function attributeBinding(el, name, conditional) {
return function(value) {
updateAttribute(el, name, conditional, value);
};
}
Element.prototype.bind = function(name, value, oneTime) {
var conditional = name[name.length - 1] == '?';
if (conditional) {
this.removeAttribute(name);
name = name.slice(0, -1);
}
if (oneTime)
return updateAttribute(this, name, conditional, value);
var observable = value;
updateAttribute(this, name, conditional,
observable.open(attributeBinding(this, name, conditional)));
return maybeUpdateBindings(this, name, observable);
};
var checkboxEventType;
(function() {
// Attempt to feature-detect which event (change or click) is fired first
// for checkboxes.
var div = document.createElement('div');
var checkbox = div.appendChild(document.createElement('input'));
checkbox.setAttribute('type', 'checkbox');
var first;
var count = 0;
checkbox.addEventListener('click', function(e) {
count++;
first = first || 'click';
});
checkbox.addEventListener('change', function() {
count++;
first = first || 'change';
});
var event = document.createEvent('MouseEvent');
event.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, false,
false, false, false, 0, null);
checkbox.dispatchEvent(event);
// WebKit/Blink don't fire the change event if the element is outside the
// document, so assume 'change' for that case.
checkboxEventType = count == 1 ? 'change' : first;
})();
function getEventForInputType(element) {
switch (element.type) {
case 'checkbox':
return checkboxEventType;
case 'radio':
case 'select-multiple':
case 'select-one':
return 'change';
case 'range':
if (/Trident|MSIE/.test(navigator.userAgent))
return 'change';
default:
return 'input';
}
}
function updateInput(input, property, value, santizeFn) {
input[property] = (santizeFn || sanitizeValue)(value);
}
function inputBinding(input, property, santizeFn) {
return function(value) {
return updateInput(input, property, value, santizeFn);
}
}
function noop() {}
function bindInputEvent(input, property, observable, postEventFn) {
var eventType = getEventForInputType(input);
function eventHandler() {
observable.setValue(input[property]);
observable.discardChanges();
(postEventFn || noop)(input);
Platform.performMicrotaskCheckpoint();
}
input.addEventListener(eventType, eventHandler);
return {
close: function() {
input.removeEventListener(eventType, eventHandler);
observable.close();
},
observable_: observable
}
}
function booleanSanitize(value) {
return Boolean(value);
}
// |element| is assumed to be an HTMLInputElement with |type| == 'radio'.
// Returns an array containing all radio buttons other than |element| that
// have the same |name|, either in the form that |element| belongs to or,
// if no form, in the document tree to which |element| belongs.
//
// This implementation is based upon the HTML spec definition of a
// "radio button group":
// http://www.whatwg.org/specs/web-apps/current-work/multipage/number-state.html#radio-button-group
//
function getAssociatedRadioButtons(element) {
if (element.form) {
return filter(element.form.elements, function(el) {
return el != element &&
el.tagName == 'INPUT' &&
el.type == 'radio' &&
el.name == element.name;
});
} else {
var treeScope = getTreeScope(element);
if (!treeScope)
return [];
var radios = treeScope.querySelectorAll(
'input[type="radio"][name="' + element.name + '"]');
return filter(radios, function(el) {
return el != element && !el.form;
});
}
}
function checkedPostEvent(input) {
// Only the radio button that is getting checked gets an event. We
// therefore find all the associated radio buttons and update their
// check binding manually.
if (input.tagName === 'INPUT' &&
input.type === 'radio') {
getAssociatedRadioButtons(input).forEach(function(radio) {
var checkedBinding = radio.bindings_.checked;
if (checkedBinding) {
// Set the value directly to avoid an infinite call stack.
checkedBinding.observable_.setValue(false);
}
});
}
}
HTMLInputElement.prototype.bind = function(name, value, oneTime) {
if (name !== 'value' && name !== 'checked')
return HTMLElement.prototype.bind.call(this, name, value, oneTime);
this.removeAttribute(name);
var sanitizeFn = name == 'checked' ? booleanSanitize : sanitizeValue;
var postEventFn = name == 'checked' ? checkedPostEvent : noop;
if (oneTime)
return updateInput(this, name, value, sanitizeFn);
var observable = value;
var binding = bindInputEvent(this, name, observable, postEventFn);
updateInput(this, name,
observable.open(inputBinding(this, name, sanitizeFn)),
sanitizeFn);
// Checkboxes may need to update bindings of other checkboxes.
return updateBindings(this, name, binding);
}
HTMLTextAreaElement.prototype.bind = function(name, value, oneTime) {
if (name !== 'value')
return HTMLElement.prototype.bind.call(this, name, value, oneTime);
this.removeAttribute('value');
if (oneTime)
return updateInput(this, 'value', value);
var observable = value;
var binding = bindInputEvent(this, 'value', observable);
updateInput(this, 'value',
observable.open(inputBinding(this, 'value', sanitizeValue)));
return maybeUpdateBindings(this, name, binding);
}
function updateOption(option, value) {
var parentNode = option.parentNode;;
var select;
var selectBinding;
var oldValue;
if (parentNode instanceof HTMLSelectElement &&
parentNode.bindings_ &&
parentNode.bindings_.value) {
select = parentNode;
selectBinding = select.bindings_.value;
oldValue = select.value;
}
option.value = sanitizeValue(value);
if (select && select.value != oldValue) {
selectBinding.observable_.setValue(select.value);
selectBinding.observable_.discardChanges();
Platform.performMicrotaskCheckpoint();
}
}
function optionBinding(option) {
return function(value) {
updateOption(option, value);
}
}
HTMLOptionElement.prototype.bind = function(name, value, oneTime) {
if (name !== 'value')
return HTMLElement.prototype.bind.call(this, name, value, oneTime);
this.removeAttribute('value');
if (oneTime)
return updateOption(this, value);
var observable = value;
var binding = bindInputEvent(this, 'value', observable);
updateOption(this, observable.open(optionBinding(this)));
return maybeUpdateBindings(this, name, binding);
}
HTMLSelectElement.prototype.bind = function(name, value, oneTime) {
if (name === 'selectedindex')
name = 'selectedIndex';
if (name !== 'selectedIndex' && name !== 'value')
return HTMLElement.prototype.bind.call(this, name, value, oneTime);
this.removeAttribute(name);
if (oneTime)
return updateInput(this, name, value);
var observable = value;
var binding = bindInputEvent(this, name, observable);
updateInput(this, name,
observable.open(inputBinding(this, name)));
// Option update events may need to access select bindings.
return updateBindings(this, name, binding);
}
})(this);
// Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
// This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
// The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
// The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
// Code distributed by Google as part of the polymer project is also
// subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
(function(global) {
'use strict';
function assert(v) {
if (!v)
throw new Error('Assertion failed');
}
var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
function getFragmentRoot(node) {
var p;
while (p = node.parentNode) {
node = p;
}
return node;
}
function searchRefId(node, id) {
if (!id)
return;
var ref;
var selector = '#' + id;
while (!ref) {
node = getFragmentRoot(node);
if (node.protoContent_)
ref = node.protoContent_.querySelector(selector);
else if (node.getElementById)
ref = node.getElementById(id);
if (ref || !node.templateCreator_)
break
node = node.templateCreator_;
}
return ref;
}
function getInstanceRoot(node) {
while (node.parentNode) {
node = node.parentNode;
}
return node.templateCreator_ ? node : null;
}
var Map;
if (global.Map && typeof global.Map.prototype.forEach === 'function') {
Map = global.Map;
} else {
Map = function() {
this.keys = [];
this.values = [];
};
Map.prototype = {
set: function(key, value) {
var index = this.keys.indexOf(key);
if (index < 0) {
this.keys.push(key);
this.values.push(value);
} else {
this.values[index] = value;
}
},
get: function(key) {
var index = this.keys.indexOf(key);
if (index < 0)
return;
return this.values[index];
},
delete: function(key, value) {
var index = this.keys.indexOf(key);
if (index < 0)
return false;
this.keys.splice(index, 1);
this.values.splice(index, 1);
return true;
},
forEach: function(f, opt_this) {
for (var i = 0; i < this.keys.length; i++)
f.call(opt_this || this, this.values[i], this.keys[i], this);
}
};
}
// JScript does not have __proto__. We wrap all object literals with
// createObject which uses Object.create, Object.defineProperty and
// Object.getOwnPropertyDescriptor to create a new object that does the exact
// same thing. The main downside to this solution is that we have to extract
// all those property descriptors for IE.
var createObject = ('__proto__' in {}) ?
function(obj) { return obj; } :
function(obj) {
var proto = obj.__proto__;
if (!proto)
return obj;
var newObject = Object.create(proto);
Object.getOwnPropertyNames(obj).forEach(function(name) {
Object.defineProperty(newObject, name,
Object.getOwnPropertyDescriptor(obj, name));
});
return newObject;
};
// IE does not support have Document.prototype.contains.
if (typeof document.contains != 'function') {
Document.prototype.contains = function(node) {
if (node === this || node.parentNode === this)
return true;
return this.documentElement.contains(node);
}
}
var BIND = 'bind';
var REPEAT = 'repeat';
var IF = 'if';
var templateAttributeDirectives = {
'template': true,
'repeat': true,
'bind': true,
'ref': true,
'if': true
};
var semanticTemplateElements = {
'THEAD': true,
'TBODY': true,
'TFOOT': true,
'TH': true,
'TR': true,
'TD': true,
'COLGROUP': true,
'COL': true,
'CAPTION': true,
'OPTION': true,
'OPTGROUP': true
};
var hasTemplateElement = typeof HTMLTemplateElement !== 'undefined';
if (hasTemplateElement) {
// TODO(rafaelw): Remove when fix for
// https://codereview.chromium.org/164803002/
// makes it to Chrome release.
(function() {
var t = document.createElement('template');
var d = t.content.ownerDocument;
var html = d.appendChild(d.createElement('html'));
var head = html.appendChild(d.createElement('head'));
var base = d.createElement('base');
base.href = document.baseURI;
head.appendChild(base);
})();
}
var allTemplatesSelectors = 'template, ' +
Object.keys(semanticTemplateElements).map(function(tagName) {
return tagName.toLowerCase() + '[template]';
}).join(', ');
function isSVGTemplate(el) {
return el.tagName == 'template' &&
el.namespaceURI == 'http://www.w3.org/2000/svg';
}
function isHTMLTemplate(el) {
return el.tagName == 'TEMPLATE' &&
el.namespaceURI == 'http://www.w3.org/1999/xhtml';
}
function isAttributeTemplate(el) {
return Boolean(semanticTemplateElements[el.tagName] &&
el.hasAttribute('template'));
}
function isTemplate(el) {
if (el.isTemplate_ === undefined)
el.isTemplate_ = el.tagName == 'TEMPLATE' || isAttributeTemplate(el);
return el.isTemplate_;
}
// FIXME: Observe templates being added/removed from documents
// FIXME: Expose imperative API to decorate and observe templates in
// "disconnected tress" (e.g. ShadowRoot)
document.addEventListener('DOMContentLoaded', function(e) {
bootstrapTemplatesRecursivelyFrom(document);
// FIXME: Is this needed? Seems like it shouldn't be.
Platform.performMicrotaskCheckpoint();
}, false);
function forAllTemplatesFrom(node, fn) {
var subTemplates = node.querySelectorAll(allTemplatesSelectors);
if (isTemplate(node))
fn(node)
forEach(subTemplates, fn);
}
function bootstrapTemplatesRecursivelyFrom(node) {
function bootstrap(template) {
if (!HTMLTemplateElement.decorate(template))
bootstrapTemplatesRecursivelyFrom(template.content);
}
forAllTemplatesFrom(node, bootstrap);
}
if (!hasTemplateElement) {
/**
* This represents a <template> element.
* @constructor
* @extends {HTMLElement}
*/
global.HTMLTemplateElement = function() {
throw TypeError('Illegal constructor');
};
}
var hasProto = '__proto__' in {};
function mixin(to, from) {
Object.getOwnPropertyNames(from).forEach(function(name) {
Object.defineProperty(to, name,
Object.getOwnPropertyDescriptor(from, name));
});
}
// http://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/templates/index.html#dfn-template-contents-owner
function getOrCreateTemplateContentsOwner(template) {
var doc = template.ownerDocument
if (!doc.defaultView)
return doc;
var d = doc.templateContentsOwner_;
if (!d) {
// TODO(arv): This should either be a Document or HTMLDocument depending
// on doc.
d = doc.implementation.createHTMLDocument('');
while (d.lastChild) {
d.removeChild(d.lastChild);
}
doc.templateContentsOwner_ = d;
}
return d;
}
function getTemplateStagingDocument(template) {
if (!template.stagingDocument_) {
var owner = template.ownerDocument;
if (!owner.stagingDocument_) {
owner.stagingDocument_ = owner.implementation.createHTMLDocument('');
owner.stagingDocument_.isStagingDocument = true;
// TODO(rafaelw): Remove when fix for
// https://codereview.chromium.org/164803002/
// makes it to Chrome release.
var base = owner.stagingDocument_.createElement('base');
base.href = document.baseURI;
owner.stagingDocument_.head.appendChild(base);
owner.stagingDocument_.stagingDocument_ = owner.stagingDocument_;
}
template.stagingDocument_ = owner.stagingDocument_;
}
return template.stagingDocument_;
}
// For non-template browsers, the parser will disallow <template> in certain
// locations, so we allow "attribute templates" which combine the template
// element with the top-level container node of the content, e.g.
//
// <tr template repeat="{{ foo }}"" class="bar"><td>Bar</td></tr>
//
// becomes
//
// <template repeat="{{ foo }}">
// + #document-fragment
// + <tr class="bar">
// + <td>Bar</td>
//
function extractTemplateFromAttributeTemplate(el) {
var template = el.ownerDocument.createElement('template');
el.parentNode.insertBefore(template, el);
var attribs = el.attributes;
var count = attribs.length;
while (count-- > 0) {
var attrib = attribs[count];
if (templateAttributeDirectives[attrib.name]) {
if (attrib.name !== 'template')
template.setAttribute(attrib.name, attrib.value);
el.removeAttribute(attrib.name);
}
}
return template;
}
function extractTemplateFromSVGTemplate(el) {
var template = el.ownerDocument.createElement('template');
el.parentNode.insertBefore(template, el);
var attribs = el.attributes;
var count = attribs.length;
while (count-- > 0) {
var attrib = attribs[count];
template.setAttribute(attrib.name, attrib.value);
el.removeAttribute(attrib.name);
}
el.parentNode.removeChild(el);
return template;
}
function liftNonNativeTemplateChildrenIntoContent(template, el, useRoot) {
var content = template.content;
if (useRoot) {
content.appendChild(el);
return;
}
var child;
while (child = el.firstChild) {
content.appendChild(child);
}
}
var templateObserver;
if (typeof MutationObserver == 'function') {
templateObserver = new MutationObserver(function(records) {
for (var i = 0; i < records.length; i++) {
records[i].target.refChanged_();
}
});
}
/**
* Ensures proper API and content model for template elements.
* @param {HTMLTemplateElement} opt_instanceRef The template element which
* |el| template element will return as the value of its ref(), and whose
* content will be used as source when createInstance() is invoked.
*/
HTMLTemplateElement.decorate = function(el, opt_instanceRef) {
if (el.templateIsDecorated_)
return false;
var templateElement = el;
templateElement.templateIsDecorated_ = true;
var isNativeHTMLTemplate = isHTMLTemplate(templateElement) &&
hasTemplateElement;
var bootstrapContents = isNativeHTMLTemplate;
var liftContents = !isNativeHTMLTemplate;
var liftRoot = false;
if (!isNativeHTMLTemplate) {
if (isAttributeTemplate(templateElement)) {
assert(!opt_instanceRef);
templateElement = extractTemplateFromAttributeTemplate(el);
templateElement.templateIsDecorated_ = true;
isNativeHTMLTemplate = hasTemplateElement;
liftRoot = true;
} else if (isSVGTemplate(templateElement)) {
templateElement = extractTemplateFromSVGTemplate(el);
templateElement.templateIsDecorated_ = true;
isNativeHTMLTemplate = hasTemplateElement;
}
}
if (!isNativeHTMLTemplate) {
fixTemplateElementPrototype(templateElement);
var doc = getOrCreateTemplateContentsOwner(templateElement);
templateElement.content_ = doc.createDocumentFragment();
}
if (opt_instanceRef) {
// template is contained within an instance, its direct content must be
// empty
templateElement.instanceRef_ = opt_instanceRef;
} else if (liftContents) {
liftNonNativeTemplateChildrenIntoContent(templateElement,
el,
liftRoot);
} else if (bootstrapContents) {
bootstrapTemplatesRecursivelyFrom(templateElement.content);
}
return true;
};
// TODO(rafaelw): This used to decorate recursively all templates from a given
// node. This happens by default on 'DOMContentLoaded', but may be needed
// in subtrees not descendent from document (e.g. ShadowRoot).
// Review whether this is the right public API.
HTMLTemplateElement.bootstrap = bootstrapTemplatesRecursivelyFrom;
var htmlElement = global.HTMLUnknownElement || HTMLElement;
var contentDescriptor = {
get: function() {
return this.content_;
},
enumerable: true,
configurable: true
};
if (!hasTemplateElement) {
// Gecko is more picky with the prototype than WebKit. Make sure to use the
// same prototype as created in the constructor.
HTMLTemplateElement.prototype = Object.create(htmlElement.prototype);
Object.defineProperty(HTMLTemplateElement.prototype, 'content',
contentDescriptor);
}
function fixTemplateElementPrototype(el) {
if (hasProto)
el.__proto__ = HTMLTemplateElement.prototype;
else
mixin(el, HTMLTemplateElement.prototype);
}
function ensureSetModelScheduled(template) {
if (!template.setModelFn_) {
template.setModelFn_ = function() {
template.setModelFnScheduled_ = false;
var map = getBindings(template,
template.delegate_ && template.delegate_.prepareBinding);
processBindings(template, map, template.model_);
};
}
if (!template.setModelFnScheduled_) {
template.setModelFnScheduled_ = true;
Observer.runEOM_(template.setModelFn_);
}
}
mixin(HTMLTemplateElement.prototype, {
bind: function(name, value, oneTime) {
if (name != 'ref')
return Element.prototype.bind.call(this, name, value, oneTime);
var self = this;
var ref = oneTime ? value : value.open(function(ref) {
self.setAttribute('ref', ref);
self.refChanged_();
});
this.setAttribute('ref', ref);
this.refChanged_();
if (oneTime)
return;
if (!this.bindings_) {
this.bindings_ = { ref: value };
} else {
this.bindings_.ref = value;
}
return value;
},
processBindingDirectives_: function(directives) {
if (this.iterator_)
this.iterator_.closeDeps();
if (!directives.if && !directives.bind && !directives.repeat) {
if (this.iterator_) {
this.iterator_.close();
this.iterator_ = undefined;
}
return;
}
if (!this.iterator_) {
this.iterator_ = new TemplateIterator(this);
}
this.iterator_.updateDependencies(directives, this.model_);
if (templateObserver) {
templateObserver.observe(this, { attributes: true,
attributeFilter: ['ref'] });
}
return this.iterator_;
},
createInstance: function(model, bindingDelegate, delegate_) {
if (bindingDelegate)
delegate_ = this.newDelegate_(bindingDelegate);
else if (!delegate_)
delegate_ = this.delegate_;
if (!this.refContent_)
this.refContent_ = this.ref_.content;
var content = this.refContent_;
if (content.firstChild === null)
return emptyInstance;
var map = getInstanceBindingMap(content, delegate_);
var stagingDocument = getTemplateStagingDocument(this);
var instance = stagingDocument.createDocumentFragment();
instance.templateCreator_ = this;
instance.protoContent_ = content;
instance.bindings_ = [];
instance.terminator_ = null;
var instanceRecord = instance.templateInstance_ = {
firstNode: null,
lastNode: null,
model: model
};
var i = 0;
var collectTerminator = false;
for (var child = content.firstChild; child; child = child.nextSibling) {
// The terminator of the instance is the clone of the last child of the
// content. If the last child is an active template, it may produce
// instances as a result of production, so simply collecting the last
// child of the instance after it has finished producing may be wrong.
if (child.nextSibling === null)
collectTerminator = true;
var clone = cloneAndBindInstance(child, instance, stagingDocument,
map.children[i++],
model,
delegate_,
instance.bindings_);
clone.templateInstance_ = instanceRecord;
if (collectTerminator)
instance.terminator_ = clone;
}
instanceRecord.firstNode = instance.firstChild;
instanceRecord.lastNode = instance.lastChild;
instance.templateCreator_ = undefined;
instance.protoContent_ = undefined;
return instance;
},
get model() {
return this.model_;
},
set model(model) {
this.model_ = model;
ensureSetModelScheduled(this);
},
get bindingDelegate() {
return this.delegate_ && this.delegate_.raw;
},
refChanged_: function() {
if (!this.iterator_ || this.refContent_ === this.ref_.content)
return;
this.refContent_ = undefined;
this.iterator_.valueChanged();
this.iterator_.updateIteratedValue(this.iterator_.getUpdatedValue());
},
clear: function() {
this.model_ = undefined;
this.delegate_ = undefined;
if (this.bindings_ && this.bindings_.ref)
this.bindings_.ref.close()
this.refContent_ = undefined;
if (!this.iterator_)
return;
this.iterator_.valueChanged();
this.iterator_.close()
this.iterator_ = undefined;
},
setDelegate_: function(delegate) {
this.delegate_ = delegate;
this.bindingMap_ = undefined;
if (this.iterator_) {
this.iterator_.instancePositionChangedFn_ = undefined;
this.iterator_.instanceModelFn_ = undefined;
}
},
newDelegate_: function(bindingDelegate) {
if (!bindingDelegate)
return;
function delegateFn(name) {
var fn = bindingDelegate && bindingDelegate[name];
if (typeof fn != 'function')
return;
return function() {
return fn.apply(bindingDelegate, arguments);
};
}
return {
bindingMaps: {},
raw: bindingDelegate,
prepareBinding: delegateFn('prepareBinding'),
prepareInstanceModel: delegateFn('prepareInstanceModel'),
prepareInstancePositionChanged:
delegateFn('prepareInstancePositionChanged')
};
},
set bindingDelegate(bindingDelegate) {
if (this.delegate_) {
throw Error('Template must be cleared before a new bindingDelegate ' +
'can be assigned');
}
this.setDelegate_(this.newDelegate_(bindingDelegate));
},
get ref_() {
var ref = searchRefId(this, this.getAttribute('ref'));
if (!ref)
ref = this.instanceRef_;
if (!ref)
return this;
var nextRef = ref.ref_;
return nextRef ? nextRef : ref;
}
});
// Returns
// a) undefined if there are no mustaches.
// b) [TEXT, (ONE_TIME?, PATH, DELEGATE_FN, TEXT)+] if there is at least one mustache.
function parseMustaches(s, name, node, prepareBindingFn) {
if (!s || !s.length)
return;
var tokens;
var length = s.length;
var startIndex = 0, lastIndex = 0, endIndex = 0;
var onlyOneTime = true;
while (lastIndex < length) {
var startIndex = s.indexOf('{{', lastIndex);
var oneTimeStart = s.indexOf('[[', lastIndex);
var oneTime = false;
var terminator = '}}';
if (oneTimeStart >= 0 &&
(startIndex < 0 || oneTimeStart < startIndex)) {
startIndex = oneTimeStart;
oneTime = true;
terminator = ']]';
}
endIndex = startIndex < 0 ? -1 : s.indexOf(terminator, startIndex + 2);
if (endIndex < 0) {
if (!tokens)
return;
tokens.push(s.slice(lastIndex)); // TEXT
break;
}
tokens = tokens || [];
tokens.push(s.slice(lastIndex, startIndex)); // TEXT
var pathString = s.slice(startIndex + 2, endIndex).trim();
tokens.push(oneTime); // ONE_TIME?
onlyOneTime = onlyOneTime && oneTime;
var delegateFn = prepareBindingFn &&
prepareBindingFn(pathString, name, node);
// Don't try to parse the expression if there's a prepareBinding function
if (delegateFn == null) {
tokens.push(Path.get(pathString)); // PATH
} else {
tokens.push(null);
}
tokens.push(delegateFn); // DELEGATE_FN
lastIndex = endIndex + 2;
}
if (lastIndex === length)
tokens.push(''); // TEXT
tokens.hasOnePath = tokens.length === 5;
tokens.isSimplePath = tokens.hasOnePath &&
tokens[0] == '' &&
tokens[4] == '';
tokens.onlyOneTime = onlyOneTime;
tokens.combinator = function(values) {
var newValue = tokens[0];
for (var i = 1; i < tokens.length; i += 4) {
var value = tokens.hasOnePath ? values : values[(i - 1) / 4];
if (value !== undefined)
newValue += value;
newValue += tokens[i + 3];
}
return newValue;
}
return tokens;
};
function processOneTimeBinding(name, tokens, node, model) {
if (tokens.hasOnePath) {
var delegateFn = tokens[3];
var value = delegateFn ? delegateFn(model, node, true) :
tokens[2].getValueFrom(model);
return tokens.isSimplePath ? value : tokens.combinator(value);
}
var values = [];
for (var i = 1; i < tokens.length; i += 4) {
var delegateFn = tokens[i + 2];
values[(i - 1) / 4] = delegateFn ? delegateFn(model, node) :
tokens[i + 1].getValueFrom(model);
}
return tokens.combinator(values);
}
function processSinglePathBinding(name, tokens, node, model) {
var delegateFn = tokens[3];
var observer = delegateFn ? delegateFn(model, node, false) :
new PathObserver(model, tokens[2]);
return tokens.isSimplePath ? observer :
new ObserverTransform(observer, tokens.combinator);
}
function processBinding(name, tokens, node, model) {
if (tokens.onlyOneTime)
return processOneTimeBinding(name, tokens, node, model);
if (tokens.hasOnePath)
return processSinglePathBinding(name, tokens, node, model);
var observer = new CompoundObserver();
for (var i = 1; i < tokens.length; i += 4) {
var oneTime = tokens[i];
var delegateFn = tokens[i + 2];
if (delegateFn) {
var value = delegateFn(model, node, oneTime);
if (oneTime)
observer.addPath(value)
else
observer.addObserver(value);
continue;
}
var path = tokens[i + 1];
if (oneTime)
observer.addPath(path.getValueFrom(model))
else
observer.addPath(model, path);
}
return new ObserverTransform(observer, tokens.combinator);
}
function processBindings(node, bindings, model, instanceBindings) {
for (var i = 0; i < bindings.length; i += 2) {
var name = bindings[i]
var tokens = bindings[i + 1];
var value = processBinding(name, tokens, node, model);
var binding = node.bind(name, value, tokens.onlyOneTime);
if (binding && instanceBindings)
instanceBindings.push(binding);
}
node.bindFinished();
if (!bindings.isTemplate)
return;
node.model_ = model;
var iter = node.processBindingDirectives_(bindings);
if (instanceBindings && iter)
instanceBindings.push(iter);
}
function parseWithDefault(el, name, prepareBindingFn) {
var v = el.getAttribute(name);
return parseMustaches(v == '' ? '{{}}' : v, name, el, prepareBindingFn);
}
function parseAttributeBindings(element, prepareBindingFn) {
assert(element);
var bindings = [];
var ifFound = false;
var bindFound = false;
for (var i = 0; i < element.attributes.length; i++) {
var attr = element.attributes[i];
var name = attr.name;
var value = attr.value;
// Allow bindings expressed in attributes to be prefixed with underbars.
// We do this to allow correct semantics for browsers that don't implement
// <template> where certain attributes might trigger side-effects -- and
// for IE which sanitizes certain attributes, disallowing mustache
// replacements in their text.
while (name[0] === '_') {
name = name.substring(1);
}
if (isTemplate(element) &&
(name === IF || name === BIND || name === REPEAT)) {
continue;
}
var tokens = parseMustaches(value, name, element,
prepareBindingFn);
if (!tokens)
continue;
bindings.push(name, tokens);
}
if (isTemplate(element)) {
bindings.isTemplate = true;
bindings.if = parseWithDefault(element, IF, prepareBindingFn);
bindings.bind = parseWithDefault(element, BIND, prepareBindingFn);
bindings.repeat = parseWithDefault(element, REPEAT, prepareBindingFn);
if (bindings.if && !bindings.bind && !bindings.repeat)
bindings.bind = parseMustaches('{{}}', BIND, element, prepareBindingFn);
}
return bindings;
}
function getBindings(node, prepareBindingFn) {
if (node.nodeType === Node.ELEMENT_NODE)
return parseAttributeBindings(node, prepareBindingFn);
if (node.nodeType === Node.TEXT_NODE) {
var tokens = parseMustaches(node.data, 'textContent', node,
prepareBindingFn);
if (tokens)
return ['textContent', tokens];
}
return [];
}
function cloneAndBindInstance(node, parent, stagingDocument, bindings, model,
delegate,
instanceBindings,
instanceRecord) {
var clone = parent.appendChild(stagingDocument.importNode(node, false));
var i = 0;
for (var child = node.firstChild; child; child = child.nextSibling) {
cloneAndBindInstance(child, clone, stagingDocument,
bindings.children[i++],
model,
delegate,
instanceBindings);
}
if (bindings.isTemplate) {
HTMLTemplateElement.decorate(clone, node);
if (delegate)
clone.setDelegate_(delegate);
}
processBindings(clone, bindings, model, instanceBindings);
return clone;
}
function createInstanceBindingMap(node, prepareBindingFn) {
var map = getBindings(node, prepareBindingFn);
map.children = {};
var index = 0;
for (var child = node.firstChild; child; child = child.nextSibling) {
map.children[index++] = createInstanceBindingMap(child, prepareBindingFn);
}
return map;
}
var contentUidCounter = 1;
// TODO(rafaelw): Setup a MutationObserver on content which clears the id
// so that bindingMaps regenerate when the template.content changes.
function getContentUid(content) {
var id = content.id_;
if (!id)
id = content.id_ = contentUidCounter++;
return id;
}
// Each delegate is associated with a set of bindingMaps, one for each
// content which may be used by a template. The intent is that each binding
// delegate gets the opportunity to prepare the instance (via the prepare*
// delegate calls) once across all uses.
// TODO(rafaelw): Separate out the parse map from the binding map. In the
// current implementation, if two delegates need a binding map for the same
// content, the second will have to reparse.
function getInstanceBindingMap(content, delegate_) {
var contentId = getContentUid(content);
if (delegate_) {
var map = delegate_.bindingMaps[contentId];
if (!map) {
map = delegate_.bindingMaps[contentId] =
createInstanceBindingMap(content, delegate_.prepareBinding) || [];
}
return map;
}
var map = content.bindingMap_;
if (!map) {
map = content.bindingMap_ =
createInstanceBindingMap(content, undefined) || [];
}
return map;
}
Object.defineProperty(Node.prototype, 'templateInstance', {
get: function() {
var instance = this.templateInstance_;
return instance ? instance :
(this.parentNode ? this.parentNode.templateInstance : undefined);
}
});
var emptyInstance = document.createDocumentFragment();
emptyInstance.bindings_ = [];
emptyInstance.terminator_ = null;
function TemplateIterator(templateElement) {
this.closed = false;
this.templateElement_ = templateElement;
this.instances = [];
this.deps = undefined;
this.iteratedValue = [];
this.presentValue = undefined;
this.arrayObserver = undefined;
}
TemplateIterator.prototype = {
closeDeps: function() {
var deps = this.deps;
if (deps) {
if (deps.ifOneTime === false)
deps.ifValue.close();
if (deps.oneTime === false)
deps.value.close();
}
},
updateDependencies: function(directives, model) {
this.closeDeps();
var deps = this.deps = {};
var template = this.templateElement_;
var ifValue = true;
if (directives.if) {
deps.hasIf = true;
deps.ifOneTime = directives.if.onlyOneTime;
deps.ifValue = processBinding(IF, directives.if, template, model);
ifValue = deps.ifValue;
// oneTime if & predicate is false. nothing else to do.
if (deps.ifOneTime && !ifValue) {
this.valueChanged();
return;
}
if (!deps.ifOneTime)
ifValue = ifValue.open(this.updateIfValue, this);
}
if (directives.repeat) {
deps.repeat = true;
deps.oneTime = directives.repeat.onlyOneTime;
deps.value = processBinding(REPEAT, directives.repeat, template, model);
} else {
deps.repeat = false;
deps.oneTime = directives.bind.onlyOneTime;
deps.value = processBinding(BIND, directives.bind, template, model);
}
var value = deps.value;
if (!deps.oneTime)
value = value.open(this.updateIteratedValue, this);
if (!ifValue) {
this.valueChanged();
return;
}
this.updateValue(value);
},
/**
* Gets the updated value of the bind/repeat. This can potentially call
* user code (if a bindingDelegate is set up) so we try to avoid it if we
* already have the value in hand (from Observer.open).
*/
getUpdatedValue: function() {
var value = this.deps.value;
if (!this.deps.oneTime)
value = value.discardChanges();
return value;
},
updateIfValue: function(ifValue) {
if (!ifValue) {
this.valueChanged();
return;
}
this.updateValue(this.getUpdatedValue());
},
updateIteratedValue: function(value) {
if (this.deps.hasIf) {
var ifValue = this.deps.ifValue;
if (!this.deps.ifOneTime)
ifValue = ifValue.discardChanges();
if (!ifValue) {
this.valueChanged();
return;
}
}
this.updateValue(value);
},
updateValue: function(value) {
if (!this.deps.repeat)
value = [value];
var observe = this.deps.repeat &&
!this.deps.oneTime &&
Array.isArray(value);
this.valueChanged(value, observe);
},
valueChanged: function(value, observeValue) {
if (!Array.isArray(value))
value = [];
if (value === this.iteratedValue)
return;
this.unobserve();
this.presentValue = value;
if (observeValue) {
this.arrayObserver = new ArrayObserver(this.presentValue);
this.arrayObserver.open(this.handleSplices, this);
}
this.handleSplices(ArrayObserver.calculateSplices(this.presentValue,
this.iteratedValue));
},
getLastInstanceNode: function(index) {
if (index == -1)
return this.templateElement_;
var instance = this.instances[index];
var terminator = instance.terminator_;
if (!terminator)
return this.getLastInstanceNode(index - 1);
if (terminator.nodeType !== Node.ELEMENT_NODE ||
this.templateElement_ === terminator) {
return terminator;
}
var subtemplateIterator = terminator.iterator_;
if (!subtemplateIterator)
return terminator;
return subtemplateIterator.getLastTemplateNode();
},
getLastTemplateNode: function() {
return this.getLastInstanceNode(this.instances.length - 1);
},
insertInstanceAt: function(index, fragment) {
var previousInstanceLast = this.getLastInstanceNode(index - 1);
var parent = this.templateElement_.parentNode;
this.instances.splice(index, 0, fragment);
parent.insertBefore(fragment, previousInstanceLast.nextSibling);
},
extractInstanceAt: function(index) {
var previousInstanceLast = this.getLastInstanceNode(index - 1);
var lastNode = this.getLastInstanceNode(index);
var parent = this.templateElement_.parentNode;
var instance = this.instances.splice(index, 1)[0];
while (lastNode !== previousInstanceLast) {
var node = previousInstanceLast.nextSibling;
if (node == lastNode)
lastNode = previousInstanceLast;
instance.appendChild(parent.removeChild(node));
}
return instance;
},
getDelegateFn: function(fn) {
fn = fn && fn(this.templateElement_);
return typeof fn === 'function' ? fn : null;
},
handleSplices: function(splices) {
if (this.closed || !splices.length)
return;
var template = this.templateElement_;
if (!template.parentNode) {
this.close();
return;
}
ArrayObserver.applySplices(this.iteratedValue, this.presentValue,
splices);
var delegate = template.delegate_;
if (this.instanceModelFn_ === undefined) {
this.instanceModelFn_ =
this.getDelegateFn(delegate && delegate.prepareInstanceModel);
}
if (this.instancePositionChangedFn_ === undefined) {
this.instancePositionChangedFn_ =
this.getDelegateFn(delegate &&
delegate.prepareInstancePositionChanged);
}
// Instance Removals
var instanceCache = new Map;
var removeDelta = 0;
for (var i = 0; i < splices.length; i++) {
var splice = splices[i];
var removed = splice.removed;
for (var j = 0; j < removed.length; j++) {
var model = removed[j];
var instance = this.extractInstanceAt(splice.index + removeDelta);
if (instance !== emptyInstance) {
instanceCache.set(model, instance);
}
}
removeDelta -= splice.addedCount;
}
// Instance Insertions
for (var i = 0; i < splices.length; i++) {
var splice = splices[i];
var addIndex = splice.index;
for (; addIndex < splice.index + splice.addedCount; addIndex++) {
var model = this.iteratedValue[addIndex];
var instance = instanceCache.get(model);
if (instance) {
instanceCache.delete(model);
} else {
if (this.instanceModelFn_) {
model = this.instanceModelFn_(model);
}
if (model === undefined) {
instance = emptyInstance;
} else {
instance = template.createInstance(model, undefined, delegate);
}
}
this.insertInstanceAt(addIndex, instance);
}
}
instanceCache.forEach(function(instance) {
this.closeInstanceBindings(instance);
}, this);
if (this.instancePositionChangedFn_)
this.reportInstancesMoved(splices);
},
reportInstanceMoved: function(index) {
var instance = this.instances[index];
if (instance === emptyInstance)
return;
this.instancePositionChangedFn_(instance.templateInstance_, index);
},
reportInstancesMoved: function(splices) {
var index = 0;
var offset = 0;
for (var i = 0; i < splices.length; i++) {
var splice = splices[i];
if (offset != 0) {
while (index < splice.index) {
this.reportInstanceMoved(index);
index++;
}
} else {
index = splice.index;
}
while (index < splice.index + splice.addedCount) {
this.reportInstanceMoved(index);
index++;
}
offset += splice.addedCount - splice.removed.length;
}
if (offset == 0)
return;
var length = this.instances.length;
while (index < length) {
this.reportInstanceMoved(index);
index++;
}
},
closeInstanceBindings: function(instance) {
var bindings = instance.bindings_;
for (var i = 0; i < bindings.length; i++) {
bindings[i].close();
}
},
unobserve: function() {
if (!this.arrayObserver)
return;
this.arrayObserver.close();
this.arrayObserver = undefined;
},
close: function() {
if (this.closed)
return;
this.unobserve();
for (var i = 0; i < this.instances.length; i++) {
this.closeInstanceBindings(this.instances[i]);
}
this.instances.length = 0;
this.closeDeps();
this.templateElement_.iterator_ = undefined;
this.closed = true;
}
};
// Polyfill-specific API.
HTMLTemplateElement.forAllTemplatesFrom_ = forAllTemplatesFrom;
})(this);
(function(scope) {
'use strict';
// feature detect for URL constructor
var hasWorkingUrl = false;
if (!scope.forceJURL) {
try {
var u = new URL('b', 'http://a');
u.pathname = 'c%20d';
hasWorkingUrl = u.href === 'http://a/c%20d';
} catch(e) {}
}
if (hasWorkingUrl)
return;
var relative = Object.create(null);
relative['ftp'] = 21;
relative['file'] = 0;
relative['gopher'] = 70;
relative['http'] = 80;
relative['https'] = 443;
relative['ws'] = 80;
relative['wss'] = 443;
var relativePathDotMapping = Object.create(null);
relativePathDotMapping['%2e'] = '.';
relativePathDotMapping['.%2e'] = '..';
relativePathDotMapping['%2e.'] = '..';
relativePathDotMapping['%2e%2e'] = '..';
function isRelativeScheme(scheme) {
return relative[scheme] !== undefined;
}
function invalid() {
clear.call(this);
this._isInvalid = true;
}
function IDNAToASCII(h) {
if ('' == h) {
invalid.call(this)
}
// XXX
return h.toLowerCase()
}
function percentEscape(c) {
var unicode = c.charCodeAt(0);
if (unicode > 0x20 &&
unicode < 0x7F &&
// " # < > ? `
[0x22, 0x23, 0x3C, 0x3E, 0x3F, 0x60].indexOf(unicode) == -1
) {
return c;
}
return encodeURIComponent(c);
}
function percentEscapeQuery(c) {
// XXX This actually needs to encode c using encoding and then
// convert the bytes one-by-one.
var unicode = c.charCodeAt(0);
if (unicode > 0x20 &&
unicode < 0x7F &&
// " # < > ` (do not escape '?')
[0x22, 0x23, 0x3C, 0x3E, 0x60].indexOf(unicode) == -1
) {
return c;
}
return encodeURIComponent(c);
}
var EOF = undefined,
ALPHA = /[a-zA-Z]/,
ALPHANUMERIC = /[a-zA-Z0-9\+\-\.]/;
function parse(input, stateOverride, base) {
function err(message) {
errors.push(message)
}
var state = stateOverride || 'scheme start',
cursor = 0,
buffer = '',
seenAt = false,
seenBracket = false,
errors = [];
loop: while ((input[cursor - 1] != EOF || cursor == 0) && !this._isInvalid) {
var c = input[cursor];
switch (state) {
case 'scheme start':
if (c && ALPHA.test(c)) {
buffer += c.toLowerCase(); // ASCII-safe
state = 'scheme';
} else if (!stateOverride) {
buffer = '';
state = 'no scheme';
continue;
} else {
err('Invalid scheme.');
break loop;
}
break;
case 'scheme':
if (c && ALPHANUMERIC.test(c)) {
buffer += c.toLowerCase(); // ASCII-safe
} else if (':' == c) {
this._scheme = buffer;
buffer = '';
if (stateOverride) {
break loop;
}
if (isRelativeScheme(this._scheme)) {
this._isRelative = true;
}
if ('file' == this._scheme) {
state = 'relative';
} else if (this._isRelative && base && base._scheme == this._scheme) {
state = 'relative or authority';
} else if (this._isRelative) {
state = 'authority first slash';
} else {
state = 'scheme data';
}
} else if (!stateOverride) {
buffer = '';
cursor = 0;
state = 'no scheme';
continue;
} else if (EOF == c) {
break loop;
} else {
err('Code point not allowed in scheme: ' + c)
break loop;
}
break;
case 'scheme data':
if ('?' == c) {
query = '?';
state = 'query';
} else if ('#' == c) {
this._fragment = '#';
state = 'fragment';
} else {
// XXX error handling
if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
this._schemeData += percentEscape(c);
}
}
break;
case 'no scheme':
if (!base || !(isRelativeScheme(base._scheme))) {
err('Missing scheme.');
invalid.call(this);
} else {
state = 'relative';
continue;
}
break;
case 'relative or authority':
if ('/' == c && '/' == input[cursor+1]) {
state = 'authority ignore slashes';
} else {
err('Expected /, got: ' + c);
state = 'relative';
continue
}
break;
case 'relative':
this._isRelative = true;
if ('file' != this._scheme)
this._scheme = base._scheme;
if (EOF == c) {
this._host = base._host;
this._port = base._port;
this._path = base._path.slice();
this._query = base._query;
break loop;
} else if ('/' == c || '\\' == c) {
if ('\\' == c)
err('\\ is an invalid code point.');
state = 'relative slash';
} else if ('?' == c) {
this._host = base._host;
this._port = base._port;
this._path = base._path.slice();
this._query = '?';
state = 'query';
} else if ('#' == c) {
this._host = base._host;
this._port = base._port;
this._path = base._path.slice();
this._query = base._query;
this._fragment = '#';
state = 'fragment';
} else {
var nextC = input[cursor+1]
var nextNextC = input[cursor+2]
if (
'file' != this._scheme || !ALPHA.test(c) ||
(nextC != ':' && nextC != '|') ||
(EOF != nextNextC && '/' != nextNextC && '\\' != nextNextC && '?' != nextNextC && '#' != nextNextC)) {
this._host = base._host;
this._port = base._port;
this._path = base._path.slice();
this._path.pop();
}
state = 'relative path';
continue;
}
break;
case 'relative slash':
if ('/' == c || '\\' == c) {
if ('\\' == c) {
err('\\ is an invalid code point.');
}
if ('file' == this._scheme) {
state = 'file host';
} else {
state = 'authority ignore slashes';
}
} else {
if ('file' != this._scheme) {
this._host = base._host;
this._port = base._port;
}
state = 'relative path';
continue;
}
break;
case 'authority first slash':
if ('/' == c) {
state = 'authority second slash';
} else {
err("Expected '/', got: " + c);
state = 'authority ignore slashes';
continue;
}
break;
case 'authority second slash':
state = 'authority ignore slashes';
if ('/' != c) {
err("Expected '/', got: " + c);
continue;
}
break;
case 'authority ignore slashes':
if ('/' != c && '\\' != c) {
state = 'authority';
continue;
} else {
err('Expected authority, got: ' + c);
}
break;
case 'authority':
if ('@' == c) {
if (seenAt) {
err('@ already seen.');
buffer += '%40';
}
seenAt = true;
for (var i = 0; i < buffer.length; i++) {
var cp = buffer[i];
if ('\t' == cp || '\n' == cp || '\r' == cp) {
err('Invalid whitespace in authority.');
continue;
}
// XXX check URL code points
if (':' == cp && null === this._password) {
this._password = '';
continue;
}
var tempC = percentEscape(cp);
(null !== this._password) ? this._password += tempC : this._username += tempC;
}
buffer = '';
} else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
cursor -= buffer.length;
buffer = '';
state = 'host';
continue;
} else {
buffer += c;
}
break;
case 'file host':
if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
if (buffer.length == 2 && ALPHA.test(buffer[0]) && (buffer[1] == ':' || buffer[1] == '|')) {
state = 'relative path';
} else if (buffer.length == 0) {
state = 'relative path start';
} else {
this._host = IDNAToASCII.call(this, buffer);
buffer = '';
state = 'relative path start';
}
continue;
} else if ('\t' == c || '\n' == c || '\r' == c) {
err('Invalid whitespace in file host.');
} else {
buffer += c;
}
break;
case 'host':
case 'hostname':
if (':' == c && !seenBracket) {
// XXX host parsing
this._host = IDNAToASCII.call(this, buffer);
buffer = '';
state = 'port';
if ('hostname' == stateOverride) {
break loop;
}
} else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c) {
this._host = IDNAToASCII.call(this, buffer);
buffer = '';
state = 'relative path start';
if (stateOverride) {
break loop;
}
continue;
} else if ('\t' != c && '\n' != c && '\r' != c) {
if ('[' == c) {
seenBracket = true;
} else if (']' == c) {
seenBracket = false;
}
buffer += c;
} else {
err('Invalid code point in host/hostname: ' + c);
}
break;
case 'port':
if (/[0-9]/.test(c)) {
buffer += c;
} else if (EOF == c || '/' == c || '\\' == c || '?' == c || '#' == c || stateOverride) {
if ('' != buffer) {
var temp = parseInt(buffer, 10);
if (temp != relative[this._scheme]) {
this._port = temp + '';
}
buffer = '';
}
if (stateOverride) {
break loop;
}
state = 'relative path start';
continue;
} else if ('\t' == c || '\n' == c || '\r' == c) {
err('Invalid code point in port: ' + c);
} else {
invalid.call(this);
}
break;
case 'relative path start':
if ('\\' == c)
err("'\\' not allowed in path.");
state = 'relative path';
if ('/' != c && '\\' != c) {
continue;
}
break;
case 'relative path':
if (EOF == c || '/' == c || '\\' == c || (!stateOverride && ('?' == c || '#' == c))) {
if ('\\' == c) {
err('\\ not allowed in relative path.');
}
var tmp;
if (tmp = relativePathDotMapping[buffer.toLowerCase()]) {
buffer = tmp;
}
if ('..' == buffer) {
this._path.pop();
if ('/' != c && '\\' != c) {
this._path.push('');
}
} else if ('.' == buffer && '/' != c && '\\' != c) {
this._path.push('');
} else if ('.' != buffer) {
if ('file' == this._scheme && this._path.length == 0 && buffer.length == 2 && ALPHA.test(buffer[0]) && buffer[1] == '|') {
buffer = buffer[0] + ':';
}
this._path.push(buffer);
}
buffer = '';
if ('?' == c) {
this._query = '?';
state = 'query';
} else if ('#' == c) {
this._fragment = '#';
state = 'fragment';
}
} else if ('\t' != c && '\n' != c && '\r' != c) {
buffer += percentEscape(c);
}
break;
case 'query':
if (!stateOverride && '#' == c) {
this._fragment = '#';
state = 'fragment';
} else if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
this._query += percentEscapeQuery(c);
}
break;
case 'fragment':
if (EOF != c && '\t' != c && '\n' != c && '\r' != c) {
this._fragment += c;
}
break;
}
cursor++;
}
}
function clear() {
this._scheme = '';
this._schemeData = '';
this._username = '';
this._password = null;
this._host = '';
this._port = '';
this._path = [];
this._query = '';
this._fragment = '';
this._isInvalid = false;
this._isRelative = false;
}
// Does not process domain names or IP addresses.
// Does not handle encoding for the query parameter.
function jURL(url, base /* , encoding */) {
if (base !== undefined && !(base instanceof jURL))
base = new jURL(String(base));
this._url = url;
clear.call(this);
var input = url.replace(/^[ \t\r\n\f]+|[ \t\r\n\f]+$/g, '');
// encoding = encoding || 'utf-8'
parse.call(this, input, null, base);
}
jURL.prototype = {
get href() {
if (this._isInvalid)
return this._url;
var authority = '';
if ('' != this._username || null != this._password) {
authority = this._username +
(null != this._password ? ':' + this._password : '') + '@';
}
return this.protocol +
(this._isRelative ? '//' + authority + this.host : '') +
this.pathname + this._query + this._fragment;
},
set href(href) {
clear.call(this);
parse.call(this, href);
},
get protocol() {
return this._scheme + ':';
},
set protocol(protocol) {
if (this._isInvalid)
return;
parse.call(this, protocol + ':', 'scheme start');
},
get host() {
return this._isInvalid ? '' : this._port ?
this._host + ':' + this._port : this._host;
},
set host(host) {
if (this._isInvalid || !this._isRelative)
return;
parse.call(this, host, 'host');
},
get hostname() {
return this._host;
},
set hostname(hostname) {
if (this._isInvalid || !this._isRelative)
return;
parse.call(this, hostname, 'hostname');
},
get port() {
return this._port;
},
set port(port) {
if (this._isInvalid || !this._isRelative)
return;
parse.call(this, port, 'port');
},
get pathname() {
return this._isInvalid ? '' : this._isRelative ?
'/' + this._path.join('/') : this._schemeData;
},
set pathname(pathname) {
if (this._isInvalid || !this._isRelative)
return;
this._path = [];
parse.call(this, pathname, 'relative path start');
},
get search() {
return this._isInvalid || !this._query || '?' == this._query ?
'' : this._query;
},
set search(search) {
if (this._isInvalid || !this._isRelative)
return;
this._query = '?';
if ('?' == search[0])
search = search.slice(1);
parse.call(this, search, 'query');
},
get hash() {
return this._isInvalid || !this._fragment || '#' == this._fragment ?
'' : this._fragment;
},
set hash(hash) {
if (this._isInvalid)
return;
this._fragment = '#';
if ('#' == hash[0])
hash = hash.slice(1);
parse.call(this, hash, 'fragment');
},
get origin() {
var host;
if (this._isInvalid || !this._scheme) {
return '';
}
// javascript: Gecko returns String(""), WebKit/Blink String("null")
// Gecko throws error for "data://"
// data: Gecko returns "", Blink returns "data://", WebKit returns "null"
// Gecko returns String("") for file: mailto:
// WebKit/Blink returns String("SCHEME://") for file: mailto:
switch (this._scheme) {
case 'data':
case 'file':
case 'javascript':
case 'mailto':
return 'null';
}
host = this.host;
if (!host) {
return '';
}
return this._scheme + '://' + host;
}
};
// Copy over the static methods
var OriginalURL = scope.URL;
if (OriginalURL) {
jURL.createObjectURL = function(blob) {
// IE extension allows a second optional options argument.
// http://msdn.microsoft.com/en-us/library/ie/hh772302(v=vs.85).aspx
return OriginalURL.createObjectURL.apply(OriginalURL, arguments);
};
jURL.revokeObjectURL = function(url) {
OriginalURL.revokeObjectURL(url);
};
}
scope.URL = jURL;
})(this);
(function(scope) {
var iterations = 0;
var callbacks = [];
var twiddle = document.createTextNode('');
function endOfMicrotask(callback) {
twiddle.textContent = iterations++;
callbacks.push(callback);
}
function atEndOfMicrotask() {
while (callbacks.length) {
callbacks.shift()();
}
}
new (window.MutationObserver || JsMutationObserver)(atEndOfMicrotask)
.observe(twiddle, {characterData: true})
;
// exports
scope.endOfMicrotask = endOfMicrotask;
// bc
Platform.endOfMicrotask = endOfMicrotask;
})(Polymer);
(function(scope) {
/**
* @class Polymer
*/
// imports
var endOfMicrotask = scope.endOfMicrotask;
// logging
var log = window.WebComponents ? WebComponents.flags.log : {};
// inject style sheet
var style = document.createElement('style');
style.textContent = 'template {display: none !important;} /* injected by platform.js */';
var head = document.querySelector('head');
head.insertBefore(style, head.firstChild);
/**
* Force any pending data changes to be observed before
* the next task. Data changes are processed asynchronously but are guaranteed
* to be processed, for example, before painting. This method should rarely be
* needed. It does nothing when Object.observe is available;
* when Object.observe is not available, Polymer automatically flushes data
* changes approximately every 1/10 second.
* Therefore, `flush` should only be used when a data mutation should be
* observed sooner than this.
*
* @method flush
*/
// flush (with logging)
var flushing;
function flush() {
if (!flushing) {
flushing = true;
endOfMicrotask(function() {
flushing = false;
log.data && console.group('flush');
Platform.performMicrotaskCheckpoint();
log.data && console.groupEnd();
});
}
};
// polling dirty checker
// flush periodically if platform does not have object observe.
if (!Observer.hasObjectObserve) {
var FLUSH_POLL_INTERVAL = 125;
window.addEventListener('WebComponentsReady', function() {
flush();
// watch document visiblity to toggle dirty-checking
var visibilityHandler = function() {
// only flush if the page is visibile
if (document.visibilityState === 'hidden') {
if (scope.flushPoll) {
clearInterval(scope.flushPoll);
}
} else {
scope.flushPoll = setInterval(flush, FLUSH_POLL_INTERVAL);
}
};
if (typeof document.visibilityState === 'string') {
document.addEventListener('visibilitychange', visibilityHandler);
}
visibilityHandler();
});
} else {
// make flush a no-op when we have Object.observe
flush = function() {};
}
if (window.CustomElements && !CustomElements.useNative) {
var originalImportNode = Document.prototype.importNode;
Document.prototype.importNode = function(node, deep) {
var imported = originalImportNode.call(this, node, deep);
CustomElements.upgradeAll(imported);
return imported;
};
}
// exports
scope.flush = flush;
// bc
Platform.flush = flush;
})(window.Polymer);
(function(scope) {
var urlResolver = {
resolveDom: function(root, url) {
url = url || baseUrl(root);
this.resolveAttributes(root, url);
this.resolveStyles(root, url);
// handle template.content
var templates = root.querySelectorAll('template');
if (templates) {
for (var i = 0, l = templates.length, t; (i < l) && (t = templates[i]); i++) {
if (t.content) {
this.resolveDom(t.content, url);
}
}
}
},
resolveTemplate: function(template) {
this.resolveDom(template.content, baseUrl(template));
},
resolveStyles: function(root, url) {
var styles = root.querySelectorAll('style');
if (styles) {
for (var i = 0, l = styles.length, s; (i < l) && (s = styles[i]); i++) {
this.resolveStyle(s, url);
}
}
},
resolveStyle: function(style, url) {
url = url || baseUrl(style);
style.textContent = this.resolveCssText(style.textContent, url);
},
resolveCssText: function(cssText, baseUrl, keepAbsolute) {
cssText = replaceUrlsInCssText(cssText, baseUrl, keepAbsolute, CSS_URL_REGEXP);
return replaceUrlsInCssText(cssText, baseUrl, keepAbsolute, CSS_IMPORT_REGEXP);
},
resolveAttributes: function(root, url) {
if (root.hasAttributes && root.hasAttributes()) {
this.resolveElementAttributes(root, url);
}
// search for attributes that host urls
var nodes = root && root.querySelectorAll(URL_ATTRS_SELECTOR);
if (nodes) {
for (var i = 0, l = nodes.length, n; (i < l) && (n = nodes[i]); i++) {
this.resolveElementAttributes(n, url);
}
}
},
resolveElementAttributes: function(node, url) {
url = url || baseUrl(node);
URL_ATTRS.forEach(function(v) {
var attr = node.attributes[v];
var value = attr && attr.value;
var replacement;
if (value && value.search(URL_TEMPLATE_SEARCH) < 0) {
if (v === 'style') {
replacement = replaceUrlsInCssText(value, url, false, CSS_URL_REGEXP);
} else {
replacement = resolveRelativeUrl(url, value);
}
attr.value = replacement;
}
});
}
};
var CSS_URL_REGEXP = /(url\()([^)]*)(\))/g;
var CSS_IMPORT_REGEXP = /(@import[\s]+(?!url\())([^;]*)(;)/g;
var URL_ATTRS = ['href', 'src', 'action', 'style', 'url'];
var URL_ATTRS_SELECTOR = '[' + URL_ATTRS.join('],[') + ']';
var URL_TEMPLATE_SEARCH = '{{.*}}';
var URL_HASH = '#';
function baseUrl(node) {
var u = new URL(node.ownerDocument.baseURI);
u.search = '';
u.hash = '';
return u;
}
function replaceUrlsInCssText(cssText, baseUrl, keepAbsolute, regexp) {
return cssText.replace(regexp, function(m, pre, url, post) {
var urlPath = url.replace(/["']/g, '');
urlPath = resolveRelativeUrl(baseUrl, urlPath, keepAbsolute);
return pre + '\'' + urlPath + '\'' + post;
});
}
function resolveRelativeUrl(baseUrl, url, keepAbsolute) {
// do not resolve '/' absolute urls
if (url && url[0] === '/') {
return url;
}
// do not resolve '#' links, they are used for routing
if (url && url[0] === '#') {
return url;
}
var u = new URL(url, baseUrl);
return keepAbsolute ? u.href : makeDocumentRelPath(u.href);
}
function makeDocumentRelPath(url) {
var root = baseUrl(document.documentElement);
var u = new URL(url, root);
if (u.host === root.host && u.port === root.port &&
u.protocol === root.protocol) {
return makeRelPath(root, u);
} else {
return url;
}
}
// make a relative path from source to target
function makeRelPath(sourceUrl, targetUrl) {
var source = sourceUrl.pathname;
var target = targetUrl.pathname;
var s = source.split('/');
var t = target.split('/');
while (s.length && s[0] === t[0]){
s.shift();
t.shift();
}
for (var i = 0, l = s.length - 1; i < l; i++) {
t.unshift('..');
}
// empty '#' is discarded but we need to preserve it.
var hash = (targetUrl.href.slice(-1) === URL_HASH) ? URL_HASH : targetUrl.hash;
return t.join('/') + targetUrl.search + hash;
}
// exports
scope.urlResolver = urlResolver;
})(Polymer);
(function(scope) {
var endOfMicrotask = Polymer.endOfMicrotask;
// Generic url loader
function Loader(regex) {
this.cache = Object.create(null);
this.map = Object.create(null);
this.requests = 0;
this.regex = regex;
}
Loader.prototype = {
// TODO(dfreedm): there may be a better factoring here
// extract absolute urls from the text (full of relative urls)
extractUrls: function(text, base) {
var matches = [];
var matched, u;
while ((matched = this.regex.exec(text))) {
u = new URL(matched[1], base);
matches.push({matched: matched[0], url: u.href});
}
return matches;
},
// take a text blob, a root url, and a callback and load all the urls found within the text
// returns a map of absolute url to text
process: function(text, root, callback) {
var matches = this.extractUrls(text, root);
// every call to process returns all the text this loader has ever received
var done = callback.bind(null, this.map);
this.fetch(matches, done);
},
// build a mapping of url -> text from matches
fetch: function(matches, callback) {
var inflight = matches.length;
// return early if there is no fetching to be done
if (!inflight) {
return callback();
}
// wait for all subrequests to return
var done = function() {
if (--inflight === 0) {
callback();
}
};
// start fetching all subrequests
var m, req, url;
for (var i = 0; i < inflight; i++) {
m = matches[i];
url = m.url;
req = this.cache[url];
// if this url has already been requested, skip requesting it again
if (!req) {
req = this.xhr(url);
req.match = m;
this.cache[url] = req;
}
// wait for the request to process its subrequests
req.wait(done);
}
},
handleXhr: function(request) {
var match = request.match;
var url = match.url;
// handle errors with an empty string
var response = request.response || request.responseText || '';
this.map[url] = response;
this.fetch(this.extractUrls(response, url), request.resolve);
},
xhr: function(url) {
this.requests++;
var request = new XMLHttpRequest();
request.open('GET', url, true);
request.send();
request.onerror = request.onload = this.handleXhr.bind(this, request);
// queue of tasks to run after XHR returns
request.pending = [];
request.resolve = function() {
var pending = request.pending;
for(var i = 0; i < pending.length; i++) {
pending[i]();
}
request.pending = null;
};
// if we have already resolved, pending is null, async call the callback
request.wait = function(fn) {
if (request.pending) {
request.pending.push(fn);
} else {
endOfMicrotask(fn);
}
};
return request;
}
};
scope.Loader = Loader;
})(Polymer);
(function(scope) {
var urlResolver = scope.urlResolver;
var Loader = scope.Loader;
function StyleResolver() {
this.loader = new Loader(this.regex);
}
StyleResolver.prototype = {
regex: /@import\s+(?:url)?["'\(]*([^'"\)]*)['"\)]*;/g,
// Recursively replace @imports with the text at that url
resolve: function(text, url, callback) {
var done = function(map) {
callback(this.flatten(text, url, map));
}.bind(this);
this.loader.process(text, url, done);
},
// resolve the textContent of a style node
resolveNode: function(style, url, callback) {
var text = style.textContent;
var done = function(text) {
style.textContent = text;
callback(style);
};
this.resolve(text, url, done);
},
// flatten all the @imports to text
flatten: function(text, base, map) {
var matches = this.loader.extractUrls(text, base);
var match, url, intermediate;
for (var i = 0; i < matches.length; i++) {
match = matches[i];
url = match.url;
// resolve any css text to be relative to the importer, keep absolute url
intermediate = urlResolver.resolveCssText(map[url], url, true);
// flatten intermediate @imports
intermediate = this.flatten(intermediate, base, map);
text = text.replace(match.matched, intermediate);
}
return text;
},
loadStyles: function(styles, base, callback) {
var loaded=0, l = styles.length;
// called in the context of the style
function loadedStyle(style) {
loaded++;
if (loaded === l && callback) {
callback();
}
}
for (var i=0, s; (i<l) && (s=styles[i]); i++) {
this.resolveNode(s, base, loadedStyle);
}
}
};
var styleResolver = new StyleResolver();
// exports
scope.styleResolver = styleResolver;
})(Polymer);
(function(scope) {
// copy own properties from 'api' to 'prototype, with name hinting for 'super'
function extend(prototype, api) {
if (prototype && api) {
// use only own properties of 'api'
Object.getOwnPropertyNames(api).forEach(function(n) {
// acquire property descriptor
var pd = Object.getOwnPropertyDescriptor(api, n);
if (pd) {
// clone property via descriptor
Object.defineProperty(prototype, n, pd);
// cache name-of-method for 'super' engine
if (typeof pd.value == 'function') {
// hint the 'super' engine
pd.value.nom = n;
}
}
});
}
return prototype;
}
// mixin
// copy all properties from inProps (et al) to inObj
function mixin(inObj/*, inProps, inMoreProps, ...*/) {
var obj = inObj || {};
for (var i = 1; i < arguments.length; i++) {
var p = arguments[i];
try {
for (var n in p) {
copyProperty(n, p, obj);
}
} catch(x) {
}
}
return obj;
}
// copy property inName from inSource object to inTarget object
function copyProperty(inName, inSource, inTarget) {
var pd = getPropertyDescriptor(inSource, inName);
Object.defineProperty(inTarget, inName, pd);
}
// get property descriptor for inName on inObject, even if
// inName exists on some link in inObject's prototype chain
function getPropertyDescriptor(inObject, inName) {
if (inObject) {
var pd = Object.getOwnPropertyDescriptor(inObject, inName);
return pd || getPropertyDescriptor(Object.getPrototypeOf(inObject), inName);
}
}
// exports
scope.extend = extend;
scope.mixin = mixin;
// for bc
Platform.mixin = mixin;
})(Polymer);
(function(scope) {
// usage
// invoke cb.call(this) in 100ms, unless the job is re-registered,
// which resets the timer
//
// this.myJob = this.job(this.myJob, cb, 100)
//
// returns a job handle which can be used to re-register a job
var Job = function(inContext) {
this.context = inContext;
this.boundComplete = this.complete.bind(this)
};
Job.prototype = {
go: function(callback, wait) {
this.callback = callback;
var h;
if (!wait) {
h = requestAnimationFrame(this.boundComplete);
this.handle = function() {
cancelAnimationFrame(h);
}
} else {
h = setTimeout(this.boundComplete, wait);
this.handle = function() {
clearTimeout(h);
}
}
},
stop: function() {
if (this.handle) {
this.handle();
this.handle = null;
}
},
complete: function() {
if (this.handle) {
this.stop();
this.callback.call(this.context);
}
}
};
function job(job, callback, wait) {
if (job) {
job.stop();
} else {
job = new Job(this);
}
job.go(callback, wait);
return job;
}
// exports
scope.job = job;
})(Polymer);
(function(scope) {
// dom polyfill, additions, and utility methods
var registry = {};
HTMLElement.register = function(tag, prototype) {
registry[tag] = prototype;
};
// get prototype mapped to node <tag>
HTMLElement.getPrototypeForTag = function(tag) {
var prototype = !tag ? HTMLElement.prototype : registry[tag];
// TODO(sjmiles): creating <tag> is likely to have wasteful side-effects
return prototype || Object.getPrototypeOf(document.createElement(tag));
};
// we have to flag propagation stoppage for the event dispatcher
var originalStopPropagation = Event.prototype.stopPropagation;
Event.prototype.stopPropagation = function() {
this.cancelBubble = true;
originalStopPropagation.apply(this, arguments);
};
// polyfill DOMTokenList
// * add/remove: allow these methods to take multiple classNames
// * toggle: add a 2nd argument which forces the given state rather
// than toggling.
var add = DOMTokenList.prototype.add;
var remove = DOMTokenList.prototype.remove;
DOMTokenList.prototype.add = function() {
for (var i = 0; i < arguments.length; i++) {
add.call(this, arguments[i]);
}
};
DOMTokenList.prototype.remove = function() {
for (var i = 0; i < arguments.length; i++) {
remove.call(this, arguments[i]);
}
};
DOMTokenList.prototype.toggle = function(name, bool) {
if (arguments.length == 1) {
bool = !this.contains(name);
}
bool ? this.add(name) : this.remove(name);
};
DOMTokenList.prototype.switch = function(oldName, newName) {
oldName && this.remove(oldName);
newName && this.add(newName);
};
// add array() to NodeList, NamedNodeMap, HTMLCollection
var ArraySlice = function() {
return Array.prototype.slice.call(this);
};
var namedNodeMap = (window.NamedNodeMap || window.MozNamedAttrMap || {});
NodeList.prototype.array = ArraySlice;
namedNodeMap.prototype.array = ArraySlice;
HTMLCollection.prototype.array = ArraySlice;
// utility
function createDOM(inTagOrNode, inHTML, inAttrs) {
var dom = typeof inTagOrNode == 'string' ?
document.createElement(inTagOrNode) : inTagOrNode.cloneNode(true);
dom.innerHTML = inHTML;
if (inAttrs) {
for (var n in inAttrs) {
dom.setAttribute(n, inAttrs[n]);
}
}
return dom;
}
// exports
scope.createDOM = createDOM;
})(Polymer);
(function(scope) {
// super
// `arrayOfArgs` is an optional array of args like one might pass
// to `Function.apply`
// TODO(sjmiles):
// $super must be installed on an instance or prototype chain
// as `super`, and invoked via `this`, e.g.
// `this.super();`
// will not work if function objects are not unique, for example,
// when using mixins.
// The memoization strategy assumes each function exists on only one
// prototype chain i.e. we use the function object for memoizing)
// perhaps we can bookkeep on the prototype itself instead
function $super(arrayOfArgs) {
// since we are thunking a method call, performance is important here:
// memoize all lookups, once memoized the fast path calls no other
// functions
//
// find the caller (cannot be `strict` because of 'caller')
var caller = $super.caller;
// memoized 'name of method'
var nom = caller.nom;
// memoized next implementation prototype
var _super = caller._super;
if (!_super) {
if (!nom) {
nom = caller.nom = nameInThis.call(this, caller);
}
if (!nom) {
console.warn('called super() on a method not installed declaratively (has no .nom property)');
}
// super prototype is either cached or we have to find it
// by searching __proto__ (at the 'top')
// invariant: because we cache _super on fn below, we never reach
// here from inside a series of calls to super(), so it's ok to
// start searching from the prototype of 'this' (at the 'top')
// we must never memoize a null super for this reason
_super = memoizeSuper(caller, nom, getPrototypeOf(this));
}
// our super function
var fn = _super[nom];
if (fn) {
// memoize information so 'fn' can call 'super'
if (!fn._super) {
// must not memoize null, or we lose our invariant above
memoizeSuper(fn, nom, _super);
}
// invoke the inherited method
// if 'fn' is not function valued, this will throw
return fn.apply(this, arrayOfArgs || []);
}
}
function nameInThis(value) {
var p = this.__proto__;
while (p && p !== HTMLElement.prototype) {
// TODO(sjmiles): getOwnPropertyNames is absurdly expensive
var n$ = Object.getOwnPropertyNames(p);
for (var i=0, l=n$.length, n; i<l && (n=n$[i]); i++) {
var d = Object.getOwnPropertyDescriptor(p, n);
if (typeof d.value === 'function' && d.value === value) {
return n;
}
}
p = p.__proto__;
}
}
function memoizeSuper(method, name, proto) {
// find and cache next prototype containing `name`
// we need the prototype so we can do another lookup
// from here
var s = nextSuper(proto, name, method);
if (s[name]) {
// `s` is a prototype, the actual method is `s[name]`
// tag super method with it's name for quicker lookups
s[name].nom = name;
}
return method._super = s;
}
function nextSuper(proto, name, caller) {
// look for an inherited prototype that implements name
while (proto) {
if ((proto[name] !== caller) && proto[name]) {
return proto;
}
proto = getPrototypeOf(proto);
}
// must not return null, or we lose our invariant above
// in this case, a super() call was invoked where no superclass
// method exists
// TODO(sjmiles): thow an exception?
return Object;
}
// NOTE: In some platforms (IE10) the prototype chain is faked via
// __proto__. Therefore, always get prototype via __proto__ instead of
// the more standard Object.getPrototypeOf.
function getPrototypeOf(prototype) {
return prototype.__proto__;
}
// utility function to precompute name tags for functions
// in a (unchained) prototype
function hintSuper(prototype) {
// tag functions with their prototype name to optimize
// super call invocations
for (var n in prototype) {
var pd = Object.getOwnPropertyDescriptor(prototype, n);
if (pd && typeof pd.value === 'function') {
pd.value.nom = n;
}
}
}
// exports
scope.super = $super;
})(Polymer);
(function(scope) {
function noopHandler(value) {
return value;
}
// helper for deserializing properties of various types to strings
var typeHandlers = {
string: noopHandler,
'undefined': noopHandler,
date: function(value) {
return new Date(Date.parse(value) || Date.now());
},
boolean: function(value) {
if (value === '') {
return true;
}
return value === 'false' ? false : !!value;
},
number: function(value) {
var n = parseFloat(value);
// hex values like "0xFFFF" parseFloat as 0
if (n === 0) {
n = parseInt(value);
}
return isNaN(n) ? value : n;
// this code disabled because encoded values (like "0xFFFF")
// do not round trip to their original format
//return (String(floatVal) === value) ? floatVal : value;
},
object: function(value, currentValue) {
if (currentValue === null) {
return value;
}
try {
// If the string is an object, we can parse is with the JSON library.
// include convenience replace for single-quotes. If the author omits
// quotes altogether, parse will fail.
return JSON.parse(value.replace(/'/g, '"'));
} catch(e) {
// The object isn't valid JSON, return the raw value
return value;
}
},
// avoid deserialization of functions
'function': function(value, currentValue) {
return currentValue;
}
};
function deserializeValue(value, currentValue) {
// attempt to infer type from default value
var inferredType = typeof currentValue;
// invent 'date' type value for Date
if (currentValue instanceof Date) {
inferredType = 'date';
}
// delegate deserialization via type string
return typeHandlers[inferredType](value, currentValue);
}
// exports
scope.deserializeValue = deserializeValue;
})(Polymer);
(function(scope) {
// imports
var extend = scope.extend;
// module
var api = {};
api.declaration = {};
api.instance = {};
api.publish = function(apis, prototype) {
for (var n in apis) {
extend(prototype, apis[n]);
}
};
// exports
scope.api = api;
})(Polymer);
(function(scope) {
/**
* @class polymer-base
*/
var utils = {
/**
* Invokes a function asynchronously. The context of the callback
* function is bound to 'this' automatically. Returns a handle which may
* be passed to <a href="#cancelAsync">cancelAsync</a> to cancel the
* asynchronous call.
*
* @method async
* @param {Function|String} method
* @param {any|Array} args
* @param {number} timeout
*/
async: function(method, args, timeout) {
// when polyfilling Object.observe, ensure changes
// propagate before executing the async method
Polymer.flush();
// second argument to `apply` must be an array
args = (args && args.length) ? args : [args];
// function to invoke
var fn = function() {
(this[method] || method).apply(this, args);
}.bind(this);
// execute `fn` sooner or later
var handle = timeout ? setTimeout(fn, timeout) :
requestAnimationFrame(fn);
// NOTE: switch on inverting handle to determine which time is used.
return timeout ? handle : ~handle;
},
/**
* Cancels a pending callback that was scheduled via
* <a href="#async">async</a>.
*
* @method cancelAsync
* @param {handle} handle Handle of the `async` to cancel.
*/
cancelAsync: function(handle) {
if (handle < 0) {
cancelAnimationFrame(~handle);
} else {
clearTimeout(handle);
}
},
/**
* Fire an event.
*
* @method fire
* @returns {Object} event
* @param {string} type An event name.
* @param {any} detail
* @param {Node} onNode Target node.
* @param {Boolean} bubbles Set false to prevent bubbling, defaults to true
* @param {Boolean} cancelable Set false to prevent cancellation, defaults to true
*/
fire: function(type, detail, onNode, bubbles, cancelable) {
var node = onNode || this;
var detail = detail === null || detail === undefined ? {} : detail;
var event = new CustomEvent(type, {
bubbles: bubbles !== undefined ? bubbles : true,
cancelable: cancelable !== undefined ? cancelable : true,
detail: detail
});
node.dispatchEvent(event);
return event;
},
/**
* Fire an event asynchronously.
*
* @method asyncFire
* @param {string} type An event name.
* @param detail
* @param {Node} toNode Target node.
*/
asyncFire: function(/*inType, inDetail*/) {
this.async("fire", arguments);
},
/**
* Remove class from old, add class to anew, if they exist.
*
* @param classFollows
* @param anew A node.
* @param old A node
* @param className
*/
classFollows: function(anew, old, className) {
if (old) {
old.classList.remove(className);
}
if (anew) {
anew.classList.add(className);
}
},
/**
* Inject HTML which contains markup bound to this element into
* a target element (replacing target element content).
*
* @param String html to inject
* @param Element target element
*/
injectBoundHTML: function(html, element) {
var template = document.createElement('template');
template.innerHTML = html;
var fragment = this.instanceTemplate(template);
if (element) {
element.textContent = '';
element.appendChild(fragment);
}
return fragment;
}
};
// no-operation function for handy stubs
var nop = function() {};
// null-object for handy stubs
var nob = {};
// deprecated
utils.asyncMethod = utils.async;
// exports
scope.api.instance.utils = utils;
scope.nop = nop;
scope.nob = nob;
})(Polymer);
(function(scope) {
// imports
var log = window.WebComponents ? WebComponents.flags.log : {};
var EVENT_PREFIX = 'on-';
// instance events api
var events = {
// read-only
EVENT_PREFIX: EVENT_PREFIX,
// event listeners on host
addHostListeners: function() {
var events = this.eventDelegates;
log.events && (Object.keys(events).length > 0) && console.log('[%s] addHostListeners:', this.localName, events);
// NOTE: host events look like bindings but really are not;
// (1) we don't want the attribute to be set and (2) we want to support
// multiple event listeners ('host' and 'instance') and Node.bind
// by default supports 1 thing being bound.
for (var type in events) {
var methodName = events[type];
PolymerGestures.addEventListener(this, type, this.element.getEventHandler(this, this, methodName));
}
},
// call 'method' or function method on 'obj' with 'args', if the method exists
dispatchMethod: function(obj, method, args) {
if (obj) {
log.events && console.group('[%s] dispatch [%s]', obj.localName, method);
var fn = typeof method === 'function' ? method : obj[method];
if (fn) {
fn[args ? 'apply' : 'call'](obj, args);
}
log.events && console.groupEnd();
// NOTE: dirty check right after calling method to ensure
// changes apply quickly; in a very complicated app using high
// frequency events, this can be a perf concern; in this case,
// imperative handlers can be used to avoid flushing.
Polymer.flush();
}
}
};
// exports
scope.api.instance.events = events;
/**
* @class Polymer
*/
/**
* Add a gesture aware event handler to the given `node`. Can be used
* in place of `element.addEventListener` and ensures gestures will function
* as expected on mobile platforms. Please note that Polymer's declarative
* event handlers include this functionality by default.
*
* @method addEventListener
* @param {Node} node node on which to listen
* @param {String} eventType name of the event
* @param {Function} handlerFn event handler function
* @param {Boolean} capture set to true to invoke event capturing
* @type Function
*/
// alias PolymerGestures event listener logic
scope.addEventListener = function(node, eventType, handlerFn, capture) {
PolymerGestures.addEventListener(wrap(node), eventType, handlerFn, capture);
};
/**
* Remove a gesture aware event handler on the given `node`. To remove an
* event listener, the exact same arguments are required that were passed
* to `Polymer.addEventListener`.
*
* @method removeEventListener
* @param {Node} node node on which to listen
* @param {String} eventType name of the event
* @param {Function} handlerFn event handler function
* @param {Boolean} capture set to true to invoke event capturing
* @type Function
*/
scope.removeEventListener = function(node, eventType, handlerFn, capture) {
PolymerGestures.removeEventListener(wrap(node), eventType, handlerFn, capture);
};
})(Polymer);
(function(scope) {
// instance api for attributes
var attributes = {
// copy attributes defined in the element declaration to the instance
// e.g. <polymer-element name="x-foo" tabIndex="0"> tabIndex is copied
// to the element instance here.
copyInstanceAttributes: function () {
var a$ = this._instanceAttributes;
for (var k in a$) {
if (!this.hasAttribute(k)) {
this.setAttribute(k, a$[k]);
}
}
},
// for each attribute on this, deserialize value to property as needed
takeAttributes: function() {
// if we have no publish lookup table, we have no attributes to take
// TODO(sjmiles): ad hoc
if (this._publishLC) {
for (var i=0, a$=this.attributes, l=a$.length, a; (a=a$[i]) && i<l; i++) {
this.attributeToProperty(a.name, a.value);
}
}
},
// if attribute 'name' is mapped to a property, deserialize
// 'value' into that property
attributeToProperty: function(name, value) {
// try to match this attribute to a property (attributes are
// all lower-case, so this is case-insensitive search)
var name = this.propertyForAttribute(name);
if (name) {
// filter out 'mustached' values, these are to be
// replaced with bound-data and are not yet values
// themselves
if (value && value.search(scope.bindPattern) >= 0) {
return;
}
// get original value
var currentValue = this[name];
// deserialize Boolean or Number values from attribute
var value = this.deserializeValue(value, currentValue);
// only act if the value has changed
if (value !== currentValue) {
// install new value (has side-effects)
this[name] = value;
}
}
},
// return the published property matching name, or undefined
propertyForAttribute: function(name) {
var match = this._publishLC && this._publishLC[name];
return match;
},
// convert representation of `stringValue` based on type of `currentValue`
deserializeValue: function(stringValue, currentValue) {
return scope.deserializeValue(stringValue, currentValue);
},
// convert to a string value based on the type of `inferredType`
serializeValue: function(value, inferredType) {
if (inferredType === 'boolean') {
return value ? '' : undefined;
} else if (inferredType !== 'object' && inferredType !== 'function'
&& value !== undefined) {
return value;
}
},
// serializes `name` property value and updates the corresponding attribute
// note that reflection is opt-in.
reflectPropertyToAttribute: function(name) {
var inferredType = typeof this[name];
// try to intelligently serialize property value
var serializedValue = this.serializeValue(this[name], inferredType);
// boolean properties must reflect as boolean attributes
if (serializedValue !== undefined) {
this.setAttribute(name, serializedValue);
// TODO(sorvell): we should remove attr for all properties
// that have undefined serialization; however, we will need to
// refine the attr reflection system to achieve this; pica, for example,
// relies on having inferredType object properties not removed as
// attrs.
} else if (inferredType === 'boolean') {
this.removeAttribute(name);
}
}
};
// exports
scope.api.instance.attributes = attributes;
})(Polymer);
(function(scope) {
/**
* @class polymer-base
*/
// imports
var log = window.WebComponents ? WebComponents.flags.log : {};
// magic words
var OBSERVE_SUFFIX = 'Changed';
// element api
var empty = [];
var updateRecord = {
object: undefined,
type: 'update',
name: undefined,
oldValue: undefined
};
var numberIsNaN = Number.isNaN || function(value) {
return typeof value === 'number' && isNaN(value);
};
function areSameValue(left, right) {
if (left === right)
return left !== 0 || 1 / left === 1 / right;
if (numberIsNaN(left) && numberIsNaN(right))
return true;
return left !== left && right !== right;
}
// capture A's value if B's value is null or undefined,
// otherwise use B's value
function resolveBindingValue(oldValue, value) {
if (value === undefined && oldValue === null) {
return value;
}
return (value === null || value === undefined) ? oldValue : value;
}
var properties = {
// creates a CompoundObserver to observe property changes
// NOTE, this is only done there are any properties in the `observe` object
createPropertyObserver: function() {
var n$ = this._observeNames;
if (n$ && n$.length) {
var o = this._propertyObserver = new CompoundObserver(true);
this.registerObserver(o);
// TODO(sorvell): may not be kosher to access the value here (this[n]);
// previously we looked at the descriptor on the prototype
// this doesn't work for inheritance and not for accessors without
// a value property
for (var i=0, l=n$.length, n; (i<l) && (n=n$[i]); i++) {
o.addPath(this, n);
this.observeArrayValue(n, this[n], null);
}
}
},
// start observing property changes
openPropertyObserver: function() {
if (this._propertyObserver) {
this._propertyObserver.open(this.notifyPropertyChanges, this);
}
},
// handler for property changes; routes changes to observing methods
// note: array valued properties are observed for array splices
notifyPropertyChanges: function(newValues, oldValues, paths) {
var name, method, called = {};
for (var i in oldValues) {
// note: paths is of form [object, path, object, path]
name = paths[2 * i + 1];
method = this.observe[name];
if (method) {
var ov = oldValues[i], nv = newValues[i];
// observes the value if it is an array
this.observeArrayValue(name, nv, ov);
if (!called[method]) {
// only invoke change method if one of ov or nv is not (undefined | null)
if ((ov !== undefined && ov !== null) || (nv !== undefined && nv !== null)) {
called[method] = true;
// TODO(sorvell): call method with the set of values it's expecting;
// e.g. 'foo bar': 'invalidate' expects the new and old values for
// foo and bar. Currently we give only one of these and then
// deliver all the arguments.
this.invokeMethod(method, [ov, nv, arguments]);
}
}
}
}
},
// call method iff it exists.
invokeMethod: function(method, args) {
var fn = this[method] || method;
if (typeof fn === 'function') {
fn.apply(this, args);
}
},
/**
* Force any pending property changes to synchronously deliver to
* handlers specified in the `observe` object.
* Note, normally changes are processed at microtask time.
*
* @method deliverChanges
*/
deliverChanges: function() {
if (this._propertyObserver) {
this._propertyObserver.deliver();
}
},
observeArrayValue: function(name, value, old) {
// we only care if there are registered side-effects
var callbackName = this.observe[name];
if (callbackName) {
// if we are observing the previous value, stop
if (Array.isArray(old)) {
log.observe && console.log('[%s] observeArrayValue: unregister observer [%s]', this.localName, name);
this.closeNamedObserver(name + '__array');
}
// if the new value is an array, being observing it
if (Array.isArray(value)) {
log.observe && console.log('[%s] observeArrayValue: register observer [%s]', this.localName, name, value);
var observer = new ArrayObserver(value);
observer.open(function(splices) {
this.invokeMethod(callbackName, [splices]);
}, this);
this.registerNamedObserver(name + '__array', observer);
}
}
},
emitPropertyChangeRecord: function(name, value, oldValue) {
var object = this;
if (areSameValue(value, oldValue)) {
return;
}
// invoke property change side effects
this._propertyChanged(name, value, oldValue);
// emit change record
if (!Observer.hasObjectObserve) {
return;
}
var notifier = this._objectNotifier;
if (!notifier) {
notifier = this._objectNotifier = Object.getNotifier(this);
}
updateRecord.object = this;
updateRecord.name = name;
updateRecord.oldValue = oldValue;
notifier.notify(updateRecord);
},
_propertyChanged: function(name, value, oldValue) {
if (this.reflect[name]) {
this.reflectPropertyToAttribute(name);
}
},
// creates a property binding (called via bind) to a published property.
bindProperty: function(property, observable, oneTime) {
if (oneTime) {
this[property] = observable;
return;
}
var computed = this.element.prototype.computed;
// Binding an "out-only" value to a computed property. Note that
// since this observer isn't opened, it doesn't need to be closed on
// cleanup.
if (computed && computed[property]) {
var privateComputedBoundValue = property + 'ComputedBoundObservable_';
this[privateComputedBoundValue] = observable;
return;
}
return this.bindToAccessor(property, observable, resolveBindingValue);
},
// NOTE property `name` must be published. This makes it an accessor.
bindToAccessor: function(name, observable, resolveFn) {
var privateName = name + '_';
var privateObservable = name + 'Observable_';
// Present for properties which are computed and published and have a
// bound value.
var privateComputedBoundValue = name + 'ComputedBoundObservable_';
this[privateObservable] = observable;
var oldValue = this[privateName];
// observable callback
var self = this;
function updateValue(value, oldValue) {
self[privateName] = value;
var setObserveable = self[privateComputedBoundValue];
if (setObserveable && typeof setObserveable.setValue == 'function') {
setObserveable.setValue(value);
}
self.emitPropertyChangeRecord(name, value, oldValue);
}
// resolve initial value
var value = observable.open(updateValue);
if (resolveFn && !areSameValue(oldValue, value)) {
var resolvedValue = resolveFn(oldValue, value);
if (!areSameValue(value, resolvedValue)) {
value = resolvedValue;
if (observable.setValue) {
observable.setValue(value);
}
}
}
updateValue(value, oldValue);
// register and return observable
var observer = {
close: function() {
observable.close();
self[privateObservable] = undefined;
self[privateComputedBoundValue] = undefined;
}
};
this.registerObserver(observer);
return observer;
},
createComputedProperties: function() {
if (!this._computedNames) {
return;
}
for (var i = 0; i < this._computedNames.length; i++) {
var name = this._computedNames[i];
var expressionText = this.computed[name];
try {
var expression = PolymerExpressions.getExpression(expressionText);
var observable = expression.getBinding(this, this.element.syntax);
this.bindToAccessor(name, observable);
} catch (ex) {
console.error('Failed to create computed property', ex);
}
}
},
// property bookkeeping
registerObserver: function(observer) {
if (!this._observers) {
this._observers = [observer];
return;
}
this._observers.push(observer);
},
closeObservers: function() {
if (!this._observers) {
return;
}
// observer array items are arrays of observers.
var observers = this._observers;
for (var i = 0; i < observers.length; i++) {
var observer = observers[i];
if (observer && typeof observer.close == 'function') {
observer.close();
}
}
this._observers = [];
},
// bookkeeping observers for memory management
registerNamedObserver: function(name, observer) {
var o$ = this._namedObservers || (this._namedObservers = {});
o$[name] = observer;
},
closeNamedObserver: function(name) {
var o$ = this._namedObservers;
if (o$ && o$[name]) {
o$[name].close();
o$[name] = null;
return true;
}
},
closeNamedObservers: function() {
if (this._namedObservers) {
for (var i in this._namedObservers) {
this.closeNamedObserver(i);
}
this._namedObservers = {};
}
}
};
// logging
var LOG_OBSERVE = '[%s] watching [%s]';
var LOG_OBSERVED = '[%s#%s] watch: [%s] now [%s] was [%s]';
var LOG_CHANGED = '[%s#%s] propertyChanged: [%s] now [%s] was [%s]';
// exports
scope.api.instance.properties = properties;
})(Polymer);
(function(scope) {
/**
* @class polymer-base
*/
// imports
var log = window.WebComponents ? WebComponents.flags.log : {};
// element api supporting mdv
var mdv = {
/**
* Creates dom cloned from the given template, instantiating bindings
* with this element as the template model and `PolymerExpressions` as the
* binding delegate.
*
* @method instanceTemplate
* @param {Template} template source template from which to create dom.
*/
instanceTemplate: function(template) {
// ensure template is decorated (lets' things like <tr template ...> work)
HTMLTemplateElement.decorate(template);
// ensure a default bindingDelegate
var syntax = this.syntax || (!template.bindingDelegate &&
this.element.syntax);
var dom = template.createInstance(this, syntax);
var observers = dom.bindings_;
for (var i = 0; i < observers.length; i++) {
this.registerObserver(observers[i]);
}
return dom;
},
// Called by TemplateBinding/NodeBind to setup a binding to the given
// property. It's overridden here to support property bindings
// in addition to attribute bindings that are supported by default.
bind: function(name, observable, oneTime) {
var property = this.propertyForAttribute(name);
if (!property) {
// TODO(sjmiles): this mixin method must use the special form
// of `super` installed by `mixinMethod` in declaration/prototype.js
return this.mixinSuper(arguments);
} else {
// use n-way Polymer binding
var observer = this.bindProperty(property, observable, oneTime);
// NOTE: reflecting binding information is typically required only for
// tooling. It has a performance cost so it's opt-in in Node.bind.
if (Platform.enableBindingsReflection && observer) {
observer.path = observable.path_;
this._recordBinding(property, observer);
}
if (this.reflect[property]) {
this.reflectPropertyToAttribute(property);
}
return observer;
}
},
_recordBinding: function(name, observer) {
this.bindings_ = this.bindings_ || {};
this.bindings_[name] = observer;
},
// Called by TemplateBinding when all bindings on an element have been
// executed. This signals that all element inputs have been gathered
// and it's safe to ready the element, create shadow-root and start
// data-observation.
bindFinished: function() {
this.makeElementReady();
},
// called at detached time to signal that an element's bindings should be
// cleaned up. This is done asynchronously so that users have the chance
// to call `cancelUnbindAll` to prevent unbinding.
asyncUnbindAll: function() {
if (!this._unbound) {
log.unbind && console.log('[%s] asyncUnbindAll', this.localName);
this._unbindAllJob = this.job(this._unbindAllJob, this.unbindAll, 0);
}
},
/**
* This method should rarely be used and only if
* <a href="#cancelUnbindAll">`cancelUnbindAll`</a> has been called to
* prevent element unbinding. In this case, the element's bindings will
* not be automatically cleaned up and it cannot be garbage collected
* by the system. If memory pressure is a concern or a
* large amount of elements need to be managed in this way, `unbindAll`
* can be called to deactivate the element's bindings and allow its
* memory to be reclaimed.
*
* @method unbindAll
*/
unbindAll: function() {
if (!this._unbound) {
this.closeObservers();
this.closeNamedObservers();
this._unbound = true;
}
},
/**
* Call in `detached` to prevent the element from unbinding when it is
* detached from the dom. The element is unbound as a cleanup step that
* allows its memory to be reclaimed.
* If `cancelUnbindAll` is used, consider calling
* <a href="#unbindAll">`unbindAll`</a> when the element is no longer
* needed. This will allow its memory to be reclaimed.
*
* @method cancelUnbindAll
*/
cancelUnbindAll: function() {
if (this._unbound) {
log.unbind && console.warn('[%s] already unbound, cannot cancel unbindAll', this.localName);
return;
}
log.unbind && console.log('[%s] cancelUnbindAll', this.localName);
if (this._unbindAllJob) {
this._unbindAllJob = this._unbindAllJob.stop();
}
}
};
function unbindNodeTree(node) {
forNodeTree(node, _nodeUnbindAll);
}
function _nodeUnbindAll(node) {
node.unbindAll();
}
function forNodeTree(node, callback) {
if (node) {
callback(node);
for (var child = node.firstChild; child; child = child.nextSibling) {
forNodeTree(child, callback);
}
}
}
var mustachePattern = /\{\{([^{}]*)}}/;
// exports
scope.bindPattern = mustachePattern;
scope.api.instance.mdv = mdv;
})(Polymer);
(function(scope) {
/**
* Common prototype for all Polymer Elements.
*
* @class polymer-base
* @homepage polymer.github.io
*/
var base = {
/**
* Tags this object as the canonical Base prototype.
*
* @property PolymerBase
* @type boolean
* @default true
*/
PolymerBase: true,
/**
* Debounce signals.
*
* Call `job` to defer a named signal, and all subsequent matching signals,
* until a wait time has elapsed with no new signal.
*
* debouncedClickAction: function(e) {
* // processClick only when it's been 100ms since the last click
* this.job('click', function() {
* this.processClick;
* }, 100);
* }
*
* @method job
* @param String {String} job A string identifier for the job to debounce.
* @param Function {Function} callback A function that is called (with `this` context) when the wait time elapses.
* @param Number {Number} wait Time in milliseconds (ms) after the last signal that must elapse before invoking `callback`
* @type Handle
*/
job: function(job, callback, wait) {
if (typeof job === 'string') {
var n = '___' + job;
this[n] = Polymer.job.call(this, this[n], callback, wait);
} else {
// TODO(sjmiles): suggest we deprecate this call signature
return Polymer.job.call(this, job, callback, wait);
}
},
/**
* Invoke a superclass method.
*
* Use `super()` to invoke the most recently overridden call to the
* currently executing function.
*
* To pass arguments through, use the literal `arguments` as the parameter
* to `super()`.
*
* nextPageAction: function(e) {
* // invoke the superclass version of `nextPageAction`
* this.super(arguments);
* }
*
* To pass custom arguments, arrange them in an array.
*
* appendSerialNo: function(value, serial) {
* // prefix the superclass serial number with our lot # before
* // invoking the superlcass
* return this.super([value, this.lotNo + serial])
* }
*
* @method super
* @type Any
* @param {args) An array of arguments to use when calling the superclass method, or null.
*/
super: Polymer.super,
/**
* Lifecycle method called when the element is instantiated.
*
* Override `created` to perform custom create-time tasks. No need to call
* super-class `created` unless you are extending another Polymer element.
* Created is called before the element creates `shadowRoot` or prepares
* data-observation.
*
* @method created
* @type void
*/
created: function() {
},
/**
* Lifecycle method called when the element has populated it's `shadowRoot`,
* prepared data-observation, and made itself ready for API interaction.
*
* @method ready
* @type void
*/
ready: function() {
},
/**
* Low-level lifecycle method called as part of standard Custom Elements
* operation. Polymer implements this method to provide basic default
* functionality. For custom create-time tasks, implement `created`
* instead, which is called immediately after `createdCallback`.
*
* @method createdCallback
*/
createdCallback: function() {
if (this.templateInstance && this.templateInstance.model) {
console.warn('Attributes on ' + this.localName + ' were data bound ' +
'prior to Polymer upgrading the element. This may result in ' +
'incorrect binding types.');
}
this.created();
this.prepareElement();
if (!this.ownerDocument.isStagingDocument) {
this.makeElementReady();
}
},
// system entry point, do not override
prepareElement: function() {
if (this._elementPrepared) {
console.warn('Element already prepared', this.localName);
return;
}
this._elementPrepared = true;
// storage for shadowRoots info
this.shadowRoots = {};
// install property observers
this.createPropertyObserver();
this.openPropertyObserver();
// install boilerplate attributes
this.copyInstanceAttributes();
// process input attributes
this.takeAttributes();
// add event listeners
this.addHostListeners();
},
// system entry point, do not override
makeElementReady: function() {
if (this._readied) {
return;
}
this._readied = true;
this.createComputedProperties();
this.parseDeclarations(this.__proto__);
// NOTE: Support use of the `unresolved` attribute to help polyfill
// custom elements' `:unresolved` feature.
this.removeAttribute('unresolved');
// user entry point
this.ready();
},
/**
* Low-level lifecycle method called as part of standard Custom Elements
* operation. Polymer implements this method to provide basic default
* functionality. For custom tasks in your element, implement `attributeChanged`
* instead, which is called immediately after `attributeChangedCallback`.
*
* @method attributeChangedCallback
*/
attributeChangedCallback: function(name, oldValue) {
// TODO(sjmiles): adhoc filter
if (name !== 'class' && name !== 'style') {
this.attributeToProperty(name, this.getAttribute(name));
}
if (this.attributeChanged) {
this.attributeChanged.apply(this, arguments);
}
},
/**
* Low-level lifecycle method called as part of standard Custom Elements
* operation. Polymer implements this method to provide basic default
* functionality. For custom create-time tasks, implement `attached`
* instead, which is called immediately after `attachedCallback`.
*
* @method attachedCallback
*/
attachedCallback: function() {
// when the element is attached, prevent it from unbinding.
this.cancelUnbindAll();
// invoke user action
if (this.attached) {
this.attached();
}
if (!this.hasBeenAttached) {
this.hasBeenAttached = true;
if (this.domReady) {
this.async('domReady');
}
}
},
/**
* Implement to access custom elements in dom descendants, ancestors,
* or siblings. Because custom elements upgrade in document order,
* elements accessed in `ready` or `attached` may not be upgraded. When
* `domReady` is called, all registered custom elements are guaranteed
* to have been upgraded.
*
* @method domReady
*/
/**
* Low-level lifecycle method called as part of standard Custom Elements
* operation. Polymer implements this method to provide basic default
* functionality. For custom create-time tasks, implement `detached`
* instead, which is called immediately after `detachedCallback`.
*
* @method detachedCallback
*/
detachedCallback: function() {
if (!this.preventDispose) {
this.asyncUnbindAll();
}
// invoke user action
if (this.detached) {
this.detached();
}
// TODO(sorvell): bc
if (this.leftView) {
this.leftView();
}
},
/**
* Walks the prototype-chain of this element and allows specific
* classes a chance to process static declarations.
*
* In particular, each polymer-element has it's own `template`.
* `parseDeclarations` is used to accumulate all element `template`s
* from an inheritance chain.
*
* `parseDeclaration` static methods implemented in the chain are called
* recursively, oldest first, with the `<polymer-element>` associated
* with the current prototype passed as an argument.
*
* An element may override this method to customize shadow-root generation.
*
* @method parseDeclarations
*/
parseDeclarations: function(p) {
if (p && p.element) {
this.parseDeclarations(p.__proto__);
p.parseDeclaration.call(this, p.element);
}
},
/**
* Perform init-time actions based on static information in the
* `<polymer-element>` instance argument.
*
* For example, the standard implementation locates the template associated
* with the given `<polymer-element>` and stamps it into a shadow-root to
* implement shadow inheritance.
*
* An element may override this method for custom behavior.
*
* @method parseDeclaration
*/
parseDeclaration: function(elementElement) {
var template = this.fetchTemplate(elementElement);
if (template) {
var root = this.shadowFromTemplate(template);
this.shadowRoots[elementElement.name] = root;
}
},
/**
* Given a `<polymer-element>`, find an associated template (if any) to be
* used for shadow-root generation.
*
* An element may override this method for custom behavior.
*
* @method fetchTemplate
*/
fetchTemplate: function(elementElement) {
return elementElement.querySelector('template');
},
/**
* Create a shadow-root in this host and stamp `template` as it's
* content.
*
* An element may override this method for custom behavior.
*
* @method shadowFromTemplate
*/
shadowFromTemplate: function(template) {
if (template) {
// make a shadow root
var root = this.createShadowRoot();
// stamp template
// which includes parsing and applying MDV bindings before being
// inserted (to avoid {{}} in attribute values)
// e.g. to prevent <img src="images/{{icon}}"> from generating a 404.
var dom = this.instanceTemplate(template);
// append to shadow dom
root.appendChild(dom);
// perform post-construction initialization tasks on shadow root
this.shadowRootReady(root, template);
// return the created shadow root
return root;
}
},
// utility function that stamps a <template> into light-dom
lightFromTemplate: function(template, refNode) {
if (template) {
// TODO(sorvell): mark this element as an eventController so that
// event listeners on bound nodes inside it will be called on it.
// Note, the expectation here is that events on all descendants
// should be handled by this element.
this.eventController = this;
// stamp template
// which includes parsing and applying MDV bindings before being
// inserted (to avoid {{}} in attribute values)
// e.g. to prevent <img src="images/{{icon}}"> from generating a 404.
var dom = this.instanceTemplate(template);
// append to shadow dom
if (refNode) {
this.insertBefore(dom, refNode);
} else {
this.appendChild(dom);
}
// perform post-construction initialization tasks on ahem, light root
this.shadowRootReady(this);
// return the created shadow root
return dom;
}
},
shadowRootReady: function(root) {
// locate nodes with id and store references to them in this.$ hash
this.marshalNodeReferences(root);
},
// locate nodes with id and store references to them in this.$ hash
marshalNodeReferences: function(root) {
// establish $ instance variable
var $ = this.$ = this.$ || {};
// populate $ from nodes with ID from the LOCAL tree
if (root) {
var n$ = root.querySelectorAll("[id]");
for (var i=0, l=n$.length, n; (i<l) && (n=n$[i]); i++) {
$[n.id] = n;
};
}
},
/**
* Register a one-time callback when a child-list or sub-tree mutation
* occurs on node.
*
* For persistent callbacks, call onMutation from your listener.
*
* @method onMutation
* @param Node {Node} node Node to watch for mutations.
* @param Function {Function} listener Function to call on mutation. The function is invoked as `listener.call(this, observer, mutations);` where `observer` is the MutationObserver that triggered the notification, and `mutations` is the native mutation list.
*/
onMutation: function(node, listener) {
var observer = new MutationObserver(function(mutations) {
listener.call(this, observer, mutations);
observer.disconnect();
}.bind(this));
observer.observe(node, {childList: true, subtree: true});
}
};
/**
* @class Polymer
*/
/**
* Returns true if the object includes <a href="#polymer-base">polymer-base</a> in it's prototype chain.
*
* @method isBase
* @param Object {Object} object Object to test.
* @type Boolean
*/
function isBase(object) {
return object.hasOwnProperty('PolymerBase')
}
// name a base constructor for dev tools
/**
* The Polymer base-class constructor.
*
* @property Base
* @type Function
*/
function PolymerBase() {};
PolymerBase.prototype = base;
base.constructor = PolymerBase;
// exports
scope.Base = PolymerBase;
scope.isBase = isBase;
scope.api.instance.base = base;
})(Polymer);
(function(scope) {
// imports
var log = window.WebComponents ? WebComponents.flags.log : {};
var hasShadowDOMPolyfill = window.ShadowDOMPolyfill;
// magic words
var STYLE_SCOPE_ATTRIBUTE = 'element';
var STYLE_CONTROLLER_SCOPE = 'controller';
var styles = {
STYLE_SCOPE_ATTRIBUTE: STYLE_SCOPE_ATTRIBUTE,
/**
* Installs external stylesheets and <style> elements with the attribute
* polymer-scope='controller' into the scope of element. This is intended
* to be a called during custom element construction.
*/
installControllerStyles: function() {
// apply controller styles, but only if they are not yet applied
var scope = this.findStyleScope();
if (scope && !this.scopeHasNamedStyle(scope, this.localName)) {
// allow inherited controller styles
var proto = getPrototypeOf(this), cssText = '';
while (proto && proto.element) {
cssText += proto.element.cssTextForScope(STYLE_CONTROLLER_SCOPE);
proto = getPrototypeOf(proto);
}
if (cssText) {
this.installScopeCssText(cssText, scope);
}
}
},
installScopeStyle: function(style, name, scope) {
var scope = scope || this.findStyleScope(), name = name || '';
if (scope && !this.scopeHasNamedStyle(scope, this.localName + name)) {
var cssText = '';
if (style instanceof Array) {
for (var i=0, l=style.length, s; (i<l) && (s=style[i]); i++) {
cssText += s.textContent + '\n\n';
}
} else {
cssText = style.textContent;
}
this.installScopeCssText(cssText, scope, name);
}
},
installScopeCssText: function(cssText, scope, name) {
scope = scope || this.findStyleScope();
name = name || '';
if (!scope) {
return;
}
if (hasShadowDOMPolyfill) {
cssText = shimCssText(cssText, scope.host);
}
var style = this.element.cssTextToScopeStyle(cssText,
STYLE_CONTROLLER_SCOPE);
Polymer.applyStyleToScope(style, scope);
// cache that this style has been applied
this.styleCacheForScope(scope)[this.localName + name] = true;
},
findStyleScope: function(node) {
// find the shadow root that contains this element
var n = node || this;
while (n.parentNode) {
n = n.parentNode;
}
return n;
},
scopeHasNamedStyle: function(scope, name) {
var cache = this.styleCacheForScope(scope);
return cache[name];
},
styleCacheForScope: function(scope) {
if (hasShadowDOMPolyfill) {
var scopeName = scope.host ? scope.host.localName : scope.localName;
return polyfillScopeStyleCache[scopeName] || (polyfillScopeStyleCache[scopeName] = {});
} else {
return scope._scopeStyles = (scope._scopeStyles || {});
}
}
};
var polyfillScopeStyleCache = {};
// NOTE: use raw prototype traversal so that we ensure correct traversal
// on platforms where the protoype chain is simulated via __proto__ (IE10)
function getPrototypeOf(prototype) {
return prototype.__proto__;
}
function shimCssText(cssText, host) {
var name = '', is = false;
if (host) {
name = host.localName;
is = host.hasAttribute('is');
}
var selector = WebComponents.ShadowCSS.makeScopeSelector(name, is);
return WebComponents.ShadowCSS.shimCssText(cssText, selector);
}
// exports
scope.api.instance.styles = styles;
})(Polymer);
(function(scope) {
// imports
var extend = scope.extend;
var api = scope.api;
// imperative implementation: Polymer()
// specify an 'own' prototype for tag `name`
function element(name, prototype) {
if (typeof name !== 'string') {
var script = prototype || document._currentScript;
prototype = name;
name = script && script.parentNode && script.parentNode.getAttribute ?
script.parentNode.getAttribute('name') : '';
if (!name) {
throw 'Element name could not be inferred.';
}
}
if (getRegisteredPrototype(name)) {
throw 'Already registered (Polymer) prototype for element ' + name;
}
// cache the prototype
registerPrototype(name, prototype);
// notify the registrar waiting for 'name', if any
notifyPrototype(name);
}
// async prototype source
function waitingForPrototype(name, client) {
waitPrototype[name] = client;
}
var waitPrototype = {};
function notifyPrototype(name) {
if (waitPrototype[name]) {
waitPrototype[name].registerWhenReady();
delete waitPrototype[name];
}
}
// utility and bookkeeping
// maps tag names to prototypes, as registered with
// Polymer. Prototypes associated with a tag name
// using document.registerElement are available from
// HTMLElement.getPrototypeForTag().
// If an element was fully registered by Polymer, then
// Polymer.getRegisteredPrototype(name) ===
// HTMLElement.getPrototypeForTag(name)
var prototypesByName = {};
function registerPrototype(name, prototype) {
return prototypesByName[name] = prototype || {};
}
function getRegisteredPrototype(name) {
return prototypesByName[name];
}
function instanceOfType(element, type) {
if (typeof type !== 'string') {
return false;
}
var proto = HTMLElement.getPrototypeForTag(type);
var ctor = proto && proto.constructor;
if (!ctor) {
return false;
}
if (CustomElements.instanceof) {
return CustomElements.instanceof(element, ctor);
}
return element instanceof ctor;
}
// exports
scope.getRegisteredPrototype = getRegisteredPrototype;
scope.waitingForPrototype = waitingForPrototype;
scope.instanceOfType = instanceOfType;
// namespace shenanigans so we can expose our scope on the registration
// function
// make window.Polymer reference `element()`
window.Polymer = element;
// TODO(sjmiles): find a way to do this that is less terrible
// copy window.Polymer properties onto `element()`
extend(Polymer, scope);
// Under the HTMLImports polyfill, scripts in the main document
// do not block on imports; we want to allow calls to Polymer in the main
// document. WebComponents collects those calls until we can process them, which
// we do here.
if (WebComponents.consumeDeclarations) {
WebComponents.consumeDeclarations(function(declarations) {
if (declarations) {
for (var i=0, l=declarations.length, d; (i<l) && (d=declarations[i]); i++) {
element.apply(null, d);
}
}
});
}
})(Polymer);
(function(scope) {
/**
* @class polymer-base
*/
/**
* Resolve a url path to be relative to a `base` url. If unspecified, `base`
* defaults to the element's ownerDocument url. Can be used to resolve
* paths from element's in templates loaded in HTMLImports to be relative
* to the document containing the element. Polymer automatically does this for
* url attributes in element templates; however, if a url, for
* example, contains a binding, then `resolvePath` can be used to ensure it is
* relative to the element document. For example, in an element's template,
*
* <a href="{{resolvePath(path)}}">Resolved</a>
*
* @method resolvePath
* @param {String} url Url path to resolve.
* @param {String} base Optional base url against which to resolve, defaults
* to the element's ownerDocument url.
* returns {String} resolved url.
*/
var path = {
resolveElementPaths: function(node) {
Polymer.urlResolver.resolveDom(node);
},
addResolvePathApi: function() {
// let assetpath attribute modify the resolve path
var assetPath = this.getAttribute('assetpath') || '';
var root = new URL(assetPath, this.ownerDocument.baseURI);
this.prototype.resolvePath = function(urlPath, base) {
var u = new URL(urlPath, base || root);
return u.href;
};
}
};
// exports
scope.api.declaration.path = path;
})(Polymer);
(function(scope) {
// imports
var log = window.WebComponents ? WebComponents.flags.log : {};
var api = scope.api.instance.styles;
var STYLE_SCOPE_ATTRIBUTE = api.STYLE_SCOPE_ATTRIBUTE;
var hasShadowDOMPolyfill = window.ShadowDOMPolyfill;
// magic words
var STYLE_SELECTOR = 'style';
var STYLE_LOADABLE_MATCH = '@import';
var SHEET_SELECTOR = 'link[rel=stylesheet]';
var STYLE_GLOBAL_SCOPE = 'global';
var SCOPE_ATTR = 'polymer-scope';
var styles = {
// returns true if resources are loading
loadStyles: function(callback) {
var template = this.fetchTemplate();
var content = template && this.templateContent();
if (content) {
this.convertSheetsToStyles(content);
var styles = this.findLoadableStyles(content);
if (styles.length) {
var templateUrl = template.ownerDocument.baseURI;
return Polymer.styleResolver.loadStyles(styles, templateUrl, callback);
}
}
if (callback) {
callback();
}
},
convertSheetsToStyles: function(root) {
var s$ = root.querySelectorAll(SHEET_SELECTOR);
for (var i=0, l=s$.length, s, c; (i<l) && (s=s$[i]); i++) {
c = createStyleElement(importRuleForSheet(s, this.ownerDocument.baseURI),
this.ownerDocument);
this.copySheetAttributes(c, s);
s.parentNode.replaceChild(c, s);
}
},
copySheetAttributes: function(style, link) {
for (var i=0, a$=link.attributes, l=a$.length, a; (a=a$[i]) && i<l; i++) {
if (a.name !== 'rel' && a.name !== 'href') {
style.setAttribute(a.name, a.value);
}
}
},
findLoadableStyles: function(root) {
var loadables = [];
if (root) {
var s$ = root.querySelectorAll(STYLE_SELECTOR);
for (var i=0, l=s$.length, s; (i<l) && (s=s$[i]); i++) {
if (s.textContent.match(STYLE_LOADABLE_MATCH)) {
loadables.push(s);
}
}
}
return loadables;
},
/**
* Install external stylesheets loaded in <polymer-element> elements into the
* element's template.
* @param elementElement The <element> element to style.
*/
installSheets: function() {
this.cacheSheets();
this.cacheStyles();
this.installLocalSheets();
this.installGlobalStyles();
},
/**
* Remove all sheets from element and store for later use.
*/
cacheSheets: function() {
this.sheets = this.findNodes(SHEET_SELECTOR);
this.sheets.forEach(function(s) {
if (s.parentNode) {
s.parentNode.removeChild(s);
}
});
},
cacheStyles: function() {
this.styles = this.findNodes(STYLE_SELECTOR + '[' + SCOPE_ATTR + ']');
this.styles.forEach(function(s) {
if (s.parentNode) {
s.parentNode.removeChild(s);
}
});
},
/**
* Takes external stylesheets loaded in an <element> element and moves
* their content into a <style> element inside the <element>'s template.
* The sheet is then removed from the <element>. This is done only so
* that if the element is loaded in the main document, the sheet does
* not become active.
* Note, ignores sheets with the attribute 'polymer-scope'.
* @param elementElement The <element> element to style.
*/
installLocalSheets: function () {
var sheets = this.sheets.filter(function(s) {
return !s.hasAttribute(SCOPE_ATTR);
});
var content = this.templateContent();
if (content) {
var cssText = '';
sheets.forEach(function(sheet) {
cssText += cssTextFromSheet(sheet) + '\n';
});
if (cssText) {
var style = createStyleElement(cssText, this.ownerDocument);
content.insertBefore(style, content.firstChild);
}
}
},
findNodes: function(selector, matcher) {
var nodes = this.querySelectorAll(selector).array();
var content = this.templateContent();
if (content) {
var templateNodes = content.querySelectorAll(selector).array();
nodes = nodes.concat(templateNodes);
}
return matcher ? nodes.filter(matcher) : nodes;
},
/**
* Promotes external stylesheets and <style> elements with the attribute
* polymer-scope='global' into global scope.
* This is particularly useful for defining @keyframe rules which
* currently do not function in scoped or shadow style elements.
* (See wkb.ug/72462)
* @param elementElement The <element> element to style.
*/
// TODO(sorvell): remove when wkb.ug/72462 is addressed.
installGlobalStyles: function() {
var style = this.styleForScope(STYLE_GLOBAL_SCOPE);
applyStyleToScope(style, document.head);
},
cssTextForScope: function(scopeDescriptor) {
var cssText = '';
// handle stylesheets
var selector = '[' + SCOPE_ATTR + '=' + scopeDescriptor + ']';
var matcher = function(s) {
return matchesSelector(s, selector);
};
var sheets = this.sheets.filter(matcher);
sheets.forEach(function(sheet) {
cssText += cssTextFromSheet(sheet) + '\n\n';
});
// handle cached style elements
var styles = this.styles.filter(matcher);
styles.forEach(function(style) {
cssText += style.textContent + '\n\n';
});
return cssText;
},
styleForScope: function(scopeDescriptor) {
var cssText = this.cssTextForScope(scopeDescriptor);
return this.cssTextToScopeStyle(cssText, scopeDescriptor);
},
cssTextToScopeStyle: function(cssText, scopeDescriptor) {
if (cssText) {
var style = createStyleElement(cssText);
style.setAttribute(STYLE_SCOPE_ATTRIBUTE, this.getAttribute('name') +
'-' + scopeDescriptor);
return style;
}
}
};
function importRuleForSheet(sheet, baseUrl) {
var href = new URL(sheet.getAttribute('href'), baseUrl).href;
return '@import \'' + href + '\';';
}
function applyStyleToScope(style, scope) {
if (style) {
if (scope === document) {
scope = document.head;
}
if (hasShadowDOMPolyfill) {
scope = document.head;
}
// TODO(sorvell): necessary for IE
// see https://connect.microsoft.com/IE/feedback/details/790212/
// cloning-a-style-element-and-adding-to-document-produces
// -unexpected-result#details
// var clone = style.cloneNode(true);
var clone = createStyleElement(style.textContent);
var attr = style.getAttribute(STYLE_SCOPE_ATTRIBUTE);
if (attr) {
clone.setAttribute(STYLE_SCOPE_ATTRIBUTE, attr);
}
// TODO(sorvell): probably too brittle; try to figure out
// where to put the element.
var refNode = scope.firstElementChild;
if (scope === document.head) {
var selector = 'style[' + STYLE_SCOPE_ATTRIBUTE + ']';
var s$ = document.head.querySelectorAll(selector);
if (s$.length) {
refNode = s$[s$.length-1].nextElementSibling;
}
}
scope.insertBefore(clone, refNode);
}
}
function createStyleElement(cssText, scope) {
scope = scope || document;
scope = scope.createElement ? scope : scope.ownerDocument;
var style = scope.createElement('style');
style.textContent = cssText;
return style;
}
function cssTextFromSheet(sheet) {
return (sheet && sheet.__resource) || '';
}
function matchesSelector(node, inSelector) {
if (matches) {
return matches.call(node, inSelector);
}
}
var p = HTMLElement.prototype;
var matches = p.matches || p.matchesSelector || p.webkitMatchesSelector
|| p.mozMatchesSelector;
// exports
scope.api.declaration.styles = styles;
scope.applyStyleToScope = applyStyleToScope;
})(Polymer);
(function(scope) {
// imports
var log = window.WebComponents ? WebComponents.flags.log : {};
var api = scope.api.instance.events;
var EVENT_PREFIX = api.EVENT_PREFIX;
var mixedCaseEventTypes = {};
[
'webkitAnimationStart',
'webkitAnimationEnd',
'webkitTransitionEnd',
'DOMFocusOut',
'DOMFocusIn',
'DOMMouseScroll'
].forEach(function(e) {
mixedCaseEventTypes[e.toLowerCase()] = e;
});
// polymer-element declarative api: events feature
var events = {
parseHostEvents: function() {
// our delegates map
var delegates = this.prototype.eventDelegates;
// extract data from attributes into delegates
this.addAttributeDelegates(delegates);
},
addAttributeDelegates: function(delegates) {
// for each attribute
for (var i=0, a; a=this.attributes[i]; i++) {
// does it have magic marker identifying it as an event delegate?
if (this.hasEventPrefix(a.name)) {
// if so, add the info to delegates
delegates[this.removeEventPrefix(a.name)] = a.value.replace('{{', '')
.replace('}}', '').trim();
}
}
},
// starts with 'on-'
hasEventPrefix: function (n) {
return n && (n[0] === 'o') && (n[1] === 'n') && (n[2] === '-');
},
removeEventPrefix: function(n) {
return n.slice(prefixLength);
},
findController: function(node) {
while (node.parentNode) {
if (node.eventController) {
return node.eventController;
}
node = node.parentNode;
}
return node.host;
},
getEventHandler: function(controller, target, method) {
var events = this;
return function(e) {
if (!controller || !controller.PolymerBase) {
controller = events.findController(target);
}
var args = [e, e.detail, e.currentTarget];
controller.dispatchMethod(controller, method, args);
};
},
prepareEventBinding: function(pathString, name, node) {
if (!this.hasEventPrefix(name))
return;
var eventType = this.removeEventPrefix(name);
eventType = mixedCaseEventTypes[eventType] || eventType;
var events = this;
return function(model, node, oneTime) {
var handler = events.getEventHandler(undefined, node, pathString);
PolymerGestures.addEventListener(node, eventType, handler);
if (oneTime)
return;
// TODO(rafaelw): This is really pointless work. Aside from the cost
// of these allocations, NodeBind is going to setAttribute back to its
// current value. Fixing this would mean changing the TemplateBinding
// binding delegate API.
function bindingValue() {
return '{{ ' + pathString + ' }}';
}
return {
open: bindingValue,
discardChanges: bindingValue,
close: function() {
PolymerGestures.removeEventListener(node, eventType, handler);
}
};
};
}
};
var prefixLength = EVENT_PREFIX.length;
// exports
scope.api.declaration.events = events;
})(Polymer);
(function(scope) {
// element api
var observationBlacklist = ['attribute'];
var properties = {
inferObservers: function(prototype) {
// called before prototype.observe is chained to inherited object
var observe = prototype.observe, property;
for (var n in prototype) {
if (n.slice(-7) === 'Changed') {
property = n.slice(0, -7);
if (this.canObserveProperty(property)) {
if (!observe) {
observe = (prototype.observe = {});
}
observe[property] = observe[property] || n;
}
}
}
},
canObserveProperty: function(property) {
return (observationBlacklist.indexOf(property) < 0);
},
explodeObservers: function(prototype) {
// called before prototype.observe is chained to inherited object
var o = prototype.observe;
if (o) {
var exploded = {};
for (var n in o) {
var names = n.split(' ');
for (var i=0, ni; ni=names[i]; i++) {
exploded[ni] = o[n];
}
}
prototype.observe = exploded;
}
},
optimizePropertyMaps: function(prototype) {
if (prototype.observe) {
// construct name list
var a = prototype._observeNames = [];
for (var n in prototype.observe) {
var names = n.split(' ');
for (var i=0, ni; ni=names[i]; i++) {
a.push(ni);
}
}
}
if (prototype.publish) {
// construct name list
var a = prototype._publishNames = [];
for (var n in prototype.publish) {
a.push(n);
}
}
if (prototype.computed) {
// construct name list
var a = prototype._computedNames = [];
for (var n in prototype.computed) {
a.push(n);
}
}
},
publishProperties: function(prototype, base) {
// if we have any properties to publish
var publish = prototype.publish;
if (publish) {
// transcribe `publish` entries onto own prototype
this.requireProperties(publish, prototype, base);
// warn and remove accessor names that are broken on some browsers
this.filterInvalidAccessorNames(publish);
// construct map of lower-cased property names
prototype._publishLC = this.lowerCaseMap(publish);
}
var computed = prototype.computed;
if (computed) {
// warn and remove accessor names that are broken on some browsers
this.filterInvalidAccessorNames(computed);
}
},
// Publishing/computing a property where the name might conflict with a
// browser property is not currently supported to help users of Polymer
// avoid browser bugs:
//
// https://code.google.com/p/chromium/issues/detail?id=43394
// https://bugs.webkit.org/show_bug.cgi?id=49739
//
// We can lift this restriction when those bugs are fixed.
filterInvalidAccessorNames: function(propertyNames) {
for (var name in propertyNames) {
// Check if the name is in our blacklist.
if (this.propertyNameBlacklist[name]) {
console.warn('Cannot define property "' + name + '" for element "' +
this.name + '" because it has the same name as an HTMLElement ' +
'property, and not all browsers support overriding that. ' +
'Consider giving it a different name.');
// Remove the invalid accessor from the list.
delete propertyNames[name];
}
}
},
//
// `name: value` entries in the `publish` object may need to generate
// matching properties on the prototype.
//
// Values that are objects may have a `reflect` property, which
// signals that the value describes property control metadata.
// In metadata objects, the prototype default value (if any)
// is encoded in the `value` property.
//
// publish: {
// foo: 5,
// bar: {value: true, reflect: true},
// zot: {}
// }
//
// `reflect` metadata property controls whether changes to the property
// are reflected back to the attribute (default false).
//
// A value is stored on the prototype unless it's === `undefined`,
// in which case the base chain is checked for a value.
// If the basal value is also undefined, `null` is stored on the prototype.
//
// The reflection data is stored on another prototype object, `reflect`
// which also can be specified directly.
//
// reflect: {
// foo: true
// }
//
requireProperties: function(propertyInfos, prototype, base) {
// per-prototype storage for reflected properties
prototype.reflect = prototype.reflect || {};
// ensure a prototype value for each property
// and update the property's reflect to attribute status
for (var n in propertyInfos) {
var value = propertyInfos[n];
// value has metadata if it has a `reflect` property
if (value && value.reflect !== undefined) {
prototype.reflect[n] = Boolean(value.reflect);
value = value.value;
}
// only set a value if one is specified
if (value !== undefined) {
prototype[n] = value;
}
}
},
lowerCaseMap: function(properties) {
var map = {};
for (var n in properties) {
map[n.toLowerCase()] = n;
}
return map;
},
createPropertyAccessor: function(name, ignoreWrites) {
var proto = this.prototype;
var privateName = name + '_';
var privateObservable = name + 'Observable_';
proto[privateName] = proto[name];
Object.defineProperty(proto, name, {
get: function() {
var observable = this[privateObservable];
if (observable)
observable.deliver();
return this[privateName];
},
set: function(value) {
if (ignoreWrites) {
return this[privateName];
}
var observable = this[privateObservable];
if (observable) {
observable.setValue(value);
return;
}
var oldValue = this[privateName];
this[privateName] = value;
this.emitPropertyChangeRecord(name, value, oldValue);
return value;
},
configurable: true
});
},
createPropertyAccessors: function(prototype) {
var n$ = prototype._computedNames;
if (n$ && n$.length) {
for (var i=0, l=n$.length, n, fn; (i<l) && (n=n$[i]); i++) {
this.createPropertyAccessor(n, true);
}
}
var n$ = prototype._publishNames;
if (n$ && n$.length) {
for (var i=0, l=n$.length, n, fn; (i<l) && (n=n$[i]); i++) {
// If the property is computed and published, the accessor is created
// above.
if (!prototype.computed || !prototype.computed[n]) {
this.createPropertyAccessor(n);
}
}
}
},
// This list contains some property names that people commonly want to use,
// but won't work because of Chrome/Safari bugs. It isn't an exhaustive
// list. In particular it doesn't contain any property names found on
// subtypes of HTMLElement (e.g. name, value). Rather it attempts to catch
// some common cases.
propertyNameBlacklist: {
children: 1,
'class': 1,
id: 1,
hidden: 1,
style: 1,
title: 1,
}
};
// exports
scope.api.declaration.properties = properties;
})(Polymer);
(function(scope) {
// magic words
var ATTRIBUTES_ATTRIBUTE = 'attributes';
var ATTRIBUTES_REGEX = /\s|,/;
// attributes api
var attributes = {
inheritAttributesObjects: function(prototype) {
// chain our lower-cased publish map to the inherited version
this.inheritObject(prototype, 'publishLC');
// chain our instance attributes map to the inherited version
this.inheritObject(prototype, '_instanceAttributes');
},
publishAttributes: function(prototype, base) {
// merge names from 'attributes' attribute into the 'publish' object
var attributes = this.getAttribute(ATTRIBUTES_ATTRIBUTE);
if (attributes) {
// create a `publish` object if needed.
// the `publish` object is only relevant to this prototype, the
// publishing logic in `declaration/properties.js` is responsible for
// managing property values on the prototype chain.
// TODO(sjmiles): the `publish` object is later chained to it's
// ancestor object, presumably this is only for
// reflection or other non-library uses.
var publish = prototype.publish || (prototype.publish = {});
// names='a b c' or names='a,b,c'
var names = attributes.split(ATTRIBUTES_REGEX);
// record each name for publishing
for (var i=0, l=names.length, n; i<l; i++) {
// remove excess ws
n = names[i].trim();
// looks weird, but causes n to exist on `publish` if it does not;
// a more careful test would need expensive `in` operator
if (n && publish[n] === undefined) {
publish[n] = undefined;
}
}
}
},
// record clonable attributes from <element>
accumulateInstanceAttributes: function() {
// inherit instance attributes
var clonable = this.prototype._instanceAttributes;
// merge attributes from element
var a$ = this.attributes;
for (var i=0, l=a$.length, a; (i<l) && (a=a$[i]); i++) {
if (this.isInstanceAttribute(a.name)) {
clonable[a.name] = a.value;
}
}
},
isInstanceAttribute: function(name) {
return !this.blackList[name] && name.slice(0,3) !== 'on-';
},
// do not clone these attributes onto instances
blackList: {
name: 1,
'extends': 1,
constructor: 1,
noscript: 1,
assetpath: 1,
'cache-csstext': 1
}
};
// add ATTRIBUTES_ATTRIBUTE to the blacklist
attributes.blackList[ATTRIBUTES_ATTRIBUTE] = 1;
// exports
scope.api.declaration.attributes = attributes;
})(Polymer);
(function(scope) {
// imports
var events = scope.api.declaration.events;
var syntax = new PolymerExpressions();
var prepareBinding = syntax.prepareBinding;
// Polymer takes a first crack at the binding to see if it's a declarative
// event handler.
syntax.prepareBinding = function(pathString, name, node) {
return events.prepareEventBinding(pathString, name, node) ||
prepareBinding.call(syntax, pathString, name, node);
};
// declaration api supporting mdv
var mdv = {
syntax: syntax,
fetchTemplate: function() {
return this.querySelector('template');
},
templateContent: function() {
var template = this.fetchTemplate();
return template && template.content;
},
installBindingDelegate: function(template) {
if (template) {
template.bindingDelegate = this.syntax;
}
}
};
// exports
scope.api.declaration.mdv = mdv;
})(Polymer);
(function(scope) {
// imports
var api = scope.api;
var isBase = scope.isBase;
var extend = scope.extend;
var hasShadowDOMPolyfill = window.ShadowDOMPolyfill;
// prototype api
var prototype = {
register: function(name, extendeeName) {
// build prototype combining extendee, Polymer base, and named api
this.buildPrototype(name, extendeeName);
// register our custom element with the platform
this.registerPrototype(name, extendeeName);
// reference constructor in a global named by 'constructor' attribute
this.publishConstructor();
},
buildPrototype: function(name, extendeeName) {
// get our custom prototype (before chaining)
var extension = scope.getRegisteredPrototype(name);
// get basal prototype
var base = this.generateBasePrototype(extendeeName);
// implement declarative features
this.desugarBeforeChaining(extension, base);
// join prototypes
this.prototype = this.chainPrototypes(extension, base);
// more declarative features
this.desugarAfterChaining(name, extendeeName);
},
desugarBeforeChaining: function(prototype, base) {
// back reference declaration element
// TODO(sjmiles): replace `element` with `elementElement` or `declaration`
prototype.element = this;
// transcribe `attributes` declarations onto own prototype's `publish`
this.publishAttributes(prototype, base);
// `publish` properties to the prototype and to attribute watch
this.publishProperties(prototype, base);
// infer observers for `observe` list based on method names
this.inferObservers(prototype);
// desugar compound observer syntax, e.g. 'a b c'
this.explodeObservers(prototype);
},
chainPrototypes: function(prototype, base) {
// chain various meta-data objects to inherited versions
this.inheritMetaData(prototype, base);
// chain custom api to inherited
var chained = this.chainObject(prototype, base);
// x-platform fixup
ensurePrototypeTraversal(chained);
return chained;
},
inheritMetaData: function(prototype, base) {
// chain observe object to inherited
this.inheritObject('observe', prototype, base);
// chain publish object to inherited
this.inheritObject('publish', prototype, base);
// chain reflect object to inherited
this.inheritObject('reflect', prototype, base);
// chain our lower-cased publish map to the inherited version
this.inheritObject('_publishLC', prototype, base);
// chain our instance attributes map to the inherited version
this.inheritObject('_instanceAttributes', prototype, base);
// chain our event delegates map to the inherited version
this.inheritObject('eventDelegates', prototype, base);
},
// implement various declarative features
desugarAfterChaining: function(name, extendee) {
// build side-chained lists to optimize iterations
this.optimizePropertyMaps(this.prototype);
this.createPropertyAccessors(this.prototype);
// install mdv delegate on template
this.installBindingDelegate(this.fetchTemplate());
// install external stylesheets as if they are inline
this.installSheets();
// adjust any paths in dom from imports
this.resolveElementPaths(this);
// compile list of attributes to copy to instances
this.accumulateInstanceAttributes();
// parse on-* delegates declared on `this` element
this.parseHostEvents();
//
// install a helper method this.resolvePath to aid in
// setting resource urls. e.g.
// this.$.image.src = this.resolvePath('images/foo.png')
this.addResolvePathApi();
// under ShadowDOMPolyfill, transforms to approximate missing CSS features
if (hasShadowDOMPolyfill) {
WebComponents.ShadowCSS.shimStyling(this.templateContent(), name,
extendee);
}
// allow custom element access to the declarative context
if (this.prototype.registerCallback) {
this.prototype.registerCallback(this);
}
},
// if a named constructor is requested in element, map a reference
// to the constructor to the given symbol
publishConstructor: function() {
var symbol = this.getAttribute('constructor');
if (symbol) {
window[symbol] = this.ctor;
}
},
// build prototype combining extendee, Polymer base, and named api
generateBasePrototype: function(extnds) {
var prototype = this.findBasePrototype(extnds);
if (!prototype) {
// create a prototype based on tag-name extension
var prototype = HTMLElement.getPrototypeForTag(extnds);
// insert base api in inheritance chain (if needed)
prototype = this.ensureBaseApi(prototype);
// memoize this base
memoizedBases[extnds] = prototype;
}
return prototype;
},
findBasePrototype: function(name) {
return memoizedBases[name];
},
// install Polymer instance api into prototype chain, as needed
ensureBaseApi: function(prototype) {
if (prototype.PolymerBase) {
return prototype;
}
var extended = Object.create(prototype);
// we need a unique copy of base api for each base prototype
// therefore we 'extend' here instead of simply chaining
api.publish(api.instance, extended);
// TODO(sjmiles): sharing methods across prototype chains is
// not supported by 'super' implementation which optimizes
// by memoizing prototype relationships.
// Probably we should have a version of 'extend' that is
// share-aware: it could study the text of each function,
// look for usage of 'super', and wrap those functions in
// closures.
// As of now, there is only one problematic method, so
// we just patch it manually.
// To avoid re-entrancy problems, the special super method
// installed is called `mixinSuper` and the mixin method
// must use this method instead of the default `super`.
this.mixinMethod(extended, prototype, api.instance.mdv, 'bind');
// return buffed-up prototype
return extended;
},
mixinMethod: function(extended, prototype, api, name) {
var $super = function(args) {
return prototype[name].apply(this, args);
};
extended[name] = function() {
this.mixinSuper = $super;
return api[name].apply(this, arguments);
}
},
// ensure prototype[name] inherits from a prototype.prototype[name]
inheritObject: function(name, prototype, base) {
// require an object
var source = prototype[name] || {};
// chain inherited properties onto a new object
prototype[name] = this.chainObject(source, base[name]);
},
// register 'prototype' to custom element 'name', store constructor
registerPrototype: function(name, extendee) {
var info = {
prototype: this.prototype
}
// native element must be specified in extends
var typeExtension = this.findTypeExtension(extendee);
if (typeExtension) {
info.extends = typeExtension;
}
// register the prototype with HTMLElement for name lookup
HTMLElement.register(name, this.prototype);
// register the custom type
this.ctor = document.registerElement(name, info);
},
findTypeExtension: function(name) {
if (name && name.indexOf('-') < 0) {
return name;
} else {
var p = this.findBasePrototype(name);
if (p.element) {
return this.findTypeExtension(p.element.extends);
}
}
}
};
// memoize base prototypes
var memoizedBases = {};
// implementation of 'chainObject' depends on support for __proto__
if (Object.__proto__) {
prototype.chainObject = function(object, inherited) {
if (object && inherited && object !== inherited) {
object.__proto__ = inherited;
}
return object;
}
} else {
prototype.chainObject = function(object, inherited) {
if (object && inherited && object !== inherited) {
var chained = Object.create(inherited);
object = extend(chained, object);
}
return object;
}
}
// On platforms that do not support __proto__ (versions of IE), the prototype
// chain of a custom element is simulated via installation of __proto__.
// Although custom elements manages this, we install it here so it's
// available during desugaring.
function ensurePrototypeTraversal(prototype) {
if (!Object.__proto__) {
var ancestor = Object.getPrototypeOf(prototype);
prototype.__proto__ = ancestor;
if (isBase(ancestor)) {
ancestor.__proto__ = Object.getPrototypeOf(ancestor);
}
}
}
// exports
api.declaration.prototype = prototype;
})(Polymer);
(function(scope) {
/*
Elements are added to a registration queue so that they register in
the proper order at the appropriate time. We do this for a few reasons:
* to enable elements to load resources (like stylesheets)
asynchronously. We need to do this until the platform provides an efficient
alternative. One issue is that remote @import stylesheets are
re-fetched whenever stamped into a shadowRoot.
* to ensure elements loaded 'at the same time' (e.g. via some set of
imports) are registered as a batch. This allows elements to be enured from
upgrade ordering as long as they query the dom tree 1 task after
upgrade (aka domReady). This is a performance tradeoff. On the one hand,
elements that could register while imports are loading are prevented from
doing so. On the other, grouping upgrades into a single task means less
incremental work (for example style recalcs), Also, we can ensure the
document is in a known state at the single quantum of time when
elements upgrade.
*/
var queue = {
// tell the queue to wait for an element to be ready
wait: function(element) {
if (!element.__queue) {
element.__queue = {};
elements.push(element);
}
},
// enqueue an element to the next spot in the queue.
enqueue: function(element, check, go) {
var shouldAdd = element.__queue && !element.__queue.check;
if (shouldAdd) {
queueForElement(element).push(element);
element.__queue.check = check;
element.__queue.go = go;
}
return (this.indexOf(element) !== 0);
},
indexOf: function(element) {
var i = queueForElement(element).indexOf(element);
if (i >= 0 && document.contains(element)) {
i += (HTMLImports.useNative || HTMLImports.ready) ?
importQueue.length : 1e9;
}
return i;
},
// tell the queue an element is ready to be registered
go: function(element) {
var readied = this.remove(element);
if (readied) {
element.__queue.flushable = true;
this.addToFlushQueue(readied);
this.check();
}
},
remove: function(element) {
var i = this.indexOf(element);
if (i !== 0) {
//console.warn('queue order wrong', i);
return;
}
return queueForElement(element).shift();
},
check: function() {
// next
var element = this.nextElement();
if (element) {
element.__queue.check.call(element);
}
if (this.canReady()) {
this.ready();
return true;
}
},
nextElement: function() {
return nextQueued();
},
canReady: function() {
return !this.waitToReady && this.isEmpty();
},
isEmpty: function() {
for (var i=0, l=elements.length, e; (i<l) &&
(e=elements[i]); i++) {
if (e.__queue && !e.__queue.flushable) {
return;
}
}
return true;
},
addToFlushQueue: function(element) {
flushQueue.push(element);
},
flush: function() {
// prevent re-entrance
if (this.flushing) {
return;
}
this.flushing = true;
var element;
while (flushQueue.length) {
element = flushQueue.shift();
element.__queue.go.call(element);
element.__queue = null;
}
this.flushing = false;
},
ready: function() {
// TODO(sorvell): As an optimization, turn off CE polyfill upgrading
// while registering. This way we avoid having to upgrade each document
// piecemeal per registration and can instead register all elements
// and upgrade once in a batch. Without this optimization, upgrade time
// degrades significantly when SD polyfill is used. This is mainly because
// querying the document tree for elements is slow under the SD polyfill.
var polyfillWasReady = CustomElements.ready;
CustomElements.ready = false;
this.flush();
if (!CustomElements.useNative) {
CustomElements.upgradeDocumentTree(document);
}
CustomElements.ready = polyfillWasReady;
Polymer.flush();
requestAnimationFrame(this.flushReadyCallbacks);
},
addReadyCallback: function(callback) {
if (callback) {
readyCallbacks.push(callback);
}
},
flushReadyCallbacks: function() {
if (readyCallbacks) {
var fn;
while (readyCallbacks.length) {
fn = readyCallbacks.shift();
fn();
}
}
},
/**
Returns a list of elements that have had polymer-elements created but
are not yet ready to register. The list is an array of element definitions.
*/
waitingFor: function() {
var e$ = [];
for (var i=0, l=elements.length, e; (i<l) &&
(e=elements[i]); i++) {
if (e.__queue && !e.__queue.flushable) {
e$.push(e);
}
}
return e$;
},
waitToReady: true
};
var elements = [];
var flushQueue = [];
var importQueue = [];
var mainQueue = [];
var readyCallbacks = [];
function queueForElement(element) {
return document.contains(element) ? mainQueue : importQueue;
}
function nextQueued() {
return importQueue.length ? importQueue[0] : mainQueue[0];
}
function whenReady(callback) {
queue.waitToReady = true;
Polymer.endOfMicrotask(function() {
HTMLImports.whenReady(function() {
queue.addReadyCallback(callback);
queue.waitToReady = false;
queue.check();
});
});
}
/**
Forces polymer to register any pending elements. Can be used to abort
waiting for elements that are partially defined.
@param timeout {Integer} Optional timeout in milliseconds
*/
function forceReady(timeout) {
if (timeout === undefined) {
queue.ready();
return;
}
var handle = setTimeout(function() {
queue.ready();
}, timeout);
Polymer.whenReady(function() {
clearTimeout(handle);
});
}
// exports
scope.elements = elements;
scope.waitingFor = queue.waitingFor.bind(queue);
scope.forceReady = forceReady;
scope.queue = queue;
scope.whenReady = scope.whenPolymerReady = whenReady;
})(Polymer);
(function(scope) {
// imports
var extend = scope.extend;
var api = scope.api;
var queue = scope.queue;
var whenReady = scope.whenReady;
var getRegisteredPrototype = scope.getRegisteredPrototype;
var waitingForPrototype = scope.waitingForPrototype;
// declarative implementation: <polymer-element>
var prototype = extend(Object.create(HTMLElement.prototype), {
createdCallback: function() {
if (this.getAttribute('name')) {
this.init();
}
},
init: function() {
// fetch declared values
this.name = this.getAttribute('name');
this.extends = this.getAttribute('extends');
queue.wait(this);
// initiate any async resource fetches
this.loadResources();
// register when all constraints are met
this.registerWhenReady();
},
// TODO(sorvell): we currently queue in the order the prototypes are
// registered, but we should queue in the order that polymer-elements
// are registered. We are currently blocked from doing this based on
// crbug.com/395686.
registerWhenReady: function() {
if (this.registered
|| this.waitingForPrototype(this.name)
|| this.waitingForQueue()
|| this.waitingForResources()) {
return;
}
queue.go(this);
},
_register: function() {
//console.log('registering', this.name);
// warn if extending from a custom element not registered via Polymer
if (isCustomTag(this.extends) && !isRegistered(this.extends)) {
console.warn('%s is attempting to extend %s, an unregistered element ' +
'or one that was not registered with Polymer.', this.name,
this.extends);
}
this.register(this.name, this.extends);
this.registered = true;
},
waitingForPrototype: function(name) {
if (!getRegisteredPrototype(name)) {
// then wait for a prototype
waitingForPrototype(name, this);
// emulate script if user is not supplying one
this.handleNoScript(name);
// prototype not ready yet
return true;
}
},
handleNoScript: function(name) {
// if explicitly marked as 'noscript'
if (this.hasAttribute('noscript') && !this.noscript) {
this.noscript = true;
// imperative element registration
Polymer(name);
}
},
waitingForResources: function() {
return this._needsResources;
},
// NOTE: Elements must be queued in proper order for inheritance/composition
// dependency resolution. Previously this was enforced for inheritance,
// and by rule for composition. It's now entirely by rule.
waitingForQueue: function() {
return queue.enqueue(this, this.registerWhenReady, this._register);
},
loadResources: function() {
this._needsResources = true;
this.loadStyles(function() {
this._needsResources = false;
this.registerWhenReady();
}.bind(this));
}
});
// semi-pluggable APIs
// TODO(sjmiles): should be fully pluggable (aka decoupled, currently
// the various plugins are allowed to depend on each other directly)
api.publish(api.declaration, prototype);
// utility and bookkeeping
function isRegistered(name) {
return Boolean(HTMLElement.getPrototypeForTag(name));
}
function isCustomTag(name) {
return (name && name.indexOf('-') >= 0);
}
// boot tasks
whenReady(function() {
document.body.removeAttribute('unresolved');
document.dispatchEvent(
new CustomEvent('polymer-ready', {bubbles: true})
);
});
// register polymer-element with document
document.registerElement('polymer-element', {prototype: prototype});
})(Polymer);
(function(scope) {
/**
* @class Polymer
*/
var whenReady = scope.whenReady;
/**
* Loads the set of HTMLImports contained in `node`. Notifies when all
* the imports have loaded by calling the `callback` function argument.
* This method can be used to lazily load imports. For example, given a
* template:
*
* <template>
* <link rel="import" href="my-import1.html">
* <link rel="import" href="my-import2.html">
* </template>
*
* Polymer.importElements(template.content, function() {
* console.log('imports lazily loaded');
* });
*
* @method importElements
* @param {Node} node Node containing the HTMLImports to load.
* @param {Function} callback Callback called when all imports have loaded.
*/
function importElements(node, callback) {
if (node) {
document.head.appendChild(node);
whenReady(callback);
} else if (callback) {
callback();
}
}
/**
* Loads an HTMLImport for each url specified in the `urls` array.
* Notifies when all the imports have loaded by calling the `callback`
* function argument. This method can be used to lazily load imports.
* For example,
*
* Polymer.import(['my-import1.html', 'my-import2.html'], function() {
* console.log('imports lazily loaded');
* });
*
* @method import
* @param {Array} urls Array of urls to load as HTMLImports.
* @param {Function} callback Callback called when all imports have loaded.
*/
function _import(urls, callback) {
if (urls && urls.length) {
var frag = document.createDocumentFragment();
for (var i=0, l=urls.length, url, link; (i<l) && (url=urls[i]); i++) {
link = document.createElement('link');
link.rel = 'import';
link.href = url;
frag.appendChild(link);
}
importElements(frag, callback);
} else if (callback) {
callback();
}
}
// exports
scope.import = _import;
scope.importElements = importElements;
})(Polymer);
/**
* The `auto-binding` element extends the template element. It provides a quick
* and easy way to do data binding without the need to setup a model.
* The `auto-binding` element itself serves as the model and controller for the
* elements it contains. Both data and event handlers can be bound.
*
* The `auto-binding` element acts just like a template that is bound to
* a model. It stamps its content in the dom adjacent to itself. When the
* content is stamped, the `template-bound` event is fired.
*
* Example:
*
* <template is="auto-binding">
* <div>Say something: <input value="{{value}}"></div>
* <div>You said: {{value}}</div>
* <button on-tap="{{buttonTap}}">Tap me!</button>
* </template>
* <script>
* var template = document.querySelector('template');
* template.value = 'something';
* template.buttonTap = function() {
* console.log('tap!');
* };
* </script>
*
* @module Polymer
* @status stable
*/
(function() {
var element = document.createElement('polymer-element');
element.setAttribute('name', 'auto-binding');
element.setAttribute('extends', 'template');
element.init();
Polymer('auto-binding', {
createdCallback: function() {
this.syntax = this.bindingDelegate = this.makeSyntax();
// delay stamping until polymer-ready so that auto-binding is not
// required to load last.
Polymer.whenPolymerReady(function() {
this.model = this;
this.setAttribute('bind', '');
// we don't bother with an explicit signal here, we could ust a MO
// if necessary
this.async(function() {
// note: this will marshall *all* the elements in the parentNode
// rather than just stamped ones. We'd need to use createInstance
// to fix this or something else fancier.
this.marshalNodeReferences(this.parentNode);
// template stamping is asynchronous so stamping isn't complete
// by polymer-ready; fire an event so users can use stamped elements
this.fire('template-bound');
});
}.bind(this));
},
makeSyntax: function() {
var events = Object.create(Polymer.api.declaration.events);
var self = this;
events.findController = function() { return self.model; };
var syntax = new PolymerExpressions();
var prepareBinding = syntax.prepareBinding;
syntax.prepareBinding = function(pathString, name, node) {
return events.prepareEventBinding(pathString, name, node) ||
prepareBinding.call(syntax, pathString, name, node);
};
return syntax;
}
});
})();
|
docs/src/sections/CarouselSection.js
|
Sipree/react-bootstrap
|
import React from 'react';
import Anchor from '../Anchor';
import PropTable from '../PropTable';
import ReactPlayground from '../ReactPlayground';
import Samples from '../Samples';
export default function CarouselSection() {
return (
<div className="bs-docs-section">
<h2 className="page-header">
<Anchor id="carousels">Carousels</Anchor> <small>Carousel, CarouselItem</small>
</h2>
<h3><Anchor id="carousels-uncontrolled">Uncontrolled</Anchor></h3>
<p>Allow the component to control its own state.</p>
<ReactPlayground codeText={Samples.CarouselUncontrolled} exampleClassName="bs-example-tabs" />
<h3><Anchor id="carousels-controlled">Controlled</Anchor></h3>
<p>Pass down the active state on render via props.</p>
<ReactPlayground codeText={Samples.CarouselControlled} exampleClassName="bs-example-tabs" />
<h3><Anchor id="carousels-props">Props</Anchor></h3>
<h4><Anchor id="carousels-props-carousel">Carousel</Anchor></h4>
<PropTable component="Carousel"/>
<h4><Anchor id="carousels-props-item">CarouselItem</Anchor></h4>
<PropTable component="CarouselItem"/>
</div>
);
}
|
src/components/FileSelector/__tests__/FileSelector.spec.js
|
propertybase/react-lds
|
import React from 'react';
import { mount } from 'enzyme';
import Dropzone from 'react-dropzone';
import FileSelector from '../FileSelector';
import { FormElementError, FormElement } from '../../Form';
const getComponent = (props = {}) => mount(
<FileSelector
{...props}
id="file-selector"
buttonText="btn-text"
selectorText="sel-text"
label="label-text"
onDrop={Function.prototype}
/>
);
describe('<FileSelector />', () => {
it('renders different selector types', () => {
const cmp = getComponent({ selectorType: 'images' });
expect(cmp.find('.slds-file-selector').hasClass('slds-file-selector_images')).toBeTruthy();
});
it('renders labels and sets approriate aria-labelledby attribute', () => {
const cmp = getComponent();
const prim = 'file-selector-primary-label';
const sec = 'file-selector-secondary-label';
expect(cmp.find(`#${prim}`).exists()).toBeTruthy();
expect(cmp.find(`#${sec}`).exists()).toBeTruthy();
expect(cmp.find('input').prop('aria-labelledby')).toEqual(`${prim} ${sec}`);
});
it('renders errors and disabled when fatal', () => {
const cmp = getComponent({ error: 'foo' });
const assert = (expectation) => {
expect(cmp.find(Dropzone).prop('disabled')).toEqual(expectation);
expect(cmp.find(FormElementError).prop('error')).toEqual('foo');
expect(cmp.find(FormElement).prop('error')).toEqual('foo');
};
assert(false);
cmp.setProps({ error: null, fatalError: 'foo' });
assert(true);
});
});
|
packages/material-ui-icons/src/LocalMoviesOutlined.js
|
allanalexandre/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><path d="M14 5v14h-4V5h4m6-2h-2v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3zm-4 6V7h2v2h-2zM6 9V7h2v2H6zm10 4v-2h2v2h-2zM6 13v-2h2v2H6zm10 4v-2h2v2h-2zM6 17v-2h2v2H6z" /></React.Fragment>
, 'LocalMoviesOutlined');
|
ajax/libs/babel-core/5.8.29/browser.min.js
|
Piicksarn/cdnjs
|
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.babel=e()}}(function(){var e,t,r;return function n(e,t,r){function i(s,o){if(!t[s]){if(!e[s]){var u="function"==typeof require&&require;if(!o&&u)return u(s,!0);if(a)return a(s,!0);var p=new Error("Cannot find module '"+s+"'");throw p.code="MODULE_NOT_FOUND",p}var l=t[s]={exports:{}};e[s][0].call(l.exports,function(t){var r=e[s][1][t];return i(r?r:t)},l,l.exports,n,e,t,r)}return t[s].exports}for(var a="function"==typeof require&&require,s=0;s<r.length;s++)i(r[s]);return i}({1:[function(e,t,r){},{}],2:[function(e,t,r){function n(e,t){return d.isUndefined(t)?""+t:d.isNumber(t)&&!isFinite(t)?t.toString():d.isFunction(t)||d.isRegExp(t)?t.toString():t}function i(e,t){return d.isString(e)?e.length<t?e:e.slice(0,t):e}function a(e){return i(JSON.stringify(e.actual,n),128)+" "+e.operator+" "+i(JSON.stringify(e.expected,n),128)}function s(e,t,r,n,i){throw new y.AssertionError({message:r,actual:e,expected:t,operator:n,stackStartFunction:i})}function o(e,t){e||s(e,!0,t,"==",y.ok)}function u(e,t){if(e===t)return!0;if(d.isBuffer(e)&&d.isBuffer(t)){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}return d.isDate(e)&&d.isDate(t)?e.getTime()===t.getTime():d.isRegExp(e)&&d.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:d.isObject(e)||d.isObject(t)?l(e,t):e==t}function p(e){return"[object Arguments]"==Object.prototype.toString.call(e)}function l(e,t){if(d.isNullOrUndefined(e)||d.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(d.isPrimitive(e)||d.isPrimitive(t))return e===t;var r=p(e),n=p(t);if(r&&!n||!r&&n)return!1;if(r)return e=h.call(e),t=h.call(t),u(e,t);var i,a,s=g(e),o=g(t);if(s.length!=o.length)return!1;for(s.sort(),o.sort(),a=s.length-1;a>=0;a--)if(s[a]!=o[a])return!1;for(a=s.length-1;a>=0;a--)if(i=s[a],!u(e[i],t[i]))return!1;return!0}function c(e,t){return e&&t?"[object RegExp]"==Object.prototype.toString.call(t)?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1:!1}function f(e,t,r,n){var i;d.isString(r)&&(n=r,r=null);try{t()}catch(a){i=a}if(n=(r&&r.name?" ("+r.name+").":".")+(n?" "+n:"."),e&&!i&&s(i,r,"Missing expected exception"+n),!e&&c(i,r)&&s(i,r,"Got unwanted exception"+n),e&&i&&r&&!c(i,r)||!e&&i)throw i}var d=e(13),h=Array.prototype.slice,m=Object.prototype.hasOwnProperty,y=t.exports=o;y.AssertionError=function(e){this.name="AssertionError",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=a(this),this.generatedMessage=!0);var t=e.stackStartFunction||s;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var r=new Error;if(r.stack){var n=r.stack,i=t.name,o=n.indexOf("\n"+i);if(o>=0){var u=n.indexOf("\n",o+1);n=n.substring(u+1)}this.stack=n}}},d.inherits(y.AssertionError,Error),y.fail=s,y.ok=o,y.equal=function(e,t,r){e!=t&&s(e,t,r,"==",y.equal)},y.notEqual=function(e,t,r){e==t&&s(e,t,r,"!=",y.notEqual)},y.deepEqual=function(e,t,r){u(e,t)||s(e,t,r,"deepEqual",y.deepEqual)},y.notDeepEqual=function(e,t,r){u(e,t)&&s(e,t,r,"notDeepEqual",y.notDeepEqual)},y.strictEqual=function(e,t,r){e!==t&&s(e,t,r,"===",y.strictEqual)},y.notStrictEqual=function(e,t,r){e===t&&s(e,t,r,"!==",y.notStrictEqual)},y["throws"]=function(e,t,r){f.apply(this,[!0].concat(h.call(arguments)))},y.doesNotThrow=function(e,t){f.apply(this,[!1].concat(h.call(arguments)))},y.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var r in e)m.call(e,r)&&t.push(r);return t}},{13:13}],3:[function(e,t,r){(function(t){function n(){function e(){}try{var t=new Uint8Array(1);return t.foo=function(){return 42},t.constructor=e,42===t.foo()&&t.constructor===e&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function i(){return a.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e){return this instanceof a?(this.length=0,this.parent=void 0,"number"==typeof e?s(this,e):"string"==typeof e?o(this,e,arguments.length>1?arguments[1]:"utf8"):u(this,e)):arguments.length>1?new a(e,arguments[1]):new a(e)}function s(e,t){if(e=m(e,0>t?0:0|y(t)),!a.TYPED_ARRAY_SUPPORT)for(var r=0;t>r;r++)e[r]=0;return e}function o(e,t,r){("string"!=typeof r||""===r)&&(r="utf8");var n=0|v(t,r);return e=m(e,n),e.write(t,r),e}function u(e,t){if(a.isBuffer(t))return p(e,t);if(K(t))return l(e,t);if(null==t)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(t.buffer instanceof ArrayBuffer)return c(e,t);if(t instanceof ArrayBuffer)return f(e,t)}return t.length?d(e,t):h(e,t)}function p(e,t){var r=0|y(t.length);return e=m(e,r),t.copy(e,0,0,r),e}function l(e,t){var r=0|y(t.length);e=m(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function c(e,t){var r=0|y(t.length);e=m(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function f(e,t){return a.TYPED_ARRAY_SUPPORT?(t.byteLength,e=a._augment(new Uint8Array(t))):e=c(e,new Uint8Array(t)),e}function d(e,t){var r=0|y(t.length);e=m(e,r);for(var n=0;r>n;n+=1)e[n]=255&t[n];return e}function h(e,t){var r,n=0;"Buffer"===t.type&&K(t.data)&&(r=t.data,n=0|y(r.length)),e=m(e,n);for(var i=0;n>i;i+=1)e[i]=255&r[i];return e}function m(e,t){a.TYPED_ARRAY_SUPPORT?(e=a._augment(new Uint8Array(t)),e.__proto__=a.prototype):(e.length=t,e._isBuffer=!0);var r=0!==t&&t<=a.poolSize>>>1;return r&&(e.parent=$),e}function y(e){if(e>=i())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i().toString(16)+" bytes");return 0|e}function g(e,t){if(!(this instanceof g))return new g(e,t);var r=new a(e,t);return delete r.parent,r}function v(e,t){"string"!=typeof e&&(e=""+e);var r=e.length;if(0===r)return 0;for(var n=!1;;)switch(t){case"ascii":case"binary":case"raw":case"raws":return r;case"utf8":case"utf-8":return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return X(e).length;default:if(n)return G(e).length;t=(""+t).toLowerCase(),n=!0}}function b(e,t,r){var n=!1;if(t=0|t,r=void 0===r||r===1/0?this.length:0|r,e||(e="utf8"),0>t&&(t=0),r>this.length&&(r=this.length),t>=r)return"";for(;;)switch(e){case"hex":return P(this,t,r);case"utf8":case"utf-8":return I(this,t,r);case"ascii":return F(this,t,r);case"binary":return k(this,t,r);case"base64":return w(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function E(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");n>a/2&&(n=a/2);for(var s=0;n>s;s++){var o=parseInt(t.substr(2*s,2),16);if(isNaN(o))throw new Error("Invalid hex string");e[r+s]=o}return s}function x(e,t,r,n){return Y(G(t,e.length-r),e,r,n)}function S(e,t,r,n){return Y(H(t),e,r,n)}function A(e,t,r,n){return S(e,t,r,n)}function D(e,t,r,n){return Y(X(t),e,r,n)}function C(e,t,r,n){return Y(W(t,e.length-r),e,r,n)}function w(e,t,r){return 0===t&&r===e.length?J.fromByteArray(e):J.fromByteArray(e.slice(t,r))}function I(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;r>i;){var a=e[i],s=null,o=a>239?4:a>223?3:a>191?2:1;if(r>=i+o){var u,p,l,c;switch(o){case 1:128>a&&(s=a);break;case 2:u=e[i+1],128===(192&u)&&(c=(31&a)<<6|63&u,c>127&&(s=c));break;case 3:u=e[i+1],p=e[i+2],128===(192&u)&&128===(192&p)&&(c=(15&a)<<12|(63&u)<<6|63&p,c>2047&&(55296>c||c>57343)&&(s=c));break;case 4:u=e[i+1],p=e[i+2],l=e[i+3],128===(192&u)&&128===(192&p)&&128===(192&l)&&(c=(15&a)<<18|(63&u)<<12|(63&p)<<6|63&l,c>65535&&1114112>c&&(s=c))}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}return _(n)}function _(e){var t=e.length;if(Q>=t)return String.fromCharCode.apply(String,e);for(var r="",n=0;t>n;)r+=String.fromCharCode.apply(String,e.slice(n,n+=Q));return r}function F(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(127&e[i]);return n}function k(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;r>i;i++)n+=String.fromCharCode(e[i]);return n}function P(e,t,r){var n=e.length;(!t||0>t)&&(t=0),(!r||0>r||r>n)&&(r=n);for(var i="",a=t;r>a;a++)i+=q(e[a]);return i}function B(e,t,r){for(var n=e.slice(t,r),i="",a=0;a<n.length;a+=2)i+=String.fromCharCode(n[a]+256*n[a+1]);return i}function T(e,t,r){if(e%1!==0||0>e)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function M(e,t,r,n,i,s){if(!a.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||s>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range")}function O(e,t,r,n){0>t&&(t=65535+t+1);for(var i=0,a=Math.min(e.length-r,2);a>i;i++)e[r+i]=(t&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function j(e,t,r,n){0>t&&(t=4294967295+t+1);for(var i=0,a=Math.min(e.length-r,4);a>i;i++)e[r+i]=t>>>8*(n?i:3-i)&255}function L(e,t,r,n,i,a){if(t>i||a>t)throw new RangeError("value is out of bounds");if(r+n>e.length)throw new RangeError("index out of range");if(0>r)throw new RangeError("index out of range")}function N(e,t,r,n,i){return i||L(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38),z.write(e,t,r,n,23,4),r+4}function R(e,t,r,n,i){return i||L(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308),z.write(e,t,r,n,52,8),r+8}function V(e){if(e=U(e).replace(ee,""),e.length<2)return"";for(;e.length%4!==0;)e+="=";return e}function U(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}function q(e){return 16>e?"0"+e.toString(16):e.toString(16)}function G(e,t){t=t||1/0;for(var r,n=e.length,i=null,a=[],s=0;n>s;s++){if(r=e.charCodeAt(s),r>55295&&57344>r){if(!i){if(r>56319){(t-=3)>-1&&a.push(239,191,189);continue}if(s+1===n){(t-=3)>-1&&a.push(239,191,189);continue}i=r;continue}if(56320>r){(t-=3)>-1&&a.push(239,191,189),i=r;continue}r=i-55296<<10|r-56320|65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,128>r){if((t-=1)<0)break;a.push(r)}else if(2048>r){if((t-=2)<0)break;a.push(r>>6|192,63&r|128)}else if(65536>r){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(1114112>r))throw new Error("Invalid code point");if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return a}function H(e){for(var t=[],r=0;r<e.length;r++)t.push(255&e.charCodeAt(r));return t}function W(e,t){for(var r,n,i,a=[],s=0;s<e.length&&!((t-=2)<0);s++)r=e.charCodeAt(s),n=r>>8,i=r%256,a.push(i),a.push(n);return a}function X(e){return J.toByteArray(V(e))}function Y(e,t,r,n){for(var i=0;n>i&&!(i+r>=t.length||i>=e.length);i++)t[i+r]=e[i];return i}var J=e(4),z=e(5),K=e(6);r.Buffer=a,r.SlowBuffer=g,r.INSPECT_MAX_BYTES=50,a.poolSize=8192;var $={};a.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:n(),a.TYPED_ARRAY_SUPPORT&&(a.prototype.__proto__=Uint8Array.prototype,a.__proto__=Uint8Array),a.isBuffer=function(e){return!(null==e||!e._isBuffer)},a.compare=function(e,t){if(!a.isBuffer(e)||!a.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);s>i&&e[i]===t[i];)++i;return i!==s&&(r=e[i],n=t[i]),n>r?-1:r>n?1:0},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){if(!K(e))throw new TypeError("list argument must be an Array of Buffers.");if(0===e.length)return new a(0);var r;if(void 0===t)for(t=0,r=0;r<e.length;r++)t+=e[r].length;var n=new a(t),i=0;for(r=0;r<e.length;r++){var s=e[r];s.copy(n,i),i+=s.length}return n},a.byteLength=v,a.prototype.length=void 0,a.prototype.parent=void 0,a.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?I(this,0,e):b.apply(this,arguments)},a.prototype.equals=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:0===a.compare(this,e)},a.prototype.inspect=function(){var e="",t=r.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},a.prototype.compare=function(e){if(!a.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?0:a.compare(this,e)},a.prototype.indexOf=function(e,t){function r(e,t,r){for(var n=-1,i=0;r+i<e.length;i++)if(e[r+i]===t[-1===n?0:i-n]){if(-1===n&&(n=i),i-n+1===t.length)return r+n}else n=-1;return-1}if(t>2147483647?t=2147483647:-2147483648>t&&(t=-2147483648),t>>=0,0===this.length)return-1;if(t>=this.length)return-1;if(0>t&&(t=Math.max(this.length+t,0)),"string"==typeof e)return 0===e.length?-1:String.prototype.indexOf.call(this,e,t);if(a.isBuffer(e))return r(this,e,t);if("number"==typeof e)return a.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,e,t):r(this,[e],t);throw new TypeError("val must be string, number or Buffer")},a.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},a.prototype.set=function(e,t){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,t)},a.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t=0|t,isFinite(r)?(r=0|r,void 0===n&&(n="utf8")):(n=r,r=void 0);else{var i=n;n=t,t=0|r,r=i}var a=this.length-t;if((void 0===r||r>a)&&(r=a),e.length>0&&(0>r||0>t)||t>this.length)throw new RangeError("attempt to write outside buffer bounds");n||(n="utf8");for(var s=!1;;)switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return x(this,e,t,r);case"ascii":return S(this,e,t,r);case"binary":return A(this,e,t,r);case"base64":return D(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var Q=4096;a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,0>e?(e+=r,0>e&&(e=0)):e>r&&(e=r),0>t?(t+=r,0>t&&(t=0)):t>r&&(t=r),e>t&&(t=e);var n;if(a.TYPED_ARRAY_SUPPORT)n=a._augment(this.subarray(e,t));else{var i=t-e;n=new a(i,void 0);for(var s=0;i>s;s++)n[s]=this[s+e]}return n.length&&(n.parent=this.parent||this),n},a.prototype.readUIntLE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return n},a.prototype.readUIntBE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUInt8=function(e,t){return t||T(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return t||T(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return t||T(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return t||T(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUInt32BE=function(e,t){return t||T(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=this[e],i=1,a=0;++a<t&&(i*=256);)n+=this[e+a]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e=0|e,t=0|t,r||T(e,t,this.length);for(var n=t,i=1,a=this[e+--n];n>0&&(i*=256);)a+=this[e+--n]*i;return i*=128,a>=i&&(a-=Math.pow(2,8*t)),a},a.prototype.readInt8=function(e,t){return t||T(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},a.prototype.readInt16LE=function(e,t){t||T(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){t||T(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return t||T(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return t||T(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return t||T(e,4,this.length),z.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return t||T(e,4,this.length),z.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return t||T(e,8,this.length),z.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return t||T(e,8,this.length),z.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||M(this,e,t,r,Math.pow(2,8*r),0);var i=1,a=0;for(this[t]=255&e;++a<r&&(i*=256);)this[t+a]=e/i&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,n){e=+e,t=0|t,r=0|r,n||M(this,e,t,r,Math.pow(2,8*r),0);var i=r-1,a=1;for(this[t+i]=255&e;--i>=0&&(a*=256);)this[t+i]=e/a&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,1,255,0),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,65535,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):j(this,e,t,!0),t+4},a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,4294967295,0),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var a=0,s=1,o=0>e?1:0;for(this[t]=255&e;++a<r&&(s*=256);)this[t+a]=(e/s>>0)-o&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t=0|t,!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var a=r-1,s=1,o=0>e?1:0;for(this[t+a]=255&e;--a>=0&&(s*=256);)this[t+a]=(e/s>>0)-o&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,1,127,-128),a.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),0>e&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):O(this,e,t,!0),t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,2,32767,-32768),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):O(this,e,t,!1),t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,2147483647,-2147483648),a.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):j(this,e,t,!0),t+4},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t=0|t,r||M(this,e,t,4,2147483647,-2147483648),0>e&&(e=4294967295+e+1),a.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):j(this,e,t,!1),t+4},a.prototype.writeFloatLE=function(e,t,r){return N(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return N(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return R(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return R(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&r>n&&(n=r),n===r)return 0;if(0===e.length||0===this.length)return 0;if(0>t)throw new RangeError("targetStart out of bounds");if(0>r||r>=this.length)throw new RangeError("sourceStart out of bounds");if(0>n)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i,s=n-r;if(this===e&&t>r&&n>t)for(i=s-1;i>=0;i--)e[i+t]=this[i+r];else if(1e3>s||!a.TYPED_ARRAY_SUPPORT)for(i=0;s>i;i++)e[i+t]=this[i+r];else e._set(this.subarray(r,r+s),t);return s},a.prototype.fill=function(e,t,r){if(e||(e=0),t||(t=0),r||(r=this.length),t>r)throw new RangeError("end < start");if(r!==t&&0!==this.length){if(0>t||t>=this.length)throw new RangeError("start out of bounds");if(0>r||r>this.length)throw new RangeError("end out of bounds");var n;if("number"==typeof e)for(n=t;r>n;n++)this[n]=e;else{var i=G(e.toString()),a=i.length;for(n=t;r>n;n++)this[n]=i[n%a]}return this}},a.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(a.TYPED_ARRAY_SUPPORT)return new a(this).buffer;for(var e=new Uint8Array(this.length),t=0,r=e.length;r>t;t+=1)e[t]=this[t];return e.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var Z=a.prototype;a._augment=function(e){return e.constructor=a,e._isBuffer=!0,e._set=e.set,e.get=Z.get,e.set=Z.set,e.write=Z.write,e.toString=Z.toString,e.toLocaleString=Z.toString,e.toJSON=Z.toJSON,e.equals=Z.equals,e.compare=Z.compare,e.indexOf=Z.indexOf,e.copy=Z.copy,e.slice=Z.slice,e.readUIntLE=Z.readUIntLE,e.readUIntBE=Z.readUIntBE,e.readUInt8=Z.readUInt8,e.readUInt16LE=Z.readUInt16LE,e.readUInt16BE=Z.readUInt16BE,e.readUInt32LE=Z.readUInt32LE,e.readUInt32BE=Z.readUInt32BE,e.readIntLE=Z.readIntLE,e.readIntBE=Z.readIntBE,e.readInt8=Z.readInt8,e.readInt16LE=Z.readInt16LE,e.readInt16BE=Z.readInt16BE,e.readInt32LE=Z.readInt32LE,e.readInt32BE=Z.readInt32BE,e.readFloatLE=Z.readFloatLE,e.readFloatBE=Z.readFloatBE,e.readDoubleLE=Z.readDoubleLE,e.readDoubleBE=Z.readDoubleBE,e.writeUInt8=Z.writeUInt8,e.writeUIntLE=Z.writeUIntLE,e.writeUIntBE=Z.writeUIntBE,e.writeUInt16LE=Z.writeUInt16LE,e.writeUInt16BE=Z.writeUInt16BE,e.writeUInt32LE=Z.writeUInt32LE,e.writeUInt32BE=Z.writeUInt32BE,e.writeIntLE=Z.writeIntLE,e.writeIntBE=Z.writeIntBE,e.writeInt8=Z.writeInt8,e.writeInt16LE=Z.writeInt16LE,e.writeInt16BE=Z.writeInt16BE,e.writeInt32LE=Z.writeInt32LE,e.writeInt32BE=Z.writeInt32BE,e.writeFloatLE=Z.writeFloatLE,e.writeFloatBE=Z.writeFloatBE,e.writeDoubleLE=Z.writeDoubleLE,e.writeDoubleBE=Z.writeDoubleBE,e.fill=Z.fill,e.inspect=Z.inspect,e.toArrayBuffer=Z.toArrayBuffer,e};var ee=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{4:4,5:5,6:6}],4:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";!function(e){"use strict";function t(e){var t=e.charCodeAt(0);return t===s||t===c?62:t===o||t===f?63:u>t?-1:u+10>t?t-u+26+26:l+26>t?t-l:p+26>t?t-p+26:void 0}function r(e){function r(e){p[c++]=e}var n,i,s,o,u,p;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var l=e.length;u="="===e.charAt(l-2)?2:"="===e.charAt(l-1)?1:0,p=new a(3*e.length/4-u),s=u>0?e.length-4:e.length;var c=0;for(n=0,i=0;s>n;n+=4,i+=3)o=t(e.charAt(n))<<18|t(e.charAt(n+1))<<12|t(e.charAt(n+2))<<6|t(e.charAt(n+3)),r((16711680&o)>>16),r((65280&o)>>8),r(255&o);return 2===u?(o=t(e.charAt(n))<<2|t(e.charAt(n+1))>>4,r(255&o)):1===u&&(o=t(e.charAt(n))<<10|t(e.charAt(n+1))<<4|t(e.charAt(n+2))>>2,r(o>>8&255),r(255&o)),p}function i(e){function t(e){return n.charAt(e)}function r(e){return t(e>>18&63)+t(e>>12&63)+t(e>>6&63)+t(63&e)}var i,a,s,o=e.length%3,u="";for(i=0,s=e.length-o;s>i;i+=3)a=(e[i]<<16)+(e[i+1]<<8)+e[i+2],u+=r(a);switch(o){case 1:a=e[e.length-1],u+=t(a>>2),u+=t(a<<4&63),u+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1],u+=t(a>>10),u+=t(a>>4&63),u+=t(a<<2&63),u+="="}return u}var a="undefined"!=typeof Uint8Array?Uint8Array:Array,s="+".charCodeAt(0),o="/".charCodeAt(0),u="0".charCodeAt(0),p="a".charCodeAt(0),l="A".charCodeAt(0),c="-".charCodeAt(0),f="_".charCodeAt(0);e.toByteArray=r,e.fromByteArray=i}("undefined"==typeof r?this.base64js={}:r)},{}],5:[function(e,t,r){r.read=function(e,t,r,n,i){var a,s,o=8*i-n-1,u=(1<<o)-1,p=u>>1,l=-7,c=r?i-1:0,f=r?-1:1,d=e[t+c];for(c+=f,a=d&(1<<-l)-1,d>>=-l,l+=o;l>0;a=256*a+e[t+c],c+=f,l-=8);for(s=a&(1<<-l)-1,a>>=-l,l+=n;l>0;s=256*s+e[t+c],c+=f,l-=8);if(0===a)a=1-p;else{if(a===u)return s?NaN:(d?-1:1)*(1/0);s+=Math.pow(2,n),a-=p}return(d?-1:1)*s*Math.pow(2,a-n)},r.write=function(e,t,r,n,i,a){var s,o,u,p=8*a-i-1,l=(1<<p)-1,c=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:a-1,h=n?1:-1,m=0>t||0===t&&0>1/t?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(o=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-s))<1&&(s--,u*=2),t+=s+c>=1?f/u:f*Math.pow(2,1-c),t*u>=2&&(s++,u/=2),s+c>=l?(o=0,s=l):s+c>=1?(o=(t*u-1)*Math.pow(2,i),s+=c):(o=t*Math.pow(2,c-1)*Math.pow(2,i),s=0));i>=8;e[r+d]=255&o,d+=h,o/=256,i-=8);for(s=s<<i|o,p+=i;p>0;e[r+d]=255&s,d+=h,s/=256,p-=8);e[r+d-h]|=128*m}},{}],6:[function(e,t,r){var n=Array.isArray,i=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],7:[function(e,t,r){"function"==typeof Object.create?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}},{}],8:[function(e,t,r){r.endianness=function(){return"LE"},r.hostname=function(){return"undefined"!=typeof location?location.hostname:""},r.loadavg=function(){return[]},r.uptime=function(){return 0},r.freemem=function(){return Number.MAX_VALUE},r.totalmem=function(){return Number.MAX_VALUE},r.cpus=function(){return[]},r.type=function(){return"Browser"},r.release=function(){return"undefined"!=typeof navigator?navigator.appVersion:""},r.networkInterfaces=r.getNetworkInterfaces=function(){return{}},r.arch=function(){return"javascript"},r.platform=function(){return"browser"},r.tmpdir=r.tmpDir=function(){return"/tmp"},r.EOL="\n"},{}],9:[function(e,t,r){(function(e){function t(e,t){for(var r=0,n=e.length-1;n>=0;n--){var i=e[n];"."===i?e.splice(n,1):".."===i?(e.splice(n,1),r++):r&&(e.splice(n,1),r--)}if(t)for(;r--;r)e.unshift("..");return e}function n(e,t){if(e.filter)return e.filter(t);for(var r=[],n=0;n<e.length;n++)t(e[n],n,e)&&r.push(e[n]);return r}var i=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,a=function(e){return i.exec(e).slice(1)};r.resolve=function(){for(var r="",i=!1,a=arguments.length-1;a>=-1&&!i;a--){var s=a>=0?arguments[a]:e.cwd();if("string"!=typeof s)throw new TypeError("Arguments to path.resolve must be strings");s&&(r=s+"/"+r,i="/"===s.charAt(0))}return r=t(n(r.split("/"),function(e){return!!e}),!i).join("/"),(i?"/":"")+r||"."},r.normalize=function(e){var i=r.isAbsolute(e),a="/"===s(e,-1);return e=t(n(e.split("/"),function(e){return!!e}),!i).join("/"),e||i||(e="."),e&&a&&(e+="/"),(i?"/":"")+e},r.isAbsolute=function(e){return"/"===e.charAt(0)},r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(n(e,function(e,t){if("string"!=typeof e)throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))},r.relative=function(e,t){function n(e){for(var t=0;t<e.length&&""===e[t];t++);for(var r=e.length-1;r>=0&&""===e[r];r--);return t>r?[]:e.slice(t,r-t+1)}e=r.resolve(e).substr(1),t=r.resolve(t).substr(1);for(var i=n(e.split("/")),a=n(t.split("/")),s=Math.min(i.length,a.length),o=s,u=0;s>u;u++)if(i[u]!==a[u]){o=u;break}for(var p=[],u=o;u<i.length;u++)p.push("..");return p=p.concat(a.slice(o)),p.join("/")},r.sep="/",r.delimiter=":",r.dirname=function(e){var t=a(e),r=t[0],n=t[1];return r||n?(n&&(n=n.substr(0,n.length-1)),r+n):"."},r.basename=function(e,t){var r=a(e)[2];return t&&r.substr(-1*t.length)===t&&(r=r.substr(0,r.length-t.length)),r},r.extname=function(e){return a(e)[3]};var s="b"==="ab".substr(-1)?function(e,t,r){return e.substr(t,r)}:function(e,t,r){return 0>t&&(t=e.length+t),e.substr(t,r)}}).call(this,e(10))},{10:10}],10:[function(e,t,r){function n(){l=!1,o.length?p=o.concat(p):c=-1,p.length&&i()}function i(){if(!l){var e=setTimeout(n);l=!0;for(var t=p.length;t;){for(o=p,p=[];++c<t;)o&&o[c].run();c=-1,t=p.length}o=null,l=!1,clearTimeout(e)}}function a(e,t){this.fun=e,this.array=t}function s(){}var o,u=t.exports={},p=[],l=!1,c=-1;u.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];p.push(new a(e,t)),1!==p.length||l||setTimeout(i,0)},a.prototype.run=function(){this.fun.apply(null,this.array)},u.title="browser",u.browser=!0,u.env={},u.argv=[],u.version="",u.versions={},u.on=s,u.addListener=s,u.once=s,u.off=s,u.removeListener=s,u.removeAllListeners=s,u.emit=s,u.binding=function(e){throw new Error("process.binding is not supported")},u.cwd=function(){return"/"},u.chdir=function(e){throw new Error("process.chdir is not supported")},u.umask=function(){return 0}},{}],11:[function(e,t,r){function n(){throw new Error("tty.ReadStream is not implemented")}function i(){throw new Error("tty.ReadStream is not implemented")}r.isatty=function(){return!1},r.ReadStream=n,r.WriteStream=i},{}],12:[function(e,t,r){t.exports=function(e){return e&&"object"==typeof e&&"function"==typeof e.copy&&"function"==typeof e.fill&&"function"==typeof e.readUInt8}},{}],13:[function(e,t,r){(function(t,n){function i(e,t){var n={seen:[],stylize:s};return arguments.length>=3&&(n.depth=arguments[2]),arguments.length>=4&&(n.colors=arguments[3]),m(t)?n.showHidden=t:t&&r._extend(n,t),x(n.showHidden)&&(n.showHidden=!1),x(n.depth)&&(n.depth=2),x(n.colors)&&(n.colors=!1),x(n.customInspect)&&(n.customInspect=!0),n.colors&&(n.stylize=a),u(n,e,n.depth)}function a(e,t){var r=i.styles[t];return r?"["+i.colors[r][0]+"m"+e+"["+i.colors[r][1]+"m":e}function s(e,t){return e}function o(e){var t={};return e.forEach(function(e,r){t[e]=!0}),t}function u(e,t,n){if(e.customInspect&&t&&w(t.inspect)&&t.inspect!==r.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(n,e);return b(i)||(i=u(e,i,n)),i}var a=p(e,t);if(a)return a;var s=Object.keys(t),m=o(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),C(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return l(t);if(0===s.length){if(w(t)){var y=t.name?": "+t.name:"";return e.stylize("[Function"+y+"]","special")}if(S(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(D(t))return e.stylize(Date.prototype.toString.call(t),"date");if(C(t))return l(t)}var g="",v=!1,E=["{","}"];if(h(t)&&(v=!0,E=["[","]"]),w(t)){var x=t.name?": "+t.name:"";g=" [Function"+x+"]"}if(S(t)&&(g=" "+RegExp.prototype.toString.call(t)),D(t)&&(g=" "+Date.prototype.toUTCString.call(t)),C(t)&&(g=" "+l(t)),0===s.length&&(!v||0==t.length))return E[0]+g+E[1];if(0>n)return S(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var A;return A=v?c(e,t,n,m,s):s.map(function(r){return f(e,t,n,m,r,v)}),e.seen.pop(),d(A,g,E)}function p(e,t){if(x(t))return e.stylize("undefined","undefined");if(b(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}return v(t)?e.stylize(""+t,"number"):m(t)?e.stylize(""+t,"boolean"):y(t)?e.stylize("null","null"):void 0}function l(e){return"["+Error.prototype.toString.call(e)+"]"}function c(e,t,r,n,i){for(var a=[],s=0,o=t.length;o>s;++s)P(t,String(s))?a.push(f(e,t,r,n,String(s),!0)):a.push("");return i.forEach(function(i){i.match(/^\d+$/)||a.push(f(e,t,r,n,i,!0))}),a}function f(e,t,r,n,i,a){var s,o,p;if(p=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},p.get?o=p.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):p.set&&(o=e.stylize("[Setter]","special")),P(n,i)||(s="["+i+"]"),o||(e.seen.indexOf(p.value)<0?(o=y(r)?u(e,p.value,null):u(e,p.value,r-1),o.indexOf("\n")>-1&&(o=a?o.split("\n").map(function(e){return" "+e}).join("\n").substr(2):"\n"+o.split("\n").map(function(e){return" "+e}).join("\n"))):o=e.stylize("[Circular]","special")),x(s)){if(a&&i.match(/^\d+$/))return o;
s=JSON.stringify(""+i),s.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(s=s.substr(1,s.length-2),s=e.stylize(s,"name")):(s=s.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),s=e.stylize(s,"string"))}return s+": "+o}function d(e,t,r){var n=0,i=e.reduce(function(e,t){return n++,t.indexOf("\n")>=0&&n++,e+t.replace(/\u001b\[\d\d?m/g,"").length+1},0);return i>60?r[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function h(e){return Array.isArray(e)}function m(e){return"boolean"==typeof e}function y(e){return null===e}function g(e){return null==e}function v(e){return"number"==typeof e}function b(e){return"string"==typeof e}function E(e){return"symbol"==typeof e}function x(e){return void 0===e}function S(e){return A(e)&&"[object RegExp]"===_(e)}function A(e){return"object"==typeof e&&null!==e}function D(e){return A(e)&&"[object Date]"===_(e)}function C(e){return A(e)&&("[object Error]"===_(e)||e instanceof Error)}function w(e){return"function"==typeof e}function I(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||"undefined"==typeof e}function _(e){return Object.prototype.toString.call(e)}function F(e){return 10>e?"0"+e.toString(10):e.toString(10)}function k(){var e=new Date,t=[F(e.getHours()),F(e.getMinutes()),F(e.getSeconds())].join(":");return[e.getDate(),O[e.getMonth()],t].join(" ")}function P(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var B=/%[sdj%]/g;r.format=function(e){if(!b(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(i(arguments[r]));return t.join(" ")}for(var r=1,n=arguments,a=n.length,s=String(e).replace(B,function(e){if("%%"===e)return"%";if(r>=a)return e;switch(e){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch(t){return"[Circular]"}default:return e}}),o=n[r];a>r;o=n[++r])s+=y(o)||!A(o)?" "+o:" "+i(o);return s},r.deprecate=function(e,i){function a(){if(!s){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),s=!0}return e.apply(this,arguments)}if(x(n.process))return function(){return r.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var s=!1;return a};var T,M={};r.debuglog=function(e){if(x(T)&&(T=t.env.NODE_DEBUG||""),e=e.toUpperCase(),!M[e])if(new RegExp("\\b"+e+"\\b","i").test(T)){var n=t.pid;M[e]=function(){var t=r.format.apply(r,arguments);console.error("%s %d: %s",e,n,t)}}else M[e]=function(){};return M[e]},r.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},r.isArray=h,r.isBoolean=m,r.isNull=y,r.isNullOrUndefined=g,r.isNumber=v,r.isString=b,r.isSymbol=E,r.isUndefined=x,r.isRegExp=S,r.isObject=A,r.isDate=D,r.isError=C,r.isFunction=w,r.isPrimitive=I,r.isBuffer=e(12);var O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];r.log=function(){console.log("%s - %s",k(),r.format.apply(r,arguments))},r.inherits=e(7),r._extend=function(e,t){if(!t||!A(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}}).call(this,e(10),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10,12:12,7:7}],14:[function(e,t,r){(function(r){"use strict";e(15);var n=t.exports=e(66);n.options=e(49),n.version=e(603).version,n.transform=n,n.run=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.sourceMaps="inline",new Function(n(e,t).code)()},n.load=function(e,t,i,a){void 0===i&&(i={}),i.filename=i.filename||e;var s=r.ActiveXObject?new r.ActiveXObject("Microsoft.XMLHTTP"):new r.XMLHttpRequest;s.open("GET",e,!0),"overrideMimeType"in s&&s.overrideMimeType("text/plain"),s.onreadystatechange=function(){if(4===s.readyState){var r=s.status;if(0!==r&&200!==r)throw new Error("Could not load "+e);var o=[s.responseText,i];a||n.run.apply(n,o),t&&t(o)}},s.send(null)};var i=function(){for(var e=[],t=["text/ecmascript-6","text/6to5","text/babel","module"],i=0,a=function l(){var t=e[i];t instanceof Array&&(n.run.apply(n,t),i++,l())},s=function(t,r){var i={};t.src?n.load(t.src,function(t){e[r]=t,a()},i,!0):(i.filename="embedded",e[r]=[t.innerHTML,i])},o=r.document.getElementsByTagName("script"),u=0;u<o.length;++u){var p=o[u];t.indexOf(p.type)>=0&&e.push(p)}for(u in e)s(e[u],u);a()};r.addEventListener?r.addEventListener("DOMContentLoaded",i,!1):r.attachEvent&&r.attachEvent("onload",i)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{15:15,49:49,603:603,66:66}],15:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e["default"]:e}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){return e&&e.__esModule?e:{"default":e}}function s(t){var r=e(17);return null!=t&&r(t),r}function o(){e(44)}function u(e,t,r){f["default"](t)&&(r=t,t={}),t.filename=e,E["default"].readFile(e,function(e,n){if(e)return r(e);var i;try{i=h["default"](n,t)}catch(e){return r(e)}r(null,i)})}function p(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.filename=e,h["default"](E["default"].readFileSync(e,"utf8"),t)}function l(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.allowHashBang=!0,t.sourceType="module",t.ecmaVersion=1/0,t.plugins={jsx:!0,flow:!0},t.features={};for(var r in h["default"].pipeline.transformers)t.features[r]=!0;var n=y.parse(e,t);if(t.onToken){var i;(i=t.onToken).push.apply(i,n.tokens)}if(t.onComment){var a;(a=t.onComment).push.apply(a,n.comments)}return n.program}r.__esModule=!0,r.register=s,r.polyfill=o,r.transformFile=u,r.transformFileSync=p,r.parse=l;var c=e(500),f=a(c),d=e(66),h=a(d),m=e(605),y=i(m),g=e(182),v=i(g),b=e(1),E=a(b),x=e(179),S=i(x);r.util=v,r.acorn=y,r.transform=h["default"],r.pipeline=d.pipeline,r.canCompile=g.canCompile;var A=e(46);r.File=n(A);var D=e(48);r.options=n(D);var C=e(82);r.Plugin=n(C);var w=e(83);r.Transformer=n(w);var I=e(80);r.Pipeline=n(I);var _=e(148);r.traverse=n(_);var F=e(45);r.buildExternalHelpers=n(F);var k=e(603);r.version=k.version,r.types=S},{1:1,148:148,17:17,179:179,182:182,44:44,45:45,46:46,48:48,500:500,603:603,605:605,66:66,80:80,82:82,83:83}],16:[function(e,t,r){"use strict";r.__esModule=!0,e(44),r["default"]=function(){},t.exports=r["default"]},{44:44}],17:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e["default"]:e}r.__esModule=!0,e(44);var i=e(16);r["default"]=n(i),t.exports=r["default"]},{16:16,44:44}],18:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(584),s=n(a),o=e(601),u=n(o),p=e(498),l=n(p),c=e(413),f=n(c),d=e(502),h=n(d),m=function(){function e(t,r){i(this,e),this.parenPushNewlineState=null,this.position=t,this._indent=r.indent.base,this.format=r,this.buf=""}return e.prototype.get=function(){return u["default"](this.buf)},e.prototype.getIndent=function(){return this.format.compact||this.format.concise?"":s["default"](this.format.indent.style,this._indent)},e.prototype.indentSize=function(){return this.getIndent().length},e.prototype.indent=function(){this._indent++},e.prototype.dedent=function(){this._indent--},e.prototype.semicolon=function(){this.push(";")},e.prototype.ensureSemicolon=function(){this.isLast(";")||this.semicolon()},e.prototype.rightBrace=function(){this.newline(!0),this.push("}")},e.prototype.keyword=function(e){this.push(e),this.space()},e.prototype.space=function(e){(e||!this.format.compact)&&(e||this.buf&&!this.isLast(" ")&&!this.isLast("\n"))&&this.push(" ")},e.prototype.removeLast=function(e){this.format.compact||this.isLast(e)&&(this.buf=this.buf.substr(0,this.buf.length-1),this.position.unshift(e))},e.prototype.startTerminatorless=function(){return this.parenPushNewlineState={printed:!1}},e.prototype.endTerminatorless=function(e){e.printed&&(this.dedent(),this.newline(),this.push(")"))},e.prototype.newline=function(e,t){if(!this.format.compact&&!this.format.retainLines){if(this.format.concise)return void this.space();if(t=t||!1,h["default"](e)){if(e=Math.min(2,e),(this.endsWith("{\n")||this.endsWith(":\n"))&&e--,0>=e)return;for(;e>0;)this._newline(t),e--}else l["default"](e)&&(t=e),this._newline(t)}},e.prototype._newline=function(e){this.endsWith("\n\n")||(e&&this.isLast("\n")&&this.removeLast("\n"),this.removeLast(" "),this._removeSpacesAfterLastNewline(),this._push("\n"))},e.prototype._removeSpacesAfterLastNewline=function(){var e=this.buf.lastIndexOf("\n");if(-1!==e){for(var t=this.buf.length-1;t>e&&" "===this.buf[t];)t--;t===e&&(this.buf=this.buf.substring(0,t+1))}},e.prototype.push=function(e,t){if(!this.format.compact&&this._indent&&!t&&"\n"!==e){var r=this.getIndent();e=e.replace(/\n/g,"\n"+r),this.isLast("\n")&&this._push(r)}this._push(e)},e.prototype._push=function(e){var t=this.parenPushNewlineState;if(t)for(var r=0;r<e.length;r++){var n=e[r];if(" "!==n){this.parenPushNewlineState=null,("\n"===n||"/"===n)&&(this._push("("),this.indent(),t.printed=!0);break}}this.position.push(e),this.buf+=e},e.prototype.endsWith=function(e){var t=arguments.length<=1||void 0===arguments[1]?this.buf:arguments[1];return 1===e.length?t[t.length-1]===e:t.slice(-e.length)===e},e.prototype.isLast=function(e){if(this.format.compact)return!1;var t=this.buf,r=t[t.length-1];return Array.isArray(e)?f["default"](e,r):e===r},e}();r["default"]=m,t.exports=r["default"]},{413:413,498:498,502:502,584:584,601:601}],19:[function(e,t,r){"use strict";function n(e,t){t.plain(e.program)}function i(e,t){t.sequence(e.body)}function a(e,t){this.push("{"),e.body.length?(this.newline(),t.sequence(e.body,{indent:!0}),this.format.retainLines||this.removeLast("\n"),this.rightBrace()):(t.printInnerComments(),this.push("}"))}function s(){}r.__esModule=!0,r.File=n,r.Program=i,r.BlockStatement=a,r.Noop=s},{}],20:[function(e,t,r){"use strict";function n(e,t){t.list(e.decorators,{separator:""}),this.push("class"),e.id&&(this.push(" "),t.plain(e.id)),t.plain(e.typeParameters),e.superClass&&(this.push(" extends "),t.plain(e.superClass),t.plain(e.superTypeParameters)),e["implements"]&&(this.push(" implements "),t.join(e["implements"],{separator:", "})),this.space(),t.plain(e.body)}function i(e,t){this.push("{"),0===e.body.length?(t.printInnerComments(),this.push("}")):(this.newline(),this.indent(),t.sequence(e.body),this.dedent(),this.rightBrace())}function a(e,t){t.list(e.decorators,{separator:""}),e["static"]&&this.push("static "),t.plain(e.key),t.plain(e.typeAnnotation),e.value&&(this.space(),this.push("="),this.space(),t.plain(e.value)),this.semicolon()}function s(e,t){t.list(e.decorators,{separator:""}),e["static"]&&this.push("static "),this._method(e,t)}r.__esModule=!0,r.ClassDeclaration=n,r.ClassBody=i,r.ClassProperty=a,r.MethodDefinition=s,r.ClassExpression=n},{}],21:[function(e,t,r){"use strict";function n(e,t){this.keyword("for"),this.push("("),t.plain(e.left),this.push(" of "),t.plain(e.right),this.push(")")}function i(e,t){this.push(e.generator?"(":"["),t.join(e.blocks,{separator:" "}),this.space(),e.filter&&(this.keyword("if"),this.push("("),t.plain(e.filter),this.push(")"),this.space()),t.plain(e.body),this.push(e.generator?")":"]")}r.__esModule=!0,r.ComprehensionBlock=n,r.ComprehensionExpression=i},{}],22:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=/[a-z]$/.test(e.operator),n=e.argument;(_.isUpdateExpression(n)||_.isUnaryExpression(n))&&(r=!0),_.isUnaryExpression(n)&&"!"===n.operator&&(r=!1),this.push(e.operator),r&&this.push(" "),t.plain(e.argument)}function s(e,t){this.push("do"),this.space(),t.plain(e.body)}function o(e,t){this.push("("),t.plain(e.expression),this.push(")")}function u(e,t){e.prefix?(this.push(e.operator),t.plain(e.argument)):(t.plain(e.argument),this.push(e.operator))}function p(e,t){t.plain(e.test),this.space(),this.push("?"),this.space(),t.plain(e.consequent),this.space(),this.push(":"),this.space(),t.plain(e.alternate)}function l(e,t){this.push("new "),t.plain(e.callee),this.push("("),t.list(e.arguments),this.push(")")}function c(e,t){t.list(e.expressions)}function f(){this.push("this")}function d(){this.push("super")}function h(e,t){this.push("@"),t.plain(e.expression),this.newline()}function m(e,t){t.plain(e.callee),this.push("(");var r,n=e._prettyCall&&!this.format.retainLines&&!this.format.compact;n&&(r=",\n",this.newline(),this.indent()),t.list(e.arguments,{separator:r}),n&&(this.newline(),this.dedent()),this.push(")")}function y(){this.semicolon()}function g(e,t){t.plain(e.expression),this.semicolon()}function v(e,t){t.plain(e.left),this.push(" = "),t.plain(e.right)}function b(e,t){t.plain(e.left);var r="in"===e.operator||"instanceof"===e.operator;r=!0,this.space(r),this.push(e.operator),r||(r="<"===e.operator&&_.isUnaryExpression(e.right,{prefix:!0,operator:"!"})&&_.isUnaryExpression(e.right.argument,{prefix:!0,operator:"--"})),this.space(r),t.plain(e.right)}function E(e,t){t.plain(e.object),this.push("::"),t.plain(e.callee)}function x(e,t){var r=e.object;if(t.plain(r),!e.computed&&_.isMemberExpression(e.property))throw new TypeError("Got a MemberExpression for MemberExpression property");var n=e.computed;if(_.isLiteral(e.property)&&w["default"](e.property.value)&&(n=!0),n)this.push("["),t.plain(e.property),this.push("]");else{if(_.isLiteral(e.object)){var i=this._Literal(e.object);!D["default"](+i)||F.test(i)||this.endsWith(".")||k.test(i)||this.push(".")}this.push("."),t.plain(e.property)}}function S(e,t){t.plain(e.meta),this.push("."),t.plain(e.property)}r.__esModule=!0,r.UnaryExpression=a,r.DoExpression=s,r.ParenthesizedExpression=o,r.UpdateExpression=u,r.ConditionalExpression=p,r.NewExpression=l,r.SequenceExpression=c,r.ThisExpression=f,r.Super=d,r.Decorator=h,r.CallExpression=m,r.EmptyStatement=y,r.ExpressionStatement=g,r.AssignmentPattern=v,r.AssignmentExpression=b,r.BindExpression=E,r.MemberExpression=x,r.MetaProperty=S;var A=e(398),D=i(A),C=e(502),w=i(C),I=e(179),_=n(I),F=/e/i,k=/^0(b|o|x)/i,P=function(e){return function(t,r){if(this.push(e),(t.delegate||t.all)&&this.push("*"),t.argument){this.push(" ");var n=this.startTerminatorless();r.plain(t.argument),this.endTerminatorless(n)}}},B=P("yield");r.YieldExpression=B;var T=P("await");r.AwaitExpression=T,r.BinaryExpression=b,r.LogicalExpression=b},{179:179,398:398,502:502}],23:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){this.push("any")}function a(e,t){t.plain(e.elementType),this.push("["),this.push("]")}function s(){this.push("bool")}function o(e){this.push(e.value?"true":"false")}function u(e,t){this.push("declare class "),this._interfaceish(e,t)}function p(e,t){this.push("declare function "),t.plain(e.id),t.plain(e.id.typeAnnotation.typeAnnotation),this.semicolon()}function l(e,t){this.push("declare module "),t.plain(e.id),this.space(),t.plain(e.body)}function c(e,t){this.push("declare var "),t.plain(e.id),t.plain(e.id.typeAnnotation),this.semicolon()}function f(e,t,r){t.plain(e.typeParameters),this.push("("),t.list(e.params),e.rest&&(e.params.length&&(this.push(","),this.space()),this.push("..."),t.plain(e.rest)),this.push(")"),"ObjectTypeProperty"===r.type||"ObjectTypeCallProperty"===r.type||"DeclareFunction"===r.type?this.push(":"):(this.space(),this.push("=>")),this.space(),t.plain(e.returnType)}function d(e,t){t.plain(e.name),e.optional&&this.push("?"),this.push(":"),this.space(),t.plain(e.typeAnnotation)}function h(e,t){t.plain(e.id),t.plain(e.typeParameters)}function m(e,t){t.plain(e.id),t.plain(e.typeParameters),e["extends"].length&&(this.push(" extends "),t.join(e["extends"],{separator:", "})),this.space(),t.plain(e.body)}function y(e,t){this.push("interface "),this._interfaceish(e,t)}function g(e,t){t.join(e.types,{separator:" & "})}function v(){this.push("mixed")}function b(e,t){this.push("?"),t.plain(e.typeAnnotation)}function E(){this.push("number")}function x(e){this.push(this._stringLiteral(e.value))}function S(){this.push("string")}function A(e,t){this.push("["),t.join(e.types,{separator:", "}),this.push("]")}function D(e,t){this.push("typeof "),t.plain(e.argument)}function C(e,t){this.push("type "),t.plain(e.id),t.plain(e.typeParameters),this.space(),this.push("="),this.space(),t.plain(e.right),this.semicolon()}function w(e,t){this.push(":"),this.space(),e.optional&&this.push("?"),t.plain(e.typeAnnotation)}function I(e,t){this.push("<"),t.join(e.params,{separator:", ",iterator:function(e){t.plain(e.typeAnnotation)}}),this.push(">")}function _(e,t){var r=this;this.push("{");var n=e.properties.concat(e.callProperties,e.indexers);n.length&&(this.space(),t.list(n,{separator:!1,indent:!0,iterator:function(){1!==n.length&&(r.semicolon(),r.space())}}),this.space()),this.push("}")}function F(e,t){e["static"]&&this.push("static "),t.plain(e.value)}function k(e,t){e["static"]&&this.push("static "),this.push("["),t.plain(e.id),this.push(":"),this.space(),t.plain(e.key),this.push("]"),this.push(":"),this.space(),t.plain(e.value)}function P(e,t){e["static"]&&this.push("static "),t.plain(e.key),e.optional&&this.push("?"),L.isFunctionTypeAnnotation(e.value)||(this.push(":"),this.space()),t.plain(e.value)}function B(e,t){t.plain(e.qualification),this.push("."),t.plain(e.id)}function T(e,t){t.join(e.types,{separator:" | "})}function M(e,t){this.push("("),t.plain(e.expression),t.plain(e.typeAnnotation),this.push(")")}function O(){this.push("void")}r.__esModule=!0,r.AnyTypeAnnotation=i,r.ArrayTypeAnnotation=a,r.BooleanTypeAnnotation=s,r.BooleanLiteralTypeAnnotation=o,r.DeclareClass=u,r.DeclareFunction=p,r.DeclareModule=l,r.DeclareVariable=c,r.FunctionTypeAnnotation=f,r.FunctionTypeParam=d,r.InterfaceExtends=h,r._interfaceish=m,r.InterfaceDeclaration=y,r.IntersectionTypeAnnotation=g,r.MixedTypeAnnotation=v,r.NullableTypeAnnotation=b,r.NumberTypeAnnotation=E,r.StringLiteralTypeAnnotation=x,r.StringTypeAnnotation=S,r.TupleTypeAnnotation=A,r.TypeofTypeAnnotation=D,r.TypeAlias=C,r.TypeAnnotation=w,r.TypeParameterInstantiation=I,r.ObjectTypeAnnotation=_,r.ObjectTypeCallProperty=F,r.ObjectTypeIndexer=k,r.ObjectTypeProperty=P,r.QualifiedTypeIdentifier=B,r.UnionTypeAnnotation=T,r.TypeCastExpression=M,r.VoidTypeAnnotation=O;var j=e(179),L=n(j);r.ClassImplements=h,r.GenericTypeAnnotation=h;var N=e(29);r.NumberLiteralTypeAnnotation=N.Literal,r.TypeParameterDeclaration=I},{179:179,29:29}],24:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){t.plain(e.name),e.value&&(this.push("="),t.plain(e.value))}function a(e){this.push(e.name)}function s(e,t){t.plain(e.namespace),this.push(":"),t.plain(e.name)}function o(e,t){t.plain(e.object),this.push("."),t.plain(e.property)}function u(e,t){this.push("{..."),t.plain(e.argument),this.push("}")}function p(e,t){this.push("{"),t.plain(e.expression),this.push("}")}function l(e,t){var r=e.openingElement;if(t.plain(r),!r.selfClosing){this.indent();for(var n=e.children,i=0;i<n.length;i++){var a=n[i];m.isLiteral(a)?this.push(a.value,!0):t.plain(a)}this.dedent(),t.plain(e.closingElement)}}function c(e,t){this.push("<"),t.plain(e.name),e.attributes.length>0&&(this.push(" "),t.join(e.attributes,{separator:" "})),this.push(e.selfClosing?" />":">")}function f(e,t){this.push("</"),t.plain(e.name),this.push(">")}function d(){}r.__esModule=!0,r.JSXAttribute=i,r.JSXIdentifier=a,r.JSXNamespacedName=s,r.JSXMemberExpression=o,r.JSXSpreadAttribute=u,r.JSXExpressionContainer=p,r.JSXElement=l,r.JSXOpeningElement=c,r.JSXClosingElement=f,r.JSXEmptyExpression=d;var h=e(179),m=n(h)},{179:179}],25:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=this;t.plain(e.typeParameters),this.push("("),t.list(e.params,{iterator:function(e){e.optional&&r.push("?"),t.plain(e.typeAnnotation)}}),this.push(")"),e.returnType&&t.plain(e.returnType)}function a(e,t){var r=e.value,n=e.kind,i=e.key;("method"===n||"init"===n)&&r.generator&&this.push("*"),("get"===n||"set"===n)&&this.push(n+" "),r.async&&this.push("async "),e.computed?(this.push("["),t.plain(i),this.push("]")):t.plain(i),this._params(r,t),this.space(),t.plain(r.body)}function s(e,t){e.async&&this.push("async "),this.push("function"),e.generator&&this.push("*"),e.id?(this.push(" "),t.plain(e.id)):this.space(),this._params(e,t),this.space(),t.plain(e.body)}function o(e,t){e.async&&this.push("async "),1===e.params.length&&p.isIdentifier(e.params[0])?t.plain(e.params[0]):this._params(e,t),this.push(" => ");var r=p.isObjectExpression(e.body);r&&this.push("("),t.plain(e.body),r&&this.push(")")}r.__esModule=!0,r._params=i,r._method=a,r.FunctionExpression=s,r.ArrowFunctionExpression=o;var u=e(179),p=n(u);r.FunctionDeclaration=s},{179:179}],26:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){t.plain(e.imported),e.local&&e.local.name!==e.imported.name&&(this.push(" as "),t.plain(e.local))}function a(e,t){t.plain(e.local)}function s(e,t){t.plain(e.exported)}function o(e,t){t.plain(e.local),e.exported&&e.local.name!==e.exported.name&&(this.push(" as "),t.plain(e.exported))}function u(e,t){this.push("* as "),t.plain(e.exported)}function p(e,t){this.push("export *"),e.exported&&(this.push(" as "),t.plain(e.exported)),this.push(" from "),t.plain(e.source),this.semicolon()}function l(e,t){this.push("export "),f.call(this,e,t)}function c(e,t){this.push("export default "),f.call(this,e,t)}function f(e,t){var r=e.specifiers;if(e.declaration){var n=e.declaration;if(t.plain(n),y.isStatement(n)||y.isFunction(n)||y.isClass(n))return}else{"type"===e.exportKind&&this.push("type ");var i=r[0],a=!1;(y.isExportDefaultSpecifier(i)||y.isExportNamespaceSpecifier(i))&&(a=!0,t.plain(r.shift()),r.length&&this.push(", ")),(r.length||!r.length&&!a)&&(this.push("{"),r.length&&(this.space(),t.join(r,{separator:", "}),this.space()),this.push("}")),e.source&&(this.push(" from "),t.plain(e.source))}this.ensureSemicolon()}function d(e,t){this.push("import "),("type"===e.importKind||"typeof"===e.importKind)&&this.push(e.importKind+" ");var r=e.specifiers;if(r&&r.length){var n=e.specifiers[0];(y.isImportDefaultSpecifier(n)||y.isImportNamespaceSpecifier(n))&&(t.plain(e.specifiers.shift()),e.specifiers.length&&this.push(", ")),e.specifiers.length&&(this.push("{"),this.space(),t.join(e.specifiers,{separator:", "}),this.space(),this.push("}")),this.push(" from ")}t.plain(e.source),this.semicolon()}function h(e,t){this.push("* as "),t.plain(e.local)}r.__esModule=!0,r.ImportSpecifier=i,r.ImportDefaultSpecifier=a,r.ExportDefaultSpecifier=s,r.ExportSpecifier=o,r.ExportNamespaceSpecifier=u,r.ExportAllDeclaration=p,r.ExportNamedDeclaration=l,r.ExportDefaultDeclaration=c,r.ImportDeclaration=d,r.ImportNamespaceSpecifier=h;var m=e(179),y=n(m)},{179:179}],27:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){this.keyword("with"),this.push("("),t.plain(e.object),this.push(")"),t.block(e.body)}function s(e,t){this.keyword("if"),this.push("("),t.plain(e.test),this.push(")"),this.space(),t.indentOnComments(e.consequent),e.alternate&&(this.isLast("}")&&this.space(),this.push("else "),t.indentOnComments(e.alternate))}function o(e,t){this.keyword("for"),this.push("("),t.plain(e.init),this.push(";"),e.test&&(this.space(),t.plain(e.test)),this.push(";"),e.update&&(this.space(),t.plain(e.update)),this.push(")"),t.block(e.body)}function u(e,t){this.keyword("while"),this.push("("),t.plain(e.test),this.push(")"),t.block(e.body)}function p(e,t){this.push("do "),t.plain(e.body),this.space(),this.keyword("while"),this.push("("),t.plain(e.test),this.push(");")}function l(e,t){t.plain(e.label),this.push(": "),t.plain(e.body)}function c(e,t){this.keyword("try"),t.plain(e.block),this.space(),e.handlers?t.plain(e.handlers[0]):t.plain(e.handler),e.finalizer&&(this.space(),this.push("finally "),t.plain(e.finalizer))}function f(e,t){this.keyword("catch"),this.push("("),t.plain(e.param),this.push(") "),t.plain(e.body)}function d(e,t){this.keyword("switch"),this.push("("),t.plain(e.discriminant),this.push(")"),this.space(),this.push("{"),t.sequence(e.cases,{indent:!0,addNewlines:function(t,r){return t||e.cases[e.cases.length-1]!==r?void 0:-1}}),this.push("}")}function h(e,t){e.test?(this.push("case "),t.plain(e.test),this.push(":")):this.push("default:"),e.consequent.length&&(this.newline(),t.sequence(e.consequent,{indent:!0}))}function m(){this.push("debugger;")}function y(e,t,r){this.push(e.kind+" ");var n=!1;if(!x.isFor(r))for(var i=e.declarations,a=0;a<i.length;a++){var s=i[a];s.init&&(n=!0)}var o;this.format.compact||this.format.concise||!n||this.format.retainLines||(o=",\n"+b["default"](" ",e.kind.length+1)),t.list(e.declarations,{separator:o}),(!x.isFor(r)||r.left!==e&&r.init!==e)&&this.semicolon()}function g(e,t){t.plain(e.id),t.plain(e.id.typeAnnotation),e.init&&(this.space(),this.push("="),this.space(),t.plain(e.init))}r.__esModule=!0,r.WithStatement=a,r.IfStatement=s,r.ForStatement=o,r.WhileStatement=u,r.DoWhileStatement=p,r.LabeledStatement=l,r.TryStatement=c,r.CatchClause=f,r.SwitchStatement=d,r.SwitchCase=h,r.DebuggerStatement=m,r.VariableDeclaration=y,r.VariableDeclarator=g;var v=e(584),b=i(v),E=e(179),x=n(E),S=function(e){return function(t,r){this.keyword("for"),this.push("("),r.plain(t.left),this.push(" "+e+" "),r.plain(t.right),this.push(")"),r.block(t.body)}},A=S("in");r.ForInStatement=A;var D=S("of");r.ForOfStatement=D;var C=function(e){var t=arguments.length<=1||void 0===arguments[1]?"label":arguments[1];return function(r,n){this.push(e);var i=r[t];if(i){this.push(" ");var a=this.startTerminatorless();n.plain(i),this.endTerminatorless(a)}this.semicolon()}},w=C("continue");r.ContinueStatement=w;var I=C("return","argument");r.ReturnStatement=I;var _=C("break");r.BreakStatement=_;var F=C("throw","argument");r.ThrowStatement=F},{179:179,584:584}],28:[function(e,t,r){"use strict";function n(e,t){t.plain(e.tag),t.plain(e.quasi)}function i(e){this._push(e.value.raw)}function a(e,t){this.push("`");for(var r=e.quasis,n=r.length,i=0;n>i;i++)t.plain(r[i]),n>i+1&&(this.push("${ "),t.plain(e.expressions[i]),this.push(" }"));this._push("`")}r.__esModule=!0,r.TaggedTemplateExpression=n,r.TemplateElement=i,r.TemplateLiteral=a},{}],29:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){this.push(e.name)}function a(e,t){this.push("..."),t.plain(e.argument)}function s(e,t){var r=e.properties;this.push("{"),t.printInnerComments(),r.length&&(this.space(),t.list(r,{indent:!0}),this.space()),this.push("}")}function o(e,t){if(t.list(e.decorators,{separator:""}),e.method||"get"===e.kind||"set"===e.kind)this._method(e,t);else{if(e.computed)this.push("["),t.plain(e.key),this.push("]");else{if(d.isAssignmentPattern(e.value)&&d.isIdentifier(e.key)&&e.key.name===e.value.left.name)return void t.plain(e.value);if(t.plain(e.key),e.shorthand&&d.isIdentifier(e.key)&&d.isIdentifier(e.value)&&e.key.name===e.value.name)return}this.push(":"),this.space(),t.plain(e.value)}}function u(e,t){var r=e.elements,n=r.length;this.push("["),t.printInnerComments();for(var i=0;i<r.length;i++){var a=r[i];a?(i>0&&this.space(),t.plain(a),n-1>i&&this.push(",")):this.push(",")}this.push("]")}function p(e){this.push(""),this._push(this._Literal(e))}function l(e){var t=e.value;if(e.regex)return"/"+e.regex.pattern+"/"+e.regex.flags;if(null!=e.raw&&null!=e.rawValue&&t===e.rawValue)return e.raw;switch(typeof t){case"string":return this._stringLiteral(t);case"number":return t+"";case"boolean":return t?"true":"false";default:if(null===t)return"null";throw new Error("Invalid Literal type")}}function c(e){return e=JSON.stringify(e),e=e.replace(/[\u000A\u000D\u2028\u2029]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)}),"single"===this.format.quotes&&(e=e.slice(1,-1),e=e.replace(/\\"/g,'"'),e=e.replace(/'/g,"\\'"),e="'"+e+"'"),e}r.__esModule=!0,r.Identifier=i,r.RestElement=a,r.ObjectExpression=s,r.Property=o,r.ArrayExpression=u,r.Literal=p,r._Literal=l,r._stringLiteral=c;var f=e(179),d=n(f);r.SpreadElement=a,r.SpreadProperty=a,r.ObjectPattern=s,r.ArrayPattern=u},{179:179}],30:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e(391),u=i(o),p=e(37),l=i(p),c=e(33),f=i(c),d=e(584),h=i(d),m=e(36),y=i(m),g=e(35),v=i(g),b=e(43),E=n(b),x=e(18),S=i(x),A=e(511),D=i(A),C=e(411),w=i(C),I=e(31),_=i(I),F=e(179),k=n(F),P=function(){function t(e,r,n){a(this,t),r=r||{},this.comments=e.comments||[],this.tokens=e.tokens||[],this.format=t.normalizeOptions(n,r,this.tokens),this.opts=r,this.ast=e,this.whitespace=new l["default"](this.tokens),this.position=new v["default"],this.map=new y["default"](this.position,r,n),this.buffer=new S["default"](this.position,this.format)}return t.normalizeOptions=function(e,r,n){var i=" ";if(e){var a=u["default"](e).indent;a&&" "!==a&&(i=a)}var s={shouldPrintComment:r.shouldPrintComment,retainLines:r.retainLines,comments:null==r.comments||r.comments,compact:r.compact,quotes:t.findCommonStringDelimiter(e,n),indent:{adjustMultilineComment:!0,style:i,base:0}};return"auto"===s.compact&&(s.compact=e.length>1e5,s.compact&&console.error("[BABEL] "+E.get("codeGeneratorDeopt",r.filename,"100KB"))),s.compact&&(s.indent.adjustMultilineComment=!1),s},t.findCommonStringDelimiter=function(e,t){for(var r={single:0,"double":0},n=0,i=0;i<t.length;i++){var a=t[i];if("string"===a.type.label){var s=e.slice(a.start,a.end);if("'"===s[0]?r.single++:r["double"]++,n++,n>=3)break}}return r.single>r["double"]?"single":"double"},t.prototype.generate=function(){var e=this.ast;if(this.print(e),e.comments){for(var t=[],r=e.comments,n=0;n<r.length;n++){var i=r[n];i._displayed||t.push(i)}this._printComments(t)}return{map:this.map.get(),code:this.buffer.get()}},t.prototype.buildPrint=function(e){return new f["default"](this,e)},t.prototype.catchUp=function(e){if(e.loc&&this.format.retainLines&&this.buffer.buf)for(;this.position.line<e.loc.start.line;)this._push("\n")},t.prototype._printNewline=function(e,t,r,n){if(n.statement||_["default"].isUserWhitespacable(t,r)){var i=0;if(null==t.start||t._ignoreUserWhitespace){e||i++,n.addNewlines&&(i+=n.addNewlines(e,t)||0);var a=_["default"].needsWhitespaceAfter;e&&(a=_["default"].needsWhitespaceBefore),
a(t,r)&&i++,this.buffer.buf||(i=0)}else i=e?this.whitespace.getNewlinesBefore(t):this.whitespace.getNewlinesAfter(t);this.newline(i)}},t.prototype.print=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(e){t&&t._compact&&(e._compact=!0);var n=this.format.concise;if(e._compact&&(this.format.concise=!0),!this[e.type])throw new ReferenceError("unknown node of type "+JSON.stringify(e.type)+" with constructor "+JSON.stringify(e&&e.constructor.name));var i=_["default"].needsParens(e,t);i&&this.push("("),this.printLeadingComments(e,t),this.catchUp(e),this._printNewline(!0,e,t,r),r.before&&r.before(),this.map.mark(e,"start"),this[e.type](e,this.buildPrint(e),t),i&&this.push(")"),this.map.mark(e,"end"),r.after&&r.after(),this.format.concise=n,this._printNewline(!1,e,t,r),this.printTrailingComments(e,t)}},t.prototype.printJoin=function(e,t){var r=this,n=arguments.length<=2||void 0===arguments[2]?{}:arguments[2];if(t&&t.length){var i=t.length;n.indent&&this.indent();for(var a={statement:n.statement,addNewlines:n.addNewlines,after:function(){n.iterator&&n.iterator(o,s),n.separator&&i-1>s&&r.push(n.separator)}},s=0;s<t.length;s++){var o=t[s];e.plain(o,a)}n.indent&&this.dedent()}},t.prototype.printAndIndentOnComments=function(e,t){var r=!!t.leadingComments;r&&this.indent(),e.plain(t),r&&this.dedent()},t.prototype.printBlock=function(e,t){k.isEmptyStatement(t)?this.semicolon():(this.push(" "),e.plain(t))},t.prototype.generateComment=function(e){var t=e.value;return t="CommentLine"===e.type?"//"+t:"/*"+t+"*/"},t.prototype.printTrailingComments=function(e,t){this._printComments(this.getComments("trailingComments",e,t))},t.prototype.printLeadingComments=function(e,t){this._printComments(this.getComments("leadingComments",e,t))},t.prototype.getComments=function(e,t,r){if(k.isExpressionStatement(r))return[];var n=[],i=[t];k.isExpressionStatement(t)&&i.push(t.argument);for(var a=i,s=0;s<a.length;s++){var o=a[s];n=n.concat(this._getComments(e,o))}return n},t.prototype._getComments=function(e,t){return t&&t[e]||[]},t.prototype.shouldPrintComment=function(e){return this.format.shouldPrintComment?this.format.shouldPrintComment(e.value):e.value.indexOf("@license")>=0||e.value.indexOf("@preserve")>=0?!0:this.format.comments},t.prototype._printComments=function(e){if(e&&e.length)for(var t=e,r=0;r<t.length;r++){var n=t[r];if(this.shouldPrintComment(n)&&!n._displayed){n._displayed=!0,this.catchUp(n),this.newline(this.whitespace.getNewlinesBefore(n));var i=this.position.column,a=this.generateComment(n);if(i&&!this.isLast(["\n"," ","[","{"])&&(this._push(" "),i++),"CommentBlock"===n.type&&this.format.indent.adjustMultilineComment){var s=n.loc&&n.loc.start.column;if(s){var o=new RegExp("\\n\\s{1,"+s+"}","g");a=a.replace(o,"\n")}var u=Math.max(this.indentSize(),i);a=a.replace(/\n/g,"\n"+h["default"](" ",u))}0===i&&(a=this.getIndent()+a),(this.format.compact||this.format.retainLines)&&"CommentLine"===n.type&&(a+="\n"),this._push(a),this.newline(this.whitespace.getNewlinesAfter(n))}}},s(t,null,[{key:"generators",value:{templateLiterals:e(28),comprehensions:e(21),expressions:e(22),statements:e(27),classes:e(20),methods:e(25),modules:e(26),types:e(29),flow:e(23),base:e(19),jsx:e(24)},enumerable:!0}]),t}();w["default"](S["default"].prototype,function(e,t){P.prototype[t]=function(){return e.apply(this.buffer,arguments)}}),w["default"](P.generators,function(e){D["default"](P.prototype,e)}),t.exports=function(e,t,r){var n=new P(e,t,r);return n.generate()},t.exports.CodeGenerator=P},{179:179,18:18,19:19,20:20,21:21,22:22,23:23,24:24,25:25,26:26,27:27,28:28,29:29,31:31,33:33,35:35,36:36,37:37,391:391,411:411,43:43,511:511,584:584}],31:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(34),o=i(s),u=e(32),p=n(u),l=e(411),c=i(l),f=e(416),d=i(f),h=e(179),m=n(h),y=function(e,t,r){if(e){for(var n,i=Object.keys(e),a=0;a<i.length;a++){var s=i[a];if(m.is(s,t)){var o=e[s];if(n=o(t,r),null!=n)break}}return n}},g=function(){function e(t,r){a(this,e),this.parent=r,this.node=t}return e.isUserWhitespacable=function(e){return m.isUserWhitespacable(e)},e.needsWhitespace=function(t,r,n){if(!t)return 0;m.isExpressionStatement(t)&&(t=t.expression);var i=y(o["default"].nodes,t,r);if(!i){var a=y(o["default"].list,t,r);if(a)for(var s=0;s<a.length&&!(i=e.needsWhitespace(a[s],t,n));s++);}return i&&i[n]||0},e.needsWhitespaceBefore=function(t,r){return e.needsWhitespace(t,r,"before")},e.needsWhitespaceAfter=function(t,r){return e.needsWhitespace(t,r,"after")},e.needsParens=function(e,t){if(!t)return!1;if(m.isNewExpression(t)&&t.callee===e){if(m.isCallExpression(e))return!0;var r=d["default"](e,function(e){return m.isCallExpression(e)});if(r)return!0}return y(p,e,t)},e}();r["default"]=g,c["default"](g,function(e,t){g.prototype[t]=function(){var e=new Array(arguments.length+2);e[0]=this.node,e[1]=this.parent;for(var r=0;r<e.length;r++)e[r+2]=arguments[r];return g[t].apply(null,e)}}),t.exports=r["default"]},{179:179,32:32,34:34,411:411,416:416}],32:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){return E.isArrayTypeAnnotation(t)}function s(e,t){return E.isMemberExpression(t)&&t.object===e?!0:void 0}function o(e,t){return E.isExpressionStatement(t)?!0:E.isMemberExpression(t)&&t.object===e?!0:!1}function u(e,t){if((E.isCallExpression(t)||E.isNewExpression(t))&&t.callee===e)return!0;if(E.isUnaryLike(t))return!0;if(E.isMemberExpression(t)&&t.object===e)return!0;if(E.isBinary(t)){var r=t.operator,n=x[r],i=e.operator,a=x[i];if(n>a)return!0;if(n===a&&t.right===e)return!0}}function p(e,t){if("in"===e.operator){if(E.isVariableDeclarator(t))return!0;if(E.isFor(t))return!0}}function l(e,t){return E.isForStatement(t)?!1:E.isExpressionStatement(t)&&t.expression===e?!1:!0}function c(e,t){return E.isBinary(t)||E.isUnaryLike(t)||E.isCallExpression(t)||E.isMemberExpression(t)||E.isNewExpression(t)||E.isConditionalExpression(t)||E.isYieldExpression(t)}function f(e,t){return E.isExpressionStatement(t)}function d(e,t){return E.isMemberExpression(t)&&t.object===e}function h(e,t){return E.isExpressionStatement(t)?!0:E.isMemberExpression(t)&&t.object===e?!0:E.isCallExpression(t)&&t.callee===e?!0:void 0}function m(e,t){return E.isUnaryLike(t)?!0:E.isBinary(t)?!0:(E.isCallExpression(t)||E.isNewExpression(t))&&t.callee===e?!0:E.isConditionalExpression(t)&&t.test===e?!0:E.isMemberExpression(t)&&t.object===e?!0:!1}function y(e){return E.isObjectPattern(e.left)?!0:m.apply(void 0,arguments)}r.__esModule=!0,r.NullableTypeAnnotation=a,r.UpdateExpression=s,r.ObjectExpression=o,r.Binary=u,r.BinaryExpression=p,r.SequenceExpression=l,r.YieldExpression=c,r.ClassExpression=f,r.UnaryLike=d,r.FunctionExpression=h,r.ConditionalExpression=m,r.AssignmentExpression=y;var g=e(411),v=i(g),b=e(179),E=n(b),x={};v["default"]([["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"],["**"]],function(e,t){v["default"](e,function(e){x[e]=t})}),r.FunctionTypeAnnotation=a},{179:179,411:411}],33:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function(){function e(t,r){n(this,e),this.generator=t,this.parent=r}return e.prototype.printInnerComments=function(){if(this.parent.innerComments){var e=this.generator;e.indent(),e._printComments(this.parent.innerComments),e.dedent()}},e.prototype.plain=function(e,t){return this.generator.print(e,this.parent,t)},e.prototype.sequence=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.statement=!0,this.generator.printJoin(this,e,t)},e.prototype.join=function(e,t){return this.generator.printJoin(this,e,t)},e.prototype.list=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return null==t.separator&&(t.separator=",",this.generator.format.compact||(t.separator+=" ")),this.join(e,t)},e.prototype.block=function(e){return this.generator.printBlock(this,e)},e.prototype.indentOnComments=function(e){return this.generator.printAndIndentOnComments(this,e)},e}();r["default"]=i,t.exports=r["default"]},{}],34:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return m.isMemberExpression(e)?(a(e.object,t),e.computed&&a(e.property,t)):m.isBinary(e)||m.isAssignmentExpression(e)?(a(e.left,t),a(e.right,t)):m.isCallExpression(e)?(t.hasCall=!0,a(e.callee,t)):m.isFunction(e)?t.hasFunction=!0:m.isIdentifier(e)&&(t.hasHelper=t.hasHelper||s(e.callee)),t}function s(e){return m.isMemberExpression(e)?s(e.object)||s(e.property):m.isIdentifier(e)?"require"===e.name||"_"===e.name[0]:m.isCallExpression(e)?s(e.callee):m.isBinary(e)||m.isAssignmentExpression(e)?m.isIdentifier(e.left)&&s(e.left)||s(e.right):!1}function o(e){return m.isLiteral(e)||m.isObjectExpression(e)||m.isArrayExpression(e)||m.isIdentifier(e)||m.isMemberExpression(e)}var u=e(498),p=i(u),l=e(411),c=i(l),f=e(414),d=i(f),h=e(179),m=n(h);r.nodes={AssignmentExpression:function(e){var t=a(e.right);return t.hasCall&&t.hasHelper||t.hasFunction?{before:t.hasFunction,after:!0}:void 0},SwitchCase:function(e,t){return{before:e.consequent.length||t.cases[0]===e}},LogicalExpression:function(e){return m.isFunction(e.left)||m.isFunction(e.right)?{after:!0}:void 0},Literal:function(e){return"use strict"===e.value?{after:!0}:void 0},CallExpression:function(e){return m.isFunction(e.callee)||s(e)?{before:!0,after:!0}:void 0},VariableDeclaration:function(e){for(var t=0;t<e.declarations.length;t++){var r=e.declarations[t],n=s(r.id)&&!o(r.init);if(!n){var i=a(r.init);n=s(r.init)&&i.hasCall||i.hasFunction}if(n)return{before:!0,after:!0}}},IfStatement:function(e){return m.isBlockStatement(e.consequent)?{before:!0,after:!0}:void 0}},r.nodes.Property=r.nodes.SpreadProperty=function(e,t){return t.properties[0]===e?{before:!0}:void 0},r.list={VariableDeclaration:function(e){return d["default"](e.declarations,"init")},ArrayExpression:function(e){return e.elements},ObjectExpression:function(e){return e.properties}},c["default"]({Function:!0,Class:!0,Loop:!0,LabeledStatement:!0,SwitchStatement:!0,TryStatement:!0},function(e,t){p["default"](e)&&(e={after:e,before:e}),c["default"]([t].concat(m.FLIPPED_ALIAS_KEYS[t]||[]),function(t){r.nodes[t]=function(){return e}})})},{179:179,411:411,414:414,498:498}],35:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function(){function e(){n(this,e),this.line=1,this.column=0}return e.prototype.push=function(e){for(var t=0;t<e.length;t++)"\n"===e[t]?(this.line++,this.column=0):this.column++},e.prototype.unshift=function(e){for(var t=0;t<e.length;t++)"\n"===e[t]?this.line--:this.column--},e}();r["default"]=i,t.exports=r["default"]},{}],36:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(599),o=i(s),u=e(179),p=n(u),l=function(){function e(t,r,n){a(this,e),this.position=t,this.opts=r,r.sourceMaps?(this.map=new o["default"].SourceMapGenerator({file:r.sourceMapTarget,sourceRoot:r.sourceRoot}),this.map.setSourceContent(r.sourceFileName,n)):this.map=null}return e.prototype.get=function(){var e=this.map;return e?e.toJSON():e},e.prototype.mark=function(e,t){var r=e.loc;if(r){var n=this.map;if(n&&!p.isProgram(e)&&!p.isFile(e)){var i=this.position,a={line:i.line,column:i.column},s=r[t];n.addMapping({source:this.opts.sourceFileName,generated:a,original:s})}}},e}();r["default"]=l,t.exports=r["default"]},{179:179,599:599}],37:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r){return e+=t,e>=r&&(e-=r),e}r.__esModule=!0;var a=function(){function e(t){n(this,e),this.tokens=t,this.used={},this._lastFoundIndex=0}return e.prototype.getNewlinesBefore=function(e){for(var t,r,n=this.tokens,a=0;a<n.length;a++){var s=i(a,this._lastFoundIndex,this.tokens.length),o=n[s];if(e.start===o.start){t=n[s-1],r=o,this._lastFoundIndex=s;break}}return this.getNewlinesBetween(t,r)},e.prototype.getNewlinesAfter=function(e){for(var t,r,n=this.tokens,a=0;a<n.length;a++){var s=i(a,this._lastFoundIndex,this.tokens.length),o=n[s];if(e.end===o.end){t=o,r=n[s+1],","===r.type.label&&(r=n[s+2]),this._lastFoundIndex=s;break}}if(r&&"eof"===r.type.label)return 1;var u=this.getNewlinesBetween(t,r);return"CommentLine"!==e.type||u?u:1},e.prototype.getNewlinesBetween=function(e,t){if(!t||!t.loc)return 0;for(var r=e?e.loc.end.line:1,n=t.loc.start.line,i=0,a=r;n>a;a++)"undefined"==typeof this.used[a]&&(this.used[a]=!0,i++);return i},e}();r["default"]=a,t.exports=r["default"]},{}],38:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=c["default"].matchToToken(e);if("name"===t.type&&d["default"].keyword.isReservedWordES6(t.value))return"keyword";if("punctuator"===t.type)switch(t.value){case"{":case"}":return"curly";case"(":case")":return"parens";case"[":case"]":return"square"}return t.type}function a(e){return e.replace(c["default"],function(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];var n=i(t),a=y[n];return a?t[0].split(g).map(function(e){return a(e)}).join("\n"):t[0]})}r.__esModule=!0;var s=e(403),o=n(s),u=e(584),p=n(u),l=e(401),c=n(l),f=e(395),d=n(f),h=e(200),m=n(h),y={string:m["default"].red,punctuator:m["default"].bold,curly:m["default"].green,parens:m["default"].blue.bold,square:m["default"].yellow,keyword:m["default"].cyan,number:m["default"].magenta,regex:m["default"].magenta,comment:m["default"].grey,invalid:m["default"].inverse},g=/\r\n|[\n\r\u2028\u2029]/;r["default"]=function(e,t,r){var n=arguments.length<=3||void 0===arguments[3]?{}:arguments[3];r=Math.max(r,0);var i=n.highlightCode&&m["default"].supportsColor;i&&(e=a(e)),e=e.split(g);var s=Math.max(t-3,0),u=Math.min(e.length,t+3);t||r||(s=0,u=e.length);var l=o["default"](e.slice(s,u),{start:s+1,before:" ",after:" | ",transform:function(e){e.number===t&&(r&&(e.line+="\n"+e.before+p["default"](" ",e.width)+e.after+p["default"](" ",r-1)+"^"),e.before=e.before.replace(/^./,">"))}}).join("\n");return i?m["default"].reset(l):l},t.exports=r["default"]},{200:200,395:395,401:401,403:403,584:584}],39:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(515),a=n(i);r["default"]=function(e,t){return e&&t?a["default"](e,t,function(e,t){if(t&&Array.isArray(e)){for(var r=e.slice(0),n=t,i=Array.isArray(n),a=0,n=i?n:n[Symbol.iterator]();;){var s;if(i){if(a>=n.length)break;s=n[a++]}else{if(a=n.next(),a.done)break;s=a.value}var o=s;e.indexOf(o)<0&&r.push(o)}return r}}):void 0},t.exports=r["default"]},{515:515}],40:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i);r["default"]=function(e,t,r){if(e&&"Program"===e.type)return a.file(e,t||[],r||[]);throw new Error("Not a valid ast?")},t.exports=r["default"]},{179:179}],41:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]=function(){return Object.create(null)},t.exports=r["default"]},{}],42:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(605),a=n(i);r["default"]=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r={allowImportExportEverywhere:t.looseModules,allowReturnOutsideFunction:t.looseModules,allowHashBang:!0,ecmaVersion:6,strictMode:t.strictMode,sourceType:t.sourceType,locations:!0,features:t.features||{},plugins:t.plugins||{}};return t.nonStandard&&(r.plugins.jsx=!0,r.plugins.flow=!0),a.parse(e,r)},t.exports=r["default"]},{605:605}],43:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];var i=u[e];if(!i)throw new ReferenceError("Unknown message "+JSON.stringify(e));return r=a(r),i.replace(/\$(\d+)/g,function(e,t){return r[--t]})}function a(e){return e.map(function(e){if(null!=e&&e.inspect)return e.inspect();try{return JSON.stringify(e)||e+""}catch(t){return o.inspect(e)}})}r.__esModule=!0,r.get=i,r.parseArgs=a;var s=e(13),o=n(s),u={tailCallReassignmentDeopt:"Function reference has been reassigned, so it will probably be dereferenced, therefore we can't optimise this with confidence",JSXNamespacedTags:"Namespace tags are not supported. ReactJSX is not XML.",classesIllegalBareSuper:"Illegal use of bare super",classesIllegalSuperCall:"Direct super call is illegal in non-constructor, use super.$1() instead",scopeDuplicateDeclaration:"Duplicate declaration $1",settersNoRest:"Setters aren't allowed to have a rest",noAssignmentsInForHead:"No assignments allowed in for-in/of head",expectedMemberExpressionOrIdentifier:"Expected type MemberExpression or Identifier",invalidParentForThisNode:"We don't know how to handle this node within the current parent - please open an issue",readOnly:"$1 is read-only",unknownForHead:"Unknown node type $1 in ForStatement",didYouMean:"Did you mean $1?",codeGeneratorDeopt:"Note: The code generator has deoptimised the styling of $1 as it exceeds the max of $2.",missingTemplatesDirectory:"no templates directory - this is most likely the result of a broken `npm publish`. Please report to https://github.com/babel/babel/issues",unsupportedOutputType:"Unsupported output type $1",illegalMethodName:"Illegal method name $1",lostTrackNodePath:"We lost track of this node's position, likely because the AST was directly manipulated",modulesIllegalExportName:"Illegal export $1",modulesDuplicateDeclarations:"Duplicate module declarations with the same source but in different scopes",undeclaredVariable:"Reference to undeclared variable $1",undeclaredVariableType:"Referencing a type alias outside of a type annotation",undeclaredVariableSuggestion:"Reference to undeclared variable $1 - did you mean $2?",traverseNeedsParent:"You must pass a scope and parentPath unless traversing a Program/File got a $1 node",traverseVerifyRootFunction:"You passed `traverse()` a function when it expected a visitor object, are you sure you didn't mean `{ enter: Function }`?",traverseVerifyVisitorProperty:"You passed `traverse()` a visitor object with the property $1 that has the invalid property $2",traverseVerifyNodeType:"You gave us a visitor for the node type $1 but it's not a valid type",pluginIllegalKind:"Illegal kind $1 for plugin $2",pluginIllegalPosition:"Illegal position $1 for plugin $2",pluginKeyCollision:"The plugin $1 collides with another of the same name",pluginNotTransformer:"The plugin $1 didn't export a Plugin instance",pluginUnknown:"Unknown plugin $1",pluginNotFile:"Plugin $1 is resolving to a different Babel version than what is performing the transformation.",pluginInvalidProperty:"Plugin $1 provided an invalid property of $2.",pluginInvalidPropertyVisitor:'Define your visitor methods inside a `visitor` property like so:\n\n new Plugin("foobar", {\n visitor: {\n // define your visitor methods here!\n }\n });\n'};r.MESSAGES=u},{13:13}],44:[function(e,t,r){(function(t){"use strict";if(e(387),e(577),t._babelPolyfill)throw new Error("only one instance of babel/polyfill is allowed");t._babelPolyfill=!0}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{387:387,577:577}],45:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=[],n=E.functionExpression(null,[E.identifier("global")],E.blockStatement(r)),i=E.program([E.expressionStatement(E.callExpression(n,[h.template("helper-self-global")]))]);return r.push(E.variableDeclaration("var",[E.variableDeclarator(e,E.assignmentExpression("=",E.memberExpression(E.identifier("global"),e),E.objectExpression([])))])),t(r),i}function s(e,t){var r=[];r.push(E.variableDeclaration("var",[E.variableDeclarator(e,E.identifier("global"))])),t(r);var n=h.template("umd-commonjs-strict",{FACTORY_PARAMETERS:E.identifier("global"),BROWSER_ARGUMENTS:E.assignmentExpression("=",E.memberExpression(E.identifier("root"),e),E.objectExpression({})),COMMON_ARGUMENTS:E.identifier("exports"),AMD_ARGUMENTS:E.arrayExpression([E.literal("exports")]),FACTORY_BODY:r,UMD_ROOT:E.identifier("this")});return E.program([n])}function o(e,t){var r=[];return r.push(E.variableDeclaration("var",[E.variableDeclarator(e,E.objectExpression({}))])),t(r),E.program(r)}function u(e,t,r){v["default"](y["default"].helpers,function(n){if(!r||-1!==r.indexOf(n)){var i=E.identifier(E.toIdentifier(n));e.push(E.expressionStatement(E.assignmentExpression("=",E.memberExpression(t,i),h.template("helper-"+n))))}})}r.__esModule=!0;var p=e(30),l=i(p),c=e(43),f=n(c),d=e(182),h=n(d),m=e(46),y=i(m),g=e(411),v=i(g),b=e(179),E=n(b);r["default"]=function(e){var t,r=arguments.length<=1||void 0===arguments[1]?"global":arguments[1],n=E.identifier("babelHelpers"),i=function(t){return u(t,n,e)},p={global:a,umd:s,"var":o}[r];if(!p)throw new Error(f.get("unsupportedOutputType",r));return t=p(n,i),l["default"](t).code},t.exports=r["default"]},{179:179,182:182,30:30,411:411,43:43,46:46}],46:[function(e,t,r){(function(n){"use strict";function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){return e&&e.__esModule?e:{"default":e}}function s(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=e(208),p=a(u),l=e(74),c=a(l),f=e(50),d=a(f),h=e(52),m=a(h),y=e(587),g=a(y),v=e(155),b=a(v),E=e(500),x=a(E),S=e(599),A=a(S),D=e(30),C=a(D),w=e(38),I=a(w),_=e(510),F=a(_),k=e(413),P=a(k),B=e(148),T=a(B),M=e(602),O=a(M),j=e(47),L=a(j),N=e(82),R=a(N),V=e(42),U=a(V),q=e(147),G=a(q),H=e(182),W=i(H),X=e(9),Y=a(X),J=e(179),z=i(J),K=function(){function t(e,r){void 0===e&&(e={}),s(this,t),this.transformerDependencies={},this.dynamicImportTypes={},this.dynamicImportIds={},this.dynamicImports=[],this.declarations={},this.usedHelpers={},this.dynamicData={},this.data={},this.ast={},this.metadata={modules:{imports:[],exports:{exported:[],specifiers:[]}}},this.hub=new G["default"](this),this.pipeline=r,this.log=new L["default"](this,e.filename||"unknown"),this.opts=this.initOptions(e),this.buildTransformers()}return t.prototype.initOptions=function(e){return e=new d["default"](this.log,this.pipeline).init(e),e.inputSourceMap&&(e.sourceMaps=!0),e.moduleId&&(e.moduleIds=!0),e.basename=Y["default"].basename(e.filename,Y["default"].extname(e.filename)),e.ignore=W.arrayify(e.ignore,W.regexify),e.only&&(e.only=W.arrayify(e.only,W.regexify)),F["default"](e,{moduleRoot:e.sourceRoot}),F["default"](e,{sourceRoot:e.moduleRoot}),F["default"](e,{filenameRelative:e.filename}),F["default"](e,{sourceFileName:e.filenameRelative,sourceMapTarget:e.filenameRelative}),e.externalHelpers&&this.set("helpersNamespace",z.identifier("babelHelpers")),e},t.prototype.isLoose=function(e){return P["default"](this.opts.loose,e)},t.prototype.buildTransformers=function(){var e=this,t=this.transformers={},r=[],n=[];for(var i in this.pipeline.transformers){var a=this.pipeline.transformers[i],s=t[i]=a.buildPass(e);s.canTransform()&&(n.push(s),a.metadata.secondPass&&r.push(s),a.manipulateOptions&&a.manipulateOptions(e.opts,e))}for(var o=[],u=[],p=new m["default"]({file:this,transformers:this.transformers,before:o,after:u}),l=0;l<e.opts.plugins.length;l++)p.add(e.opts.plugins[l]);n=o.concat(n,u),this.uncollapsedTransformerStack=n=n.concat(r);for(var c=n,f=0;f<c.length;f++)for(var s=c[f],d=s.plugin.dependencies,h=0;h<d.length;h++){var y=d[h];this.transformerDependencies[y]=s.key}this.transformerStack=this.collapseStack(n)},t.prototype.collapseStack=function(e){for(var t=[],r=[],n=e,i=0;i<n.length;i++){var a=n[i];if(!(r.indexOf(a)>=0)){var s=a.plugin.metadata.group;if(a.canTransform()&&s){for(var o=[],u=e,p=0;p<u.length;p++){var l=u[p];l.plugin.metadata.group===s&&(o.push(l),r.push(l))}for(var c=[],f=o,d=0;d<f.length;d++){var h=f[d];c.push(h.plugin.visitor)}var m=T["default"].visitors.merge(c),y=new R["default"](s,{visitor:m});t.push(y.buildPass(this))}else t.push(a)}}return t},t.prototype.set=function(e,t){return this.data[e]=t},t.prototype.setDynamic=function(e,t){this.dynamicData[e]=t},t.prototype.get=function(e){var t=this.data[e];if(t)return t;var r=this.dynamicData[e];return r?this.set(e,r()):void 0},t.prototype.resolveModuleSource=function r(e){var r=this.opts.resolveModuleSource;return r&&(e=r(e,this.opts.filename)),e},t.prototype.addImport=function(e,t,r){t=t||e;var n=this.dynamicImportIds[t];if(!n){e=this.resolveModuleSource(e),n=this.dynamicImportIds[t]=this.scope.generateUidIdentifier(t);var i=[z.importDefaultSpecifier(n)],a=z.importDeclaration(i,z.literal(e));if(a._blockHoist=3,r){var s=this.dynamicImportTypes[r]=this.dynamicImportTypes[r]||[];s.push(a)}this.transformers["es6.modules"].canTransform()?(this.moduleFormatter.importSpecifier(i[0],a,this.dynamicImports,this.scope),this.moduleFormatter.hasLocalImports=!0):this.dynamicImports.push(a)}return n},t.prototype.attachAuxiliaryComment=function(e){var t=this.opts.auxiliaryCommentBefore;t&&(e.leadingComments=e.leadingComments||[],e.leadingComments.push({type:"CommentLine",value:" "+t}));var r=this.opts.auxiliaryCommentAfter;return r&&(e.trailingComments=e.trailingComments||[],e.trailingComments.push({type:"CommentLine",value:" "+r})),e},t.prototype.addHelper=function(e){var r=P["default"](t.soloHelpers,e);if(!r&&!P["default"](t.helpers,e))throw new ReferenceError("Unknown helper "+e);var n=this.declarations[e];if(n)return n;if(this.usedHelpers[e]=!0,!r){var i=this.get("helperGenerator"),a=this.get("helpersNamespace");if(i)return i(e);if(a){var s=z.identifier(z.toIdentifier(e));return z.memberExpression(a,s)}}var o=W.template("helper-"+e),u=this.declarations[e]=this.scope.generateUidIdentifier(e);return z.isFunctionExpression(o)&&!o.id?(o.body._compact=!0,o._generated=!0,o.id=u,o.type="FunctionDeclaration",this.attachAuxiliaryComment(o),this.path.unshiftContainer("body",o)):(o._compact=!0,this.scope.push({id:u,init:o,unique:!0})),u},t.prototype.addTemplateObject=function(e,t,r){var n=r.elements.map(function(e){return e.value}),i=e+"_"+r.elements.length+"_"+n.join(","),a=this.declarations[i];if(a)return a;var s=this.declarations[i]=this.scope.generateUidIdentifier("templateObject"),o=this.addHelper(e),u=z.callExpression(o,[t,r]);return u._compact=!0,this.scope.push({id:s,init:u,_blockHoist:1.9}),s},t.prototype.errorWithNode=function(e,t){var r,n=arguments.length<=2||void 0===arguments[2]?SyntaxError:arguments[2],i=e&&(e.loc||e._loc);return i?(r=new n("Line "+i.start.line+": "+t),r.loc=i.start):r=new n("There's been an error on a dynamic node. This is almost certainly an internal error. Please report it."),r},t.prototype.mergeSourceMap=function(e){var t=this.opts,r=t.inputSourceMap;if(r){e.sources[0]=r.file;var n=new A["default"].SourceMapConsumer(r),i=new A["default"].SourceMapConsumer(e),a=A["default"].SourceMapGenerator.fromSourceMap(i);a.applySourceMap(n);var s=a.toJSON();return s.sources=r.sources,s.file=r.file,s}return e},t.prototype.getModuleFormatter=function(t){(x["default"](t)||!c["default"][t])&&this.log.deprecate("Custom module formatters are deprecated and will be removed in the next major. Please use Babel plugins instead.");var r=x["default"](t)?t:c["default"][t];if(!r){var n=O["default"].relative(t);n&&(r=e(n))}if(!r)throw new ReferenceError("Unknown module formatter type "+JSON.stringify(t));return new r(this)},t.prototype.parse=function(e){var t=this.opts,r={highlightCode:t.highlightCode,nonStandard:t.nonStandard,sourceType:t.sourceType,filename:t.filename,plugins:{}},n=r.features={};for(var i in this.transformers){var a=this.transformers[i];n[i]=a.canTransform()}r.looseModules=this.isLoose("es6.modules"),r.strictMode=n.strict,this.log.debug("Parse start");var s=U["default"](e,r);return this.log.debug("Parse stop"),s},t.prototype._addAst=function(e){this.path=b["default"].get({hub:this.hub,parentPath:null,parent:e,container:e,key:"program"}).setContext(),this.scope=this.path.scope,this.ast=e},t.prototype.addAst=function(e){this.log.debug("Start set AST"),this._addAst(e),this.log.debug("End set AST"),this.log.debug("Start module formatter init");var t=this.moduleFormatter=this.getModuleFormatter(this.opts.modules);t.init&&this.transformers["es6.modules"].canTransform()&&t.init(),this.log.debug("End module formatter init")},t.prototype.transform=function(){this.call("pre");for(var e=this.transformerStack,t=0;t<e.length;t++){var r=e[t];r.transform()}return this.call("post"),this.generate()},t.prototype.wrap=function(e,t){e+="";try{return this.shouldIgnore()?this.makeResult({code:e,ignored:!0}):t()}catch(r){if(r._babel)throw r;r._babel=!0;var i=r.message=this.opts.filename+": "+r.message,a=r.loc;if(a&&(r.codeFrame=I["default"](e,a.line,a.column+1,this.opts),i+="\n"+r.codeFrame),n.browser&&(r.message=i),r.stack){var s=r.stack.replace(r.message,i);try{r.stack=s}catch(o){}}throw r}},t.prototype.addCode=function(e){e=(e||"")+"",e=this.parseInputSourceMap(e),this.code=e},t.prototype.parseCode=function(){this.parseShebang();var e=this.parse(this.code);this.addAst(e)},t.prototype.shouldIgnore=function(){var e=this.opts;return W.shouldIgnore(e.filename,e.ignore,e.only)},t.prototype.call=function(e){for(var t=this.uncollapsedTransformerStack,r=0;r<t.length;r++){var n=t[r],i=n.plugin[e];i&&i(this)}},t.prototype.parseInputSourceMap=function(e){var t=this.opts;if(t.inputSourceMap!==!1){var r=p["default"].fromSource(e);r&&(t.inputSourceMap=r.toObject(),e=p["default"].removeComments(e))}return e},t.prototype.parseShebang=function(){var e=g["default"].exec(this.code);e&&(this.shebang=e[0],this.code=this.code.replace(g["default"],""))},t.prototype.makeResult=function(e){var t=e.code,r=e.map,n=void 0===r?null:r,i=e.ast,a=e.ignored,s={metadata:null,ignored:!!a,code:null,ast:null,map:n};return this.opts.code&&(s.code=t),this.opts.ast&&(s.ast=i),this.opts.metadata&&(s.metadata=this.metadata,s.metadata.usedHelpers=Object.keys(this.usedHelpers)),s},t.prototype.generate=function(){var e=this.opts,t=this.ast,r={ast:t};if(!e.code)return this.makeResult(r);this.log.debug("Generation start");var n=C["default"](t,e,this.code);return r.code=n.code,
r.map=n.map,this.log.debug("Generation end"),this.shebang&&(r.code=this.shebang+"\n"+r.code),r.map&&(r.map=this.mergeSourceMap(r.map)),("inline"===e.sourceMaps||"both"===e.sourceMaps)&&(r.code+="\n"+p["default"].fromObject(r.map).toComment()),"inline"===e.sourceMaps&&(r.map=null),this.makeResult(r)},o(t,null,[{key:"helpers",value:["inherits","defaults","create-class","create-decorated-class","create-decorated-object","define-decorated-property-descriptor","tagged-template-literal","tagged-template-literal-loose","to-array","to-consumable-array","sliced-to-array","sliced-to-array-loose","object-without-properties","has-own","slice","bind","define-property","async-to-generator","interop-export-wildcard","interop-require-wildcard","interop-require-default","typeof","extends","get","set","new-arrow-check","class-call-check","object-destructuring-empty","temporal-undefined","temporal-assert-defined","self-global","typeof-react-element","default-props","instanceof","interop-require"],enumerable:!0},{key:"soloHelpers",value:[],enumerable:!0}]),t}();r["default"]=K,t.exports=r["default"]}).call(this,e(10))},{10:10,147:147,148:148,155:155,179:179,182:182,208:208,30:30,38:38,413:413,42:42,47:47,50:50,500:500,510:510,52:52,587:587,599:599,602:602,74:74,82:82,9:9}],47:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(389),s=n(a),o=s["default"]("babel:verbose"),u=s["default"]("babel"),p=[],l=function(){function e(t,r){i(this,e),this.filename=r,this.file=t}return e.prototype._buildMessage=function(e){var t="[BABEL] "+this.filename;return e&&(t+=": "+e),t},e.prototype.warn=function(e){console.warn(this._buildMessage(e))},e.prototype.error=function(e){var t=arguments.length<=1||void 0===arguments[1]?Error:arguments[1];throw new t(this._buildMessage(e))},e.prototype.deprecate=function(e){this.file.opts&&this.file.opts.suppressDeprecationMessages||(e=this._buildMessage(e),p.indexOf(e)>=0||(p.push(e),console.error(e)))},e.prototype.verbose=function(e){o.enabled&&o(this._buildMessage(e))},e.prototype.debug=function(e){u.enabled&&u(this._buildMessage(e))},e.prototype.deopt=function(e,t){this.debug(t)},e}();r["default"]=l,t.exports=r["default"]},{389:389}],48:[function(e,t,r){t.exports={filename:{type:"filename",description:"filename to use when reading from stdin - this will be used in source-maps, errors etc","default":"unknown",shorthand:"f"},filenameRelative:{hidden:!0,type:"string"},inputSourceMap:{hidden:!0},extra:{hidden:!0,"default":{}},env:{hidden:!0,"default":{}},moduleId:{description:"specify a custom name for module ids",type:"string"},getModuleId:{hidden:!0},retainLines:{type:"boolean","default":!1,description:"retain line numbers - will result in really ugly code"},nonStandard:{type:"boolean","default":!0,description:"enable/disable support for JSX and Flow (on by default)"},experimental:{type:"boolean",description:"allow use of experimental transformers","default":!1},highlightCode:{description:"enable/disable ANSI syntax highlighting of code frames (on by default)",type:"boolean","default":!0},suppressDeprecationMessages:{type:"boolean","default":!1,hidden:!0},resolveModuleSource:{hidden:!0},stage:{description:"ECMAScript proposal stage version to allow [0-4]",shorthand:"e",type:"number","default":2},blacklist:{type:"transformerList",description:"blacklist of transformers to NOT use",shorthand:"b","default":[]},whitelist:{type:"transformerList",optional:!0,description:"whitelist of transformers to ONLY use",shorthand:"l"},optional:{type:"transformerList",description:"list of optional transformers to enable","default":[]},modules:{type:"string",description:"module formatter type to use [common]","default":"common",shorthand:"m"},moduleIds:{type:"boolean","default":!1,shorthand:"M",description:"insert an explicit id for modules"},loose:{type:"transformerList",description:"list of transformers to enable loose mode ON",shorthand:"L"},jsxPragma:{type:"string",description:"custom pragma to use with JSX (same functionality as @jsx comments)","default":"React.createElement",shorthand:"P"},plugins:{type:"list",description:"","default":[]},ignore:{type:"list",description:"list of glob paths to **not** compile","default":[]},only:{type:"list",description:"list of glob paths to **only** compile"},code:{hidden:!0,"default":!0,type:"boolean"},metadata:{hidden:!0,"default":!0,type:"boolean"},ast:{hidden:!0,"default":!0,type:"boolean"},comments:{type:"boolean","default":!0,description:"strip/output comments in generated output (on by default)"},shouldPrintComment:{hidden:!0,description:"optional callback to control whether a comment should be inserted, when this is used the comments option is ignored"},compact:{type:"booleanString","default":"auto",description:"do not include superfluous whitespace characters and line terminators [true|false|auto]"},keepModuleIdExtensions:{type:"boolean",description:"keep extensions when generating module ids","default":!1,shorthand:"k"},auxiliaryComment:{deprecated:"renamed to auxiliaryCommentBefore",shorthand:"a",alias:"auxiliaryCommentBefore"},auxiliaryCommentBefore:{type:"string","default":"",description:"attach a comment before all helper declarations and auxiliary code"},auxiliaryCommentAfter:{type:"string","default":"",description:"attach a comment after all helper declarations and auxiliary code"},externalHelpers:{type:"boolean","default":!1,shorthand:"r",description:"uses a reference to `babelHelpers` instead of placing helpers at the top of your code."},metadataUsedHelpers:{deprecated:"Not required anymore as this is enabled by default",type:"boolean","default":!1,hidden:!0},sourceMap:{alias:"sourceMaps",hidden:!0},sourceMaps:{type:"booleanString",description:"[true|false|inline]","default":!1,shorthand:"s"},sourceMapName:{alias:"sourceMapTarget",description:"DEPRECATED - Please use sourceMapTarget"},sourceMapTarget:{type:"string",description:"set `file` on returned source map"},sourceFileName:{type:"string",description:"set `sources[0]` on returned source map"},sourceRoot:{type:"filename",description:"the root from which all sources are relative"},moduleRoot:{type:"filename",description:"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions"},breakConfig:{type:"boolean","default":!1,hidden:!0,description:"stop trying to load .babelrc files"},babelrc:{description:"Specify a custom list of babelrc files to use",type:"list"},sourceType:{description:"","default":"module"}}},{}],49:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e,t,r){var n=l["default"][e],i=n&&u[n.type];return i&&i.validate?i.validate(e,t,r):t}function s(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];for(var t in e){var r=e[t];if(null!=r){var n=l["default"][t];if(n){var i=u[n.type];i&&(r=i(r)),e[t]=r}}}return e}r.__esModule=!0,r.validateOption=a,r.normaliseOptions=s;var o=e(51),u=i(o),p=e(48),l=n(p);r.config=l["default"]},{48:48,51:51}],50:[function(e,t,r){(function(n){"use strict";function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e){var t=D[e];return null!=t?t:D[e]=d["default"].sync(e)}r.__esModule=!0;var o=e(49),u=e(402),p=i(u),l=e(527),c=i(l),f=e(526),d=i(f),h=e(494),m=i(h),y=e(39),g=i(y),v=e(48),b=i(v),E=e(9),x=i(E),S=e(1),A=i(S),D={},C={},w=".babelignore",I=".babelrc",_="package.json",F=function(){function e(t,r){a(this,e),this.resolvedConfigs=[],this.options=e.createBareOptions(),this.pipeline=r,this.log=t}return e.createBareOptions=function(){var e={};for(var t in b["default"]){var r=b["default"][t];e[t]=m["default"](r["default"])}return e},e.prototype.addConfig=function(e,t){var r=arguments.length<=2||void 0===arguments[2]?p["default"]:arguments[2];if(!(this.resolvedConfigs.indexOf(e)>=0)){var n,i=A["default"].readFileSync(e,"utf8");try{n=C[i]=C[i]||r.parse(i),t&&(n=n[t])}catch(a){throw a.message=e+": Error while parsing JSON - "+a.message,a}this.mergeOptions(n,e),this.resolvedConfigs.push(e)}},e.prototype.mergeOptions=function(e){var t=arguments.length<=1||void 0===arguments[1]?"foreign":arguments[1];if(e){for(var r in e)if("_"!==r[0]){var n=b["default"][r];n||this.log.error("Unknown option: "+t+"."+r,ReferenceError)}o.normaliseOptions(e),g["default"](this.options,e)}},e.prototype.addIgnoreConfig=function(e){var t=A["default"].readFileSync(e,"utf8"),r=t.split("\n");r=r.map(function(e){return e.replace(/#(.*?)$/,"").trim()}).filter(function(e){return!!e}),this.mergeOptions({ignore:r},e)},e.prototype.findConfigs=function(e){if(e)for(c["default"](e)||(e=x["default"].join(n.cwd(),e));e!==(e=x["default"].dirname(e));){if(this.options.breakConfig)return;var t=x["default"].join(e,I);s(t)&&this.addConfig(t);var r=x["default"].join(e,_);s(r)&&this.addConfig(r,"babel",JSON);var i=x["default"].join(e,w);s(i)&&this.addIgnoreConfig(i)}},e.prototype.normaliseOptions=function(){var e=this.options;for(var t in b["default"]){var r=b["default"][t],n=e[t];(n||!r.optional)&&(this.log&&n&&r.deprecated&&this.log.deprecate("Deprecated option "+t+": "+r.deprecated),this.pipeline&&n&&(n=o.validateOption(t,n,this.pipeline)),r.alias?e[r.alias]=e[r.alias]||n:e[t]=n)}},e.prototype.init=function(e){if(this.mergeOptions(e,"direct"),e.babelrc)for(var t=e.babelrc,r=0;r<t.length;r++){var i=t[r];this.addConfig(i)}e.babelrc!==!1&&this.findConfigs(e.filename);var a=n.env.BABEL_ENV||n.env.NODE_ENV||"development";return this.options.env&&this.mergeOptions(this.options.env[a],"direct.env."+a),this.normaliseOptions(e),this.options},e}();r["default"]=F,t.exports=r["default"]}).call(this,e(10))},{1:1,10:10,39:39,402:402,48:48,49:49,494:494,526:526,527:527,9:9}],51:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){return d.arrayify(e)}function s(e){return+e}function o(e){return!!e}function u(e){return d.booleanify(e)}function p(e){return d.list(e)}r.__esModule=!0,r.transformerList=a,r.number=s,r["boolean"]=o,r.booleanString=u,r.list=p;var l=e(588),c=i(l),f=e(182),d=n(f);a.validate=function(e,t,r){return(t.indexOf("all")>=0||t.indexOf(!0)>=0)&&(t=Object.keys(r.transformers)),r._ensureTransformerNames(e,t)};var h=c["default"];r.filename=h},{182:182,588:588}],52:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e(83),u=i(o),p=e(82),l=i(p),c=e(179),f=n(c),d=e(43),h=n(d),m=e(602),y=i(m),g=e(148),v=i(g),b=e(42),E=i(b),x={messages:h,Transformer:u["default"],Plugin:l["default"],types:f,parse:E["default"],traverse:v["default"]},S=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{transformers:{},before:[],after:[]}:arguments[0],r=e.file,n=e.transformers,i=e.before,s=e.after;a(this,t),this.transformers=n,this.file=r,this.before=i,this.after=s}return t.memoisePluginContainer=function(e){for(var r=0;r<t.memoisedPlugins.length;r++){var n=t.memoisedPlugins[r];if(n.container===e)return n.transformer}var i=e(x);return t.memoisedPlugins.push({container:e,transformer:i}),i},s(t,null,[{key:"memoisedPlugins",value:[],enumerable:!0},{key:"positions",value:["before","after"],enumerable:!0}]),t.prototype.subnormaliseString=function(t,r){var n=t.match(/^(.*?):(after|before)$/);n&&(t=n[1],r=n[2]);var i=y["default"].relative("babel-plugin-"+t)||y["default"].relative(t);if(i){var a=e(i);return{position:r,plugin:a["default"]||a}}throw new ReferenceError(h.get("pluginUnknown",t))},t.prototype.validate=function(e,t){var r=t.key;if(this.transformers[r])throw new ReferenceError(h.get("pluginKeyCollision",r));if(!t.buildPass||"Plugin"!==t.constructor.name)throw new TypeError(h.get("pluginNotTransformer",e));t.metadata.plugin=!0},t.prototype.add=function(e){var r,n;if(!e)throw new TypeError(h.get("pluginIllegalKind",typeof e,e));if("object"==typeof e&&e.transformer?(n=e.transformer,r=e.position):"string"!=typeof e&&(n=e),"string"==typeof e){var i=this.subnormaliseString(e,r);n=i.plugin,r=i.position}if(r=r||"before",t.positions.indexOf(r)<0)throw new TypeError(h.get("pluginIllegalPosition",r,e));"function"==typeof n&&(n=t.memoisePluginContainer(n)),this.validate(e,n);var a=this.transformers[n.key]=n.buildPass(this.file);if(a.canTransform()){var s="before"===r?this.before:this.after;s.push(a)}},t}();r["default"]=S,t.exports=r["default"]},{148:148,179:179,42:42,43:43,602:602,82:82,83:83}],53:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(58),s=i(a),o=e(179),u=n(o);r["default"]=function(e){var t={},r=function(t){return t.operator===e.operator+"="},n=function(e,t){return u.assignmentExpression("=",e,t)};return t.ExpressionStatement=function(t,i,a,o){if(!this.isCompletionRecord()){var p=t.expression;if(r(p)){var l=[],c=s["default"](p.left,l,o,a,!0);return l.push(u.expressionStatement(n(c.ref,e.build(c.uid,p.right)))),l}}},t.AssignmentExpression=function(t,i,a,o){if(r(t)){var u=[],p=s["default"](t.left,u,o,a);return u.push(n(p.ref,e.build(p.uid,t.right))),u}},t.BinaryExpression=function(t){return t.operator===e.operator?e.build(t.left,t.right):void 0},t},t.exports=r["default"]},{179:179,58:58}],54:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=e.blocks.shift();if(r){var n=i(e,t);return n||(n=t(),e.filter&&(n=s.ifStatement(e.filter,s.blockStatement([n])))),s.forOfStatement(s.variableDeclaration("let",[s.variableDeclarator(r.left)]),r.right,s.blockStatement([n]))}}r.__esModule=!0,r["default"]=i;var a=e(179),s=n(a);t.exports=r["default"]},{179:179}],55:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(506),s=i(a),o=e(43),u=n(o),p=e(395),l=i(p),c=e(62),f=n(c),d=e(179),h=n(d);r["default"]=function(e){var t={};t.JSXIdentifier=function(e){return"this"===e.name&&this.isReferenced()?h.thisExpression():l["default"].keyword.isIdentifierNameES6(e.name)?void(e.type="Identifier"):h.literal(e.name)},t.JSXNamespacedName=function(){throw this.errorWithNode(u.get("JSXNamespacedTags"))},t.JSXMemberExpression={exit:function(e){e.computed=h.isLiteral(e.property),e.type="MemberExpression"}},t.JSXExpressionContainer=function(e){return e.expression},t.JSXAttribute={enter:function(e){var t=e.value;h.isLiteral(t)&&s["default"](t.value)&&(t.value=t.value.replace(/\n\s+/g," "))},exit:function(e){var t=e.value||h.literal(!0);return h.inherits(h.property("init",e.name,t),e)}},t.JSXOpeningElement={exit:function(t,n,i,a){n.children=f.buildChildren(n);var s,o=t.name,u=[];h.isIdentifier(o)?s=o.name:h.isLiteral(o)&&(s=o.value);var p={tagExpr:o,tagName:s,args:u};e.pre&&e.pre(p,a);var l=t.attributes;return l=l.length?r(l,a):h.literal(null),u.push(l),e.post&&e.post(p,a),p.call||h.callExpression(p.callee,u)}};var r=function(e,t){for(var r=[],n=[],i=function(){r.length&&(n.push(h.objectExpression(r)),r=[])};e.length;){var a=e.shift();h.isJSXSpreadAttribute(a)?(i(),n.push(a.argument)):r.push(a)}return i(),1===n.length?e=n[0]:(h.isObjectExpression(n[0])||n.unshift(h.objectExpression([])),e=h.callExpression(t.addHelper("extends"),n)),e};return t.JSXElement={exit:function(e){var t=e.openingElement;return t.arguments=t.arguments.concat(e.children),t.arguments.length>=3&&(t._prettyCall=!0),h.inherits(t,e)}},t},t.exports=r["default"]},{179:179,395:395,43:43,506:506,62:62}],56:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={enter:function(e,t,r,n){(this.isThisExpression()||this.isReferencedIdentifier({name:"arguments"}))&&(n.found=!0,this.stop())},Function:function(){this.skip()}};r["default"]=function(e,t){var r=a.functionExpression(null,[],e.body,e.generator,e.async),n=r,i=[],o={found:!1};t.traverse(e,s,o),o.found&&(n=a.memberExpression(r,a.identifier("apply")),i=[a.thisExpression(),a.identifier("arguments")]);var u=a.callExpression(n,i);return e.generator&&(u=a.yieldExpression(u,!0)),a.returnStatement(u)},t.exports=r["default"]},{179:179}],57:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n){var i=m.toKeyAlias(t),a={};if(d["default"](e,i)&&(a=e[i]),e[i]=a,a._inherits=a._inherits||[],a._inherits.push(t),a._key=t.key,t.computed&&(a._computed=!0),t.decorators){var s=a.decorators=a.decorators||m.arrayExpression([]);s.elements=s.elements.concat(t.decorators.map(function(e){return e.expression}).reverse())}if(a.value||a.initializer)throw n.errorWithNode(t,"Key conflict with sibling node");return t.value&&("init"===t.kind&&(r="value"),"get"===t.kind&&(r="get"),"set"===t.kind&&(r="set"),m.inheritsComments(t.value,t),a[r]=t.value),a}function s(e){for(var t in e)if(e[t]._computed)return!0;return!1}function o(e){for(var t=m.arrayExpression([]),r=0;r<e.properties.length;r++){var n=e.properties[r],i=n.value;i.properties.unshift(m.property("init",m.identifier("key"),m.toComputedKey(n))),t.elements.push(i)}return t}function u(e){var t=m.objectExpression([]);return c["default"](e,function(e){var r=m.objectExpression([]),n=m.property("init",e._key,r,e._computed);c["default"](e,function(e,t){if("_"!==t[0]){var n=e;(m.isMethodDefinition(e)||m.isClassProperty(e))&&(e=e.value);var i=m.property("init",m.identifier(t),e);m.inheritsComments(i,n),m.removeComments(n),r.properties.push(i)}}),t.properties.push(n)}),t}function p(e){return c["default"](e,function(e){e.value&&(e.writable=m.literal(!0)),e.configurable=m.literal(!0),e.enumerable=m.literal(!0)}),u(e)}r.__esModule=!0,r.push=a,r.hasComputed=s,r.toComputedObjectFromClass=o,r.toClassObject=u,r.toDefineObject=p;var l=e(411),c=i(l),f=e(512),d=i(f),h=e(179),m=n(h)},{179:179,411:411,512:512}],58:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s=function(e,t,r,n){var i;if(a.isIdentifier(e)){if(n.hasBinding(e.name))return e;i=e}else{if(!a.isMemberExpression(e))throw new Error("We can't explode this node type "+e.type);if(i=e.object,a.isIdentifier(i)&&n.hasGlobal(i.name))return i}var s=n.generateUidIdentifierBasedOnNode(i);return t.push(a.variableDeclaration("var",[a.variableDeclarator(s,i)])),s},o=function(e,t,r,n){var i=e.property,s=a.toComputedKey(e,i);if(a.isLiteral(s))return s;var o=n.generateUidIdentifierBasedOnNode(i);return t.push(a.variableDeclaration("var",[a.variableDeclarator(o,i)])),o};r["default"]=function(e,t,r,n,i){var u;u=a.isIdentifier(e)&&i?e:s(e,t,r,n);var p,l;if(a.isIdentifier(e))p=e,l=u;else{var c=o(e,t,r,n),f=e.computed||a.isLiteral(c);l=p=a.memberExpression(u,c,f)}return{uid:l,ref:p}},t.exports=r["default"]},{179:179}],59:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i);r["default"]=function(e){for(var t=0,r=0;r<e.params.length;r++){var n=e.params[r];a.isAssignmentPattern(n)||a.isRestElement(n)||(t=r+1)}return t},t.exports=r["default"]},{179:179}],60:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i);r["default"]=function(e,t){for(var r=0;r<e.length;r++){var n=e[r],i=n.expression;if(a.isMemberExpression(i)){var s,o=t.maybeGenerateMemoised(i.object),u=[];o?(s=o,u.push(a.assignmentExpression("=",o,i.object))):s=i.object,u.push(a.callExpression(a.memberExpression(a.memberExpression(s,i.property,i.computed),a.identifier("bind")),[s])),1===u.length?n.expression=u[0]:n.expression=a.sequenceExpression(u)}}return e},t.exports=r["default"]},{179:179}],61:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n){if(t.name===n.name){var i=r.getBindingIdentifier(n.name);i===n.outerDeclar&&(n.selfReference=!0,e.stop())}}function s(e,t,r){var n=g(e,t.name,r);return y(n,e,t,r)}function o(e,t,r){var n=h.toComputedKey(e,e.key);if(h.isLiteral(n)){var i=h.toBindingIdentifierName(n.value),a=h.identifier(i),s=e.value,o=g(s,i,r);e.value=y(o,s,a,r)||s}}function u(e,t,r){if(!e.id){var n;if(!h.isProperty(t)||"init"!==t.kind||t.computed&&!h.isLiteral(t.key)){if(!h.isVariableDeclarator(t))return;if(n=t.id,h.isIdentifier(n)){var i=r.parent.getBinding(n.name);if(i&&i.constant&&r.getBinding(n.name)===i)return void(e.id=n)}}else n=t.key;var a;if(h.isLiteral(n))a=n.value;else{if(!h.isIdentifier(n))return;a=n.name}a=h.toBindingIdentifierName(a),n=h.identifier(a);var s=g(e,a,r);return y(s,e,n,r)}}r.__esModule=!0,r.custom=s,r.property=o,r.bare=u;var p=e(59),l=i(p),c=e(182),f=n(c),d=e(179),h=n(d),m={ReferencedIdentifier:function(e,t,r,n){a(this,e,r,n)},BindingIdentifier:function(e,t,r,n){a(this,e,r,n)}},y=function(e,t,r,n){if(e.selfReference){if(!n.hasBinding(r.name)||n.hasGlobal(r.name)){var i="property-method-assignment-wrapper";t.generator&&(i+="-generator");var a=f.template(i,{FUNCTION:t,FUNCTION_ID:r,FUNCTION_KEY:n.generateUidIdentifier(r.name)});a.callee._skipModulesRemap=!0;for(var s=a.callee.body.body[0].params,o=0,u=l["default"](t);u>o;o++)s.push(n.generateUidIdentifier("x"));return a}n.rename(r.name)}t.id=r,n.getProgramParent().references[r.name]=!0},g=function(e,t,r){var n={selfAssignment:!1,selfReference:!1,outerDeclar:r.getBindingIdentifier(t),references:[],name:t},i=r.getOwnBinding(t);return i?"param"===i.kind&&(n.selfReference=!0):(n.outerDeclar||r.hasGlobal(t))&&r.traverse(e,m,n),n}},{179:179,182:182,59:59}],62:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&/^[a-z]|\-/.test(e)}function a(e,t){for(var r=e.value.split(/\r\n|\n|\r/),n=0,i=0;i<r.length;i++)r[i].match(/[^ \t]/)&&(n=i);for(var a="",i=0;i<r.length;i++){var s=r[i],o=0===i,p=i===r.length-1,l=i===n,c=s.replace(/\t/g," ");o||(c=c.replace(/^[ ]+/,"")),p||(c=c.replace(/[ ]+$/,"")),c&&(l||(c+=" "),a+=c)}a&&t.push(u.literal(a))}function s(e){for(var t=[],r=0;r<e.children.length;r++){var n=e.children[r];u.isLiteral(n)&&"string"==typeof n.value?a(n,t):(u.isJSXExpressionContainer(n)&&(n=n.expression),u.isJSXEmptyExpression(n)||t.push(n))}return t}r.__esModule=!0,r.isCompatTag=i,r.buildChildren=s;var o=e(179),u=n(o),p=u.buildMatchMemberExpression("React.Component");r.isReactComponent=p},{179:179}],63:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){return l.isLiteral(e)&&e.regex&&e.regex.flags.indexOf(t)>=0}function s(e,t){var r=e.regex.flags.split("");e.regex.flags.indexOf(t)<0||(u["default"](r,t),e.regex.flags=r.join(""))}r.__esModule=!0,r.is=a,r.pullFlag=s;var o=e(408),u=i(o),p=e(179),l=n(p)},{179:179,408:408}],64:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={Function:function(){this.skip()},AwaitExpression:function(e){e.type="YieldExpression",e.all&&(e.all=!1,e.argument=a.callExpression(a.memberExpression(a.identifier("Promise"),a.identifier("all")),[e.argument]))}},o={ReferencedIdentifier:function(e,t,r,n){var i=n.id.name;return e.name===i&&r.bindingIdentifierEquals(i,n.id)?n.ref=n.ref||r.generateUidIdentifier(i):void 0}};r["default"]=function(e,t){var r=e.node;r.async=!1,r.generator=!0,e.traverse(s,p);var n=a.callExpression(t,[r]),i=r.id;if(r.id=null,a.isFunctionDeclaration(r)){var u=a.variableDeclaration("let",[a.variableDeclarator(i,n)]);return u._blockHoist=!0,u}if(i){var p={id:i};if(e.traverse(o,p),p.ref)return e.scope.parent.push({id:p.ref}),a.assignmentExpression("=",p.ref,n)}return n},t.exports=r["default"]},{179:179}],65:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){return l.isSuper(e)?l.isMemberExpression(t,{computed:!1})?!1:l.isCallExpression(t,{callee:e})?!1:!0:!1}function s(e){return l.isMemberExpression(e)&&l.isSuper(e.object)}r.__esModule=!0;var o=e(43),u=n(o),p=e(179),l=n(p),c={enter:function(e,t,r,n){var i=n.topLevel,a=n.self;if(l.isFunction(e)&&!l.isArrowFunctionExpression(e))return a.traverseLevel(this,!1),this.skip();if(l.isProperty(e,{method:!0})||l.isMethodDefinition(e))return this.skip();var s=i?l.thisExpression:a.getThisReference.bind(a),o=a.specHandle;a.isLoose&&(o=a.looseHandle);var u=o.call(a,this,s);return u&&(this.hasSuper=!0),u!==!0?u:void 0}},f=function(){function e(t){var r=arguments.length<=1||void 0===arguments[1]?!1:arguments[1];i(this,e),this.topLevelThisReference=t.topLevelThisReference,this.methodPath=t.methodPath,this.methodNode=t.methodNode,this.superRef=t.superRef,this.isStatic=t.isStatic,this.hasSuper=!1,this.inClass=r,this.isLoose=t.isLoose,this.scope=t.scope,this.file=t.file,this.opts=t}return e.prototype.getObjectRef=function(){return this.opts.objectRef||this.opts.getObjectRef()},e.prototype.setSuperProperty=function(e,t,r,n){return l.callExpression(this.file.addHelper("set"),[l.callExpression(l.memberExpression(l.identifier("Object"),l.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():l.memberExpression(this.getObjectRef(),l.identifier("prototype"))]),r?e:l.literal(e.name),t,n])},e.prototype.getSuperProperty=function(e,t,r){return l.callExpression(this.file.addHelper("get"),[l.callExpression(l.memberExpression(l.identifier("Object"),l.identifier("getPrototypeOf")),[this.isStatic?this.getObjectRef():l.memberExpression(this.getObjectRef(),l.identifier("prototype"))]),t?e:l.literal(e.name),r])},e.prototype.replace=function(){this.traverseLevel(this.methodPath.get("value"),!0)},e.prototype.traverseLevel=function(e,t){var r={self:this,topLevel:t};e.traverse(c,r)},e.prototype.getThisReference=function(){if(this.topLevelThisReference)return this.topLevelThisReference;var e=this.topLevelThisReference=this.scope.generateUidIdentifier("this");return this.methodNode.value.body.body.unshift(l.variableDeclaration("var",[l.variableDeclarator(this.topLevelThisReference,l.thisExpression())])),e},e.prototype.getLooseSuperProperty=function(e,t){var r=this.methodNode,n=r.key,i=this.superRef||l.identifier("Function");return t.property===e?void 0:l.isCallExpression(t,{callee:e})?(t.arguments.unshift(l.thisExpression()),"constructor"===n.name?2===t.arguments.length&&l.isSpreadElement(t.arguments[1])&&l.isIdentifier(t.arguments[1].argument,{name:"arguments"})?(t.arguments[1]=t.arguments[1].argument,l.memberExpression(i,l.identifier("apply"))):l.memberExpression(i,l.identifier("call")):(e=i,r["static"]||(e=l.memberExpression(e,l.identifier("prototype"))),e=l.memberExpression(e,n,r.computed),l.memberExpression(e,l.identifier("call")))):l.isMemberExpression(t)&&!r["static"]?l.memberExpression(i,l.identifier("prototype")):i},e.prototype.looseHandle=function(e,t){var r=e.node;if(e.isSuper())return this.getLooseSuperProperty(r,e.parent);if(e.isCallExpression()){var n=r.callee;if(!l.isMemberExpression(n))return;if(!l.isSuper(n.object))return;return l.appendToMemberExpression(n,l.identifier("call")),r.arguments.unshift(t()),!0}},e.prototype.specHandleAssignmentExpression=function(e,t,r,n){return"="===r.operator?this.setSuperProperty(r.left.property,r.right,r.left.computed,n()):(e=e||t.scope.generateUidIdentifier("ref"),[l.variableDeclaration("var",[l.variableDeclarator(e,r.left)]),l.expressionStatement(l.assignmentExpression("=",r.left,l.binaryExpression(r.operator[0],e,r.right)))])},e.prototype.specHandle=function(e,t){var r,n,i,o,p=this.methodNode,c=e.parent,f=e.node;if(a(f,c))throw e.errorWithNode(u.get("classesIllegalBareSuper"));if(l.isCallExpression(f)){var d=f.callee;if(l.isSuper(d)){if(r=p.key,n=p.computed,i=f.arguments,"constructor"!==p.key.name||!this.inClass){var h=p.key.name||"METHOD_NAME";throw this.file.errorWithNode(f,u.get("classesIllegalSuperCall",h))}}else s(d)&&(r=d.property,n=d.computed,i=f.arguments)}else if(l.isMemberExpression(f)&&l.isSuper(f.object))r=f.property,n=f.computed;else{if(l.isUpdateExpression(f)&&s(f.argument)){var m=l.binaryExpression(f.operator[0],f.argument,l.literal(1));if(f.prefix)return this.specHandleAssignmentExpression(null,e,m,t);var y=e.scope.generateUidIdentifier("ref");return this.specHandleAssignmentExpression(y,e,m,t).concat(l.expressionStatement(y))}if(l.isAssignmentExpression(f)&&s(f.left))return this.specHandleAssignmentExpression(null,e,f,t)}if(r){o=t();var g=this.getSuperProperty(r,n,o);return i?1===i.length&&l.isSpreadElement(i[0])?l.callExpression(l.memberExpression(g,l.identifier("apply")),[o,i[0].argument]):l.callExpression(l.memberExpression(g,l.identifier("call")),[o].concat(i)):g}},e}();r["default"]=f,t.exports=r["default"]},{179:179,43:43}],66:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(80),s=i(a),o=e(126),u=i(o),p=e(85),l=i(p),c=e(84),f=i(c),d=e(125),h=n(d),m=new s["default"];for(var y in u["default"]){var g=u["default"][y];if("object"==typeof g){var v=g.metadata=g.metadata||{};v.group=v.group||"builtin-basic"}}m.addTransformers(u["default"]),m.addDeprecated(l["default"]),m.addAliases(f["default"]),m.addFilter(h.internal),m.addFilter(h.blacklist),m.addFilter(h.whitelist),m.addFilter(h.stage),m.addFilter(h.optional);var b=m.transform.bind(m);b.fromAst=m.transformFromAst.bind(m),b.pipeline=m,r["default"]=b,t.exports=r["default"]},{125:125,126:126,80:80,84:84,85:85}],67:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);
return t["default"]=e,t}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(75),o=i(s),u=e(43),p=i(u),l=e(76),c=n(l),f=e(41),d=n(f),h=e(182),m=i(h),y=e(179),g=i(y),v=function(){function e(t){a(this,e),this.sourceScopes=d["default"](),this.defaultIds=d["default"](),this.ids=d["default"](),this.remaps=new c["default"](t,this),this.scope=t.scope,this.file=t,this.hasNonDefaultExports=!1,this.hasLocalExports=!1,this.hasLocalImports=!1,this.localExports=d["default"](),this.localImports=d["default"](),this.metadata=t.metadata.modules,this.getMetadata()}return e.prototype.addScope=function(e){var t=e.node.source&&e.node.source.value;if(t){var r=this.sourceScopes[t];if(r&&r!==e.scope)throw e.errorWithNode(p.get("modulesDuplicateDeclarations"));this.sourceScopes[t]=e.scope}},e.prototype.isModuleType=function(e,t){var r=this.file.dynamicImportTypes[t];return r&&r.indexOf(e)>=0},e.prototype.transform=function(){this.remapAssignments()},e.prototype.doDefaultExportInterop=function(e){return(g.isExportDefaultDeclaration(e)||g.isSpecifierDefault(e))&&!this.noInteropRequireExport&&!this.hasNonDefaultExports},e.prototype.getMetadata=function(){for(var e=!1,t=this.file.ast.program.body,r=0;r<t.length;r++){var n=t[r];if(g.isModuleDeclaration(n)){e=!0;break}}(e||this.isLoose())&&this.file.path.traverse(o,this)},e.prototype.remapAssignments=function(){(this.hasLocalExports||this.hasLocalImports)&&this.remaps.run()},e.prototype.remapExportAssignment=function(e,t){for(var r=e,n=0;n<t.length;n++)r=g.assignmentExpression("=",g.memberExpression(g.identifier("exports"),t[n]),r);return r},e.prototype._addExport=function(e,t){var r=this.localExports[e]=this.localExports[e]||{binding:this.scope.getBindingIdentifier(e),exported:[]};r.exported.push(t)},e.prototype.getExport=function(e,t){if(g.isIdentifier(e)){var r=this.localExports[e.name];return r&&r.binding===t.getBindingIdentifier(e.name)?r.exported:void 0}},e.prototype.getModuleName=function(){var e=this.file.opts;if(null!=e.moduleId&&!e.getModuleId)return e.moduleId;var t=e.filenameRelative,r="";if(null!=e.moduleRoot&&(r=e.moduleRoot+"/"),!e.filenameRelative)return r+e.filename.replace(/^\//,"");if(null!=e.sourceRoot){var n=new RegExp("^"+e.sourceRoot+"/?");t=t.replace(n,"")}return e.keepModuleIdExtensions||(t=t.replace(/\.(\w*?)$/,"")),r+=t,r=r.replace(/\\/g,"/"),e.getModuleId?e.getModuleId(r)||r:r},e.prototype._pushStatement=function(e,t){return(g.isClass(e)||g.isFunction(e))&&e.id&&(t.push(g.toStatement(e)),e=e.id),e},e.prototype._hoistExport=function(e,t,r){return g.isFunctionDeclaration(e)&&(t._blockHoist=r||2),t},e.prototype.getExternalReference=function(e,t){var r=this.ids,n=e.source.value;return r[n]?r[n]:this.ids[n]=this._getExternalReference(e,t)},e.prototype.checkExportIdentifier=function(e){if(g.isIdentifier(e,{name:"__esModule"}))throw this.file.errorWithNode(e,p.get("modulesIllegalExportName",e.name))},e.prototype.exportAllDeclaration=function(e,t){var r=this.getExternalReference(e,t);t.push(this.buildExportsWildcard(r,e))},e.prototype.isLoose=function(){return this.file.isLoose("es6.modules")},e.prototype.exportSpecifier=function(e,t,r){if(t.source){var n=this.getExternalReference(t,r);if("default"!==e.local.name||this.noInteropRequireExport){if(n=g.memberExpression(n,e.local),!this.isLoose())return void r.push(this.buildExportsFromAssignment(e.exported,n,t))}else n=g.callExpression(this.file.addHelper("interop-require"),[n]);r.push(this.buildExportsAssignment(e.exported,n,t))}else r.push(this.buildExportsAssignment(e.exported,e.local,t))},e.prototype.buildExportsWildcard=function(e){return g.expressionStatement(g.callExpression(this.file.addHelper("defaults"),[g.identifier("exports"),g.callExpression(this.file.addHelper("interop-export-wildcard"),[e,this.file.addHelper("defaults")])]))},e.prototype.buildExportsFromAssignment=function(e,t){return this.checkExportIdentifier(e),m.template("exports-from-assign",{INIT:t,ID:g.literal(e.name)},!0)},e.prototype.buildExportsAssignment=function(e,t){return this.checkExportIdentifier(e),m.template("exports-assign",{VALUE:t,KEY:e},!0)},e.prototype.exportDeclaration=function(e,t){var r=e.declaration,n=r.id;g.isExportDefaultDeclaration(e)&&(n=g.identifier("default"));var i;if(g.isVariableDeclaration(r))for(var a=0;a<r.declarations.length;a++){var s=r.declarations[a];s.init=this.buildExportsAssignment(s.id,s.init,e).expression;var o=g.variableDeclaration(r.kind,[s]);0===a&&g.inherits(o,r),t.push(o)}else{var u=r;(g.isFunctionDeclaration(r)||g.isClassDeclaration(r))&&(u=r.id,t.push(r)),i=this.buildExportsAssignment(n,u,e),t.push(i),this._hoistExport(r,i)}},e}();r["default"]=v,t.exports=r["default"]},{179:179,182:182,41:41,43:43,75:75,76:76}],68:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(182),a=n(i);r["default"]=function(e){var t=function(){this.noInteropRequireImport=!0,this.noInteropRequireExport=!0,e.apply(this,arguments)};return a.inherits(t,e),t},t.exports=r["default"]},{182:182}],69:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(70),a=n(i),s=e(68),o=n(s);r["default"]=o["default"](a["default"]),t.exports=r["default"]},{68:68,70:70}],70:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(72),l=i(p),c=e(413),f=i(c),d=e(517),h=i(d),m=e(182),y=n(m),g=e(179),v=n(g),b=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.setup=function(){l["default"].prototype._setup.call(this,this.hasNonDefaultExports)},t.prototype.buildDependencyLiterals=function(){var e=[];for(var t in this.ids)e.push(v.literal(t));return e},t.prototype.transform=function(e){l["default"].prototype.transform.apply(this,arguments);var t=e.body,r=[v.literal("exports")];this.passModuleArg&&r.push(v.literal("module")),r=r.concat(this.buildDependencyLiterals()),r=v.arrayExpression(r);var n=h["default"](this.ids);this.passModuleArg&&n.unshift(v.identifier("module")),n.unshift(v.identifier("exports"));var i=v.functionExpression(null,n,v.blockStatement(t)),a=[r,i],s=this.getModuleName();s&&a.unshift(v.literal(s));var o=v.callExpression(v.identifier("define"),a);e.body=[v.expressionStatement(o)]},t.prototype.getModuleName=function(){return this.file.opts.moduleIds?u["default"].prototype.getModuleName.apply(this,arguments):null},t.prototype._getExternalReference=function(e){return this.scope.generateUidIdentifier(e.source.value)},t.prototype.importDeclaration=function(e){this.getExternalReference(e)},t.prototype.importSpecifier=function(e,t,r,n){var i=t.source.value,a=this.getExternalReference(t);if((v.isImportNamespaceSpecifier(e)||v.isImportDefaultSpecifier(e))&&(this.defaultIds[i]=e.local),this.isModuleType(t,"absolute"));else if(this.isModuleType(t,"absoluteDefault"))this.ids[t.source.value]=a,a=v.memberExpression(a,v.identifier("default"));else if(v.isImportNamespaceSpecifier(e));else if(f["default"](this.file.dynamicImported,t)||!v.isSpecifierDefault(e)||this.noInteropRequireImport){var s=e.imported;v.isSpecifierDefault(e)&&(s=v.identifier("default")),a=v.memberExpression(a,s)}else{var o=n.generateUidIdentifier(e.local.name);r.push(v.variableDeclaration("var",[v.variableDeclarator(o,v.callExpression(this.file.addHelper("interop-require-default"),[a]))])),a=v.memberExpression(o,v.identifier("default"))}this.remaps.add(n,e.local.name,a)},t.prototype.exportSpecifier=function(e,t,r){return this.doDefaultExportInterop(e)&&(this.passModuleArg=!0,e.exported!==e.local&&!t.source)?void r.push(y.template("exports-default-assign",{VALUE:e.local},!0)):void l["default"].prototype.exportSpecifier.apply(this,arguments)},t.prototype.exportDeclaration=function(e,t){if(this.doDefaultExportInterop(e)){this.passModuleArg=!0;var r=e.declaration,n=y.template("exports-default-assign",{VALUE:this._pushStatement(r,t)},!0);return v.isFunctionDeclaration(r)&&(n._blockHoist=3),void t.push(n)}u["default"].prototype.exportDeclaration.apply(this,arguments)},t}(u["default"]);r["default"]=b,t.exports=r["default"]},{179:179,182:182,413:413,517:517,67:67,72:72}],71:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(72),a=n(i),s=e(68),o=n(s);r["default"]=o["default"](a["default"]),t.exports=r["default"]},{68:68,72:72}],72:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(182),l=n(p),c=e(179),f=n(c),d=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.setup=function(){this._setup(this.hasLocalExports)},t.prototype._setup=function(e){var t=this.file,r=t.scope;if(r.rename("module"),r.rename("exports"),!this.noInteropRequireImport&&e){var n="exports-module-declaration";this.file.isLoose("es6.modules")&&(n+="-loose");var i=l.template(n,!0);i._blockHoist=3,t.path.unshiftContainer("body",[i])}},t.prototype.transform=function(e){u["default"].prototype.transform.apply(this,arguments),this.hasDefaultOnlyExport&&e.body.push(f.expressionStatement(f.assignmentExpression("=",f.memberExpression(f.identifier("module"),f.identifier("exports")),f.memberExpression(f.identifier("exports"),f.identifier("default")))))},t.prototype.importSpecifier=function(e,t,r,n){var i=e.local,a=this.getExternalReference(t,r);if(f.isSpecifierDefault(e))if(this.isModuleType(t,"absolute"));else if(this.isModuleType(t,"absoluteDefault"))this.remaps.add(n,i.name,a);else if(this.noInteropRequireImport)this.remaps.add(n,i.name,f.memberExpression(a,f.identifier("default")));else{var s=this.scope.generateUidIdentifierBasedOnNode(t,"import");r.push(f.variableDeclaration("var",[f.variableDeclarator(s,f.callExpression(this.file.addHelper("interop-require-default"),[a]))])),this.remaps.add(n,i.name,f.memberExpression(s,f.identifier("default")))}else f.isImportNamespaceSpecifier(e)?(this.noInteropRequireImport||(a=f.callExpression(this.file.addHelper("interop-require-wildcard"),[a])),r.push(f.variableDeclaration("var",[f.variableDeclarator(i,a)]))):this.remaps.add(n,i.name,f.memberExpression(a,f.identifier(e.imported.name)))},t.prototype.importDeclaration=function(e,t){t.push(l.template("require",{MODULE_NAME:e.source},!0))},t.prototype.exportSpecifier=function(e){this.doDefaultExportInterop(e)&&(this.hasDefaultOnlyExport=!0),u["default"].prototype.exportSpecifier.apply(this,arguments)},t.prototype.exportDeclaration=function(e){this.doDefaultExportInterop(e)&&(this.hasDefaultOnlyExport=!0),u["default"].prototype.exportDeclaration.apply(this,arguments)},t.prototype._getExternalReference=function(e,t){var r,n=f.callExpression(f.identifier("require"),[e.source]);this.isModuleType(e,"absolute")||(this.isModuleType(e,"absoluteDefault")?n=f.memberExpression(n,f.identifier("default")):r=this.scope.generateUidIdentifierBasedOnNode(e,"import")),r=r||e.specifiers[0].local;var i=f.variableDeclaration("var",[f.variableDeclarator(r,n)]);return t.push(i),r},t}(u["default"]);r["default"]=d,t.exports=r["default"]},{179:179,182:182,67:67}],73:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(179),l=n(p),c=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.exportDeclaration=function(e,t){var r=l.toStatement(e.declaration,!0);r&&t.push(l.inherits(r,e))},t.prototype.exportAllDeclaration=function(){},t.prototype.importDeclaration=function(){},t.prototype.importSpecifier=function(){},t.prototype.exportSpecifier=function(){},t.prototype.transform=function(){},t}(u["default"]);r["default"]=c,t.exports=r["default"]},{179:179,67:67}],74:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]={commonStrict:e(71),amdStrict:e(69),umdStrict:e(78),common:e(72),system:e(77),ignore:e(73),amd:e(70),umd:e(79)},t.exports=r["default"]},{69:69,70:70,71:71,72:72,73:73,77:77,78:78,79:79}],75:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n){n.hasLocalExports=!0;var i=e.source?e.source.value:null,a=n.metadata.exports,s=this.get("declaration");if(s.isStatement()){var o=s.getBindingIdentifiers();for(var u in o){var p=o[u];n._addExport(u,p),a.exported.push(u),a.specifiers.push({kind:"local",local:u,exported:this.isExportDefaultDeclaration()?"default":u})}}if(this.isExportNamedDeclaration()&&e.specifiers)for(var c=e.specifiers,f=0;f<c.length;f++){var d=c[f],h=d.exported.name;a.exported.push(h),l.isExportDefaultSpecifier(d)&&a.specifiers.push({kind:"external",local:h,exported:h,source:i}),l.isExportNamespaceSpecifier(d)&&a.specifiers.push({kind:"external-namespace",exported:h,source:i});var m=d.local;m&&(n._addExport(m.name,d.exported),i&&a.specifiers.push({kind:"external",local:m.name,exported:h,source:i}),i||a.specifiers.push({kind:"local",local:m.name,exported:h}))}if(this.isExportAllDeclaration()&&a.specifiers.push({kind:"external-all",source:i}),!l.isExportDefaultDeclaration(e)&&!s.isTypeAlias()){var y=e.specifiers&&1===e.specifiers.length&&l.isSpecifierDefault(e.specifiers[0]);y||(n.hasNonDefaultExports=!0)}}function s(e,t,r,n){n.isLoose()||this.skip()}r.__esModule=!0,r.ExportDeclaration=a,r.Scope=s;var o=e(511),u=i(o),p=e(179),l=n(p),c={enter:function(e,t,r,n){e.source&&(e.source.value=n.file.resolveModuleSource(e.source.value),n.addScope(this))}};r.ModuleDeclaration=c;var f={exit:function(e,t,r,n){n.hasLocalImports=!0;var i=[],a=[];n.metadata.imports.push({source:e.source.value,imported:a,specifiers:i});for(var s=this.get("specifiers"),o=0;o<s.length;o++){var p=s[o],l=p.getBindingIdentifiers();u["default"](n.localImports,l);var c=p.node.local.name;if(p.isImportDefaultSpecifier()&&(a.push("default"),i.push({kind:"named",imported:"default",local:c})),p.isImportSpecifier()){var f=p.node.imported.name;a.push(f),i.push({kind:"named",imported:f,local:c})}p.isImportNamespaceSpecifier()&&(a.push("*"),i.push({kind:"namespace",local:c}))}}};r.ImportDeclaration=f},{179:179,511:511}],76:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(179),s=n(a),o={enter:function(e){return e._skipModulesRemap?this.skip():void 0},ReferencedIdentifier:function(e,t,r,n){var i=n.formatter,a=n.get(r,e.name);return a&&e!==a&&(!r.hasBinding(e.name)||r.bindingIdentifierEquals(e.name,i.localImports[e.name]))?!i.isLoose()&&"callee"===this.key&&this.parentPath.isCallExpression()?s.sequenceExpression([s.literal(0),a]):a:void 0},AssignmentExpression:{exit:function(e,t,r,n){var i=n.formatter;if(!e._ignoreModulesRemap){var a=i.getExport(e.left,r);if(a)return i.remapExportAssignment(e,a)}}},UpdateExpression:function(e,t,r,n){var i=n.formatter,a=i.getExport(e.argument,r);if(a){this.skip();var o=s.assignmentExpression(e.operator[0]+"=",e.argument,s.literal(1)),u=i.remapExportAssignment(o,a);if(s.isExpressionStatement(t)||e.prefix)return u;var p=[];p.push(u);var l;return l="--"===e.operator?"+":"-",p.push(s.binaryExpression(l,e.argument,s.literal(1))),s.sequenceExpression(p)}}},u=function(){function e(t,r){i(this,e),this.formatter=r,this.file=t}return e.prototype.run=function(){this.file.path.traverse(o,this)},e.prototype._getKey=function(e){return e+":moduleRemap"},e.prototype.get=function(e,t){return e.getData(this._getKey(t))},e.prototype.add=function(e,t,r){return this.all&&this.all.push({name:t,scope:e,node:r}),e.setData(this._getKey(t),r)},e.prototype.remove=function(e,t){return e.removeData(this._getKey(t))},e.prototype.getAll=function(){return this.all},e.prototype.clearAll=function(){if(this.all)for(var e=this.all,t=0;t<e.length;t++){var r=e[t];r.scope.removeData(this._getKey(r.name))}this.all=[]},e}();r["default"]=u,t.exports=r["default"]},{179:179}],77:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(70),l=i(p),c=e(182),f=n(c),d=e(407),h=i(d),m=e(414),y=i(m),g=e(179),v=n(g),b={Function:function(){this.skip()},VariableDeclaration:function(e,t,r,n){if(("var"===e.kind||v.isProgram(t))&&!n.formatter._canHoist(e)){for(var i=[],a=0;a<e.declarations.length;a++){var s=e.declarations[a];if(n.hoistDeclarators.push(v.variableDeclarator(s.id)),s.init){var o=v.expressionStatement(v.assignmentExpression("=",s.id,s.init));i.push(o)}}return v.isFor(t)&&t.left===e?e.declarations[0].id:i}}},E={Function:function(){this.skip()},enter:function(e,t,r,n){(v.isFunctionDeclaration(e)||n.formatter._canHoist(e))&&(n.handlerBody.push(e),this.dangerouslyRemove())}},x={enter:function(e,t,r,n){if(e._importSource===n.source){if(v.isVariableDeclaration(e))for(var i=e.declarations,a=0;a<i.length;a++){var s=i[a];n.hoistDeclarators.push(v.variableDeclarator(s.id)),n.nodes.push(v.expressionStatement(v.assignmentExpression("=",s.id,s.init)))}else n.nodes.push(e);this.dangerouslyRemove()}}},S=function(e){function t(r){a(this,t),e.call(this,r),this._setters=null,this.exportIdentifier=r.scope.generateUidIdentifier("export"),this.noInteropRequireExport=!0,this.noInteropRequireImport=!0,this.remaps.clearAll()}return s(t,e),t.prototype._addImportSource=function(e,t){return e&&(e._importSource=t.source&&t.source.value),e},t.prototype.buildExportsWildcard=function(e,t){var r=this.scope.generateUidIdentifier("key"),n=v.memberExpression(e,r,!0),i=v.variableDeclaration("var",[v.variableDeclarator(r)]),a=e,s=v.blockStatement([v.ifStatement(v.binaryExpression("!==",r,v.literal("default")),v.expressionStatement(this._buildExportCall(r,n)))]);return this._addImportSource(v.forInStatement(i,a,s),t)},t.prototype.buildExportsAssignment=function(e,t,r){var n=this._buildExportCall(v.literal(e.name),t,!0);return this._addImportSource(n,r)},t.prototype.buildExportsFromAssignment=function(){return this.buildExportsAssignment.apply(this,arguments)},t.prototype.remapExportAssignment=function(e,t){for(var r=e,n=0;n<t.length;n++)r=this._buildExportCall(v.literal(t[n].name),r);return r},t.prototype._buildExportCall=function(e,t,r){var n=v.callExpression(this.exportIdentifier,[e,t]);return r?v.expressionStatement(n):n},t.prototype.importSpecifier=function(e,t,r){l["default"].prototype.importSpecifier.apply(this,arguments);for(var n=this.remaps.getAll(),i=0;i<n.length;i++){var a=n[i];r.push(v.variableDeclaration("var",[v.variableDeclarator(v.identifier(a.name),a.node)]))}this.remaps.clearAll(),this._addImportSource(h["default"](r),t)},t.prototype._buildRunnerSetters=function(e,t){var r=this.file.scope;return v.arrayExpression(y["default"](this.ids,function(n,i){var a={hoistDeclarators:t,source:i,nodes:[]};return r.traverse(e,x,a),v.functionExpression(null,[n],v.blockStatement(a.nodes))}))},t.prototype._canHoist=function(e){return e._blockHoist&&!this.file.dynamicImports.length},t.prototype.transform=function(e){u["default"].prototype.transform.apply(this,arguments);var t=[],r=this.getModuleName(),n=v.literal(r),i=v.blockStatement(e.body),a=this._buildRunnerSetters(i,t);this._setters=a;var s=f.template("system",{MODULE_DEPENDENCIES:v.arrayExpression(this.buildDependencyLiterals()),EXPORT_IDENTIFIER:this.exportIdentifier,MODULE_NAME:n,SETTERS:a,EXECUTE:v.functionExpression(null,[],i)},!0),o=s.expression.arguments[2].body.body;r||s.expression.arguments.shift();var p=o.pop();if(this.file.scope.traverse(i,b,{formatter:this,hoistDeclarators:t}),t.length){var l=v.variableDeclaration("var",t);l._blockHoist=!0,o.unshift(l)}this.file.scope.traverse(i,E,{formatter:this,handlerBody:o}),o.push(p),e.body=[s]},t}(l["default"]);r["default"]=S,t.exports=r["default"]},{179:179,182:182,407:407,414:414,67:67,70:70}],78:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(79),a=n(i),s=e(68),o=n(s);r["default"]=o["default"](a["default"]),t.exports=r["default"]},{68:68,79:79}],79:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(67),u=i(o),p=e(70),l=i(p),c=e(517),f=i(c),d=e(9),h=i(d),m=e(182),y=n(m),g=e(179),v=n(g),b=function(e){function t(){a(this,t),e.apply(this,arguments)}return s(t,e),t.prototype.transform=function(e){u["default"].prototype.transform.apply(this,arguments);var t=e.body,r=[];for(var n in this.ids)r.push(v.literal(n));var i=f["default"](this.ids),a=[v.identifier("exports")];this.passModuleArg&&a.push(v.identifier("module")),a=a.concat(i);var s=v.functionExpression(null,a,v.blockStatement(t)),o=[v.literal("exports")];this.passModuleArg&&o.push(v.literal("module")),o=o.concat(r),o=[v.arrayExpression(o)];var p=y.template("test-exports"),l=y.template("test-module"),c=this.passModuleArg?v.logicalExpression("&&",p,l):p,d=[v.identifier("exports")];this.passModuleArg&&d.push(v.identifier("module")),d=d.concat(r.map(function(e){return v.callExpression(v.identifier("require"),[e])}));var m=[];this.passModuleArg&&m.push(v.identifier("mod"));for(var g in this.ids){var b=this.defaultIds[g]||v.identifier(v.toIdentifier(h["default"].basename(g,h["default"].extname(g))));m.push(v.memberExpression(v.identifier("global"),b))}var E=this.getModuleName();E&&o.unshift(v.literal(E));var x=this.file.opts.basename;E&&(x=E),x=v.identifier(v.toIdentifier(x));var S=y.template("umd-runner-body",{AMD_ARGUMENTS:o,COMMON_TEST:c,COMMON_ARGUMENTS:d,BROWSER_ARGUMENTS:m,GLOBAL_ARG:x});e.body=[v.expressionStatement(v.callExpression(S,[v.thisExpression(),s]))]},t}(l["default"]);r["default"]=b,t.exports=r["default"]},{179:179,182:182,517:517,67:67,70:70,9:9}],80:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(52),s=n(a),o=e(40),u=n(o),p=e(82),l=n(p),c=e(509),f=n(c),d=e(41),h=n(d),m=e(46),y=n(m),g=function(){function e(){i(this,e),this.transformers=h["default"](),this.namespaces=h["default"](),this.deprecated=h["default"](),this.aliases=h["default"](),this.filters=[]}return e.prototype.addTransformers=function(e){for(var t in e)this.addTransformer(t,e[t]);return this},e.prototype.addTransformer=function(e,t){if(this.transformers[e])throw new Error;var r=e.split(".")[0];this.namespaces[r]=this.namespaces[r]||[],this.namespaces[r].push(e),this.namespaces[e]=r,"function"==typeof t?(t=s["default"].memoisePluginContainer(t),t.key=e,t.metadata.optional=!0,"react.displayName"===e&&(t.metadata.optional=!1)):t=new l["default"](e,t),this.transformers[e]=t},e.prototype.addAliases=function(e){return f["default"](this.aliases,e),this},e.prototype.addDeprecated=function(e){return f["default"](this.deprecated,e),this},e.prototype.addFilter=function(e){return this.filters.push(e),this},e.prototype.canTransform=function(e,t){if(e.metadata.plugin)return!0;for(var r=this.filters,n=0;n<r.length;n++){var i=r[n],a=i(e,t);if(null!=a)return a}return!0},e.prototype.analyze=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return t.code=!1,this.transform(e,t)},e.prototype.pretransform=function(e,t){var r=new y["default"](t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r})},e.prototype.transform=function(e,t){var r=new y["default"](t,this);return r.wrap(e,function(){return r.addCode(e),r.parseCode(e),r.transform()})},e.prototype.transformFromAst=function(e,t,r){e=u["default"](e);var n=new y["default"](r,this);return n.wrap(t,function(){return n.addCode(t),n.addAst(e),n.transform()})},e.prototype._ensureTransformerNames=function(e,t){for(var r=[],n=0;n<t.length;n++){var i=t[n],a=this.deprecated[i],s=this.aliases[i];if(s)r.push(s);else if(a)console.error("[BABEL] The transformer "+i+" has been renamed to "+a),t.push(a);else if(this.transformers[i])r.push(i);else{if(!this.namespaces[i])throw new ReferenceError("Unknown transformer "+i+" specified in "+e);r=r.concat(this.namespaces[i])}}return r},e}();r["default"]=g,t.exports=r["default"]},{40:40,41:41,46:46,509:509,52:52,82:82}],81:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(148),s=n(a),o=function(){function e(t,r){i(this,e),this.plugin=r,this.file=t,this.key=r.key,this.canTransform()&&r.metadata.experimental&&!t.opts.experimental&&t.log.warn("THE TRANSFORMER "+this.key+" HAS BEEN MARKED AS EXPERIMENTAL AND IS WIP. USE AT YOUR OWN RISK. THIS WILL HIGHLY LIKELY BREAK YOUR CODE SO USE WITH **EXTREME** CAUTION. ENABLE THE `experimental` OPTION TO IGNORE THIS WARNING.")}return e.prototype.canTransform=function(){return this.file.transformerDependencies[this.key]||this.file.pipeline.canTransform(this.plugin,this.file.opts)},e.prototype.transform=function(){var e=this.file;e.log.debug("Start transformer "+this.key),s["default"](e.ast,this.plugin.visitor,e.scope,e),e.log.debug("Finish transformer "+this.key)},e}();r["default"]=o,t.exports=r["default"]},{148:148}],82:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(81),o=i(s),u=e(43),p=n(u),l=e(148),c=i(l),f=e(509),d=i(f),h=e(494),m=i(h),y=e(46),g=i(y),v=e(179),b=n(v),E=["visitor","metadata","manipulateOptions","post","pre"],x=["dependencies","optional","stage","group","experimental","secondPass"],S=function(){function e(t,r){a(this,e),e.validate(t,r),r=d["default"]({},r);var n=function(e){var t=r[e];return delete r[e],t};this.manipulateOptions=n("manipulateOptions"),this.metadata=n("metadata")||{},this.dependencies=this.metadata.dependencies||[],this.post=n("post"),this.pre=n("pre"),null!=this.metadata.stage&&(this.metadata.optional=!0),this.visitor=this.normalize(m["default"](n("visitor"))||{}),this.key=t}return e.validate=function(e,t){for(var r in t)if("_"!==r[0]&&!(E.indexOf(r)>=0)){var n="pluginInvalidProperty";throw b.TYPES.indexOf(r)>=0&&(n="pluginInvalidPropertyVisitor"),new Error(p.get(n,e,r))}for(var r in t.metadata)if(!(x.indexOf(r)>=0))throw new Error(p.get("pluginInvalidProperty",e,"metadata."+r))},e.prototype.normalize=function(e){return c["default"].explode(e),e},e.prototype.buildPass=function(e){if(!(e instanceof g["default"]))throw new TypeError(p.get("pluginNotFile",this.key));return new o["default"](e,this)},e}();r["default"]=S,t.exports=r["default"]},{148:148,179:179,43:43,46:46,494:494,509:509,81:81}],83:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(82),s=n(a),o=function u(e,t){i(this,u);var r={};return r.metadata=t.metadata,delete t.metadata,r.visitor=t,new s["default"](e,r)};r["default"]=o,t.exports=r["default"]},{82:82}],84:[function(e,t,r){t.exports={useStrict:"strict","es5.runtime":"runtime","es6.runtime":"runtime","minification.inlineExpressions":"minification.constantFolding"}},{}],85:[function(e,t,r){t.exports={selfContained:"runtime","unicode-regex":"regex.unicode","spec.typeofSymbol":"es6.spec.symbols","es6.symbols":"es6.spec.symbols","es6.blockScopingTDZ":"es6.spec.blockScoping","utility.inlineExpressions":"minification.constantFolding","utility.deadCodeElimination":"minification.deadCodeElimination","utility.removeConsoleCalls":"minification.removeConsole","utility.removeDebugger":"minification.removeDebugger","es6.parameters.rest":"es6.parameters","es6.parameters.default":"es6.parameters"}},{}],86:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o={MemberExpression:{exit:function(e){var t=e.property;e.computed||!a.isIdentifier(t)||a.isValidIdentifier(t.name)||(e.property=a.literal(t.name),e.computed=!0)}}};r.visitor=o},{179:179}],87:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o={Property:{exit:function(e){var t=e.key;e.computed||!a.isIdentifier(t)||a.isValidIdentifier(t.name)||(e.key=a.literal(t.name))}}};r.visitor=o},{179:179}],88:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;
var i=e(57),a=n(i),s=e(179),o=n(s),u={ObjectExpression:function(e,t,r,n){for(var i=!1,s=e.properties,u=0;u<s.length;u++){var p=s[u];if("get"===p.kind||"set"===p.kind){i=!0;break}}if(i){var l={};return e.properties=e.properties.filter(function(e){return"get"===e.kind||"set"===e.kind?(a.push(l,e,e.kind,n),!1):!0}),o.callExpression(o.memberExpression(o.identifier("Object"),o.identifier("defineProperties")),[e,a.toDefineObject(l)])}}};r.visitor=u},{179:179,57:57}],89:[function(e,t,r){"use strict";r.__esModule=!0;var n={ArrowFunctionExpression:function(e){this.ensureBlock(),e.expression=!1,e.type="FunctionExpression",e.shadow=e.shadow||!0}};r.visitor=n},{}],90:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!b.isVariableDeclaration(e))return!1;if(e._let)return!0;if("let"!==e.kind)return!1;if(o(e,t))for(var r=0;r<e.declarations.length;r++){var n=e.declarations[r];n.init=n.init||b.identifier("undefined")}return e._let=!0,e.kind="var",!0}function o(e,t){return!b.isFor(t)||!b.isFor(t,{left:e})}function u(e,t){return b.isVariableDeclaration(e,{kind:"var"})&&!s(e,t)}function p(e){for(var t=e,r=0;r<t.length;r++){var n=t[r];delete n._let}}function l(e,t,r,n){var i=n[e.name];if(i){var a=r.getBindingIdentifier(e.name);a===i.binding?e.name=i.uid:this&&this.skip()}}function c(e,t,r,n){if(b.isIdentifier(e)&&l(e,t,r,n),b.isAssignmentExpression(e)){var i=b.getBindingIdentifiers(e);for(var a in i)l(i[a],t,r,n)}r.traverse(e,w,n)}r.__esModule=!0;var f=e(148),d=i(f),h=e(41),m=i(h),y=e(182),g=n(y),v=e(179),b=n(v),E=e(517),x=i(E),S=e(511),A=i(S),D={group:"builtin-advanced"};r.metadata=D;var C={VariableDeclaration:function(e,t,r,n){if(s(e,t)&&o(e)&&n.transformers["es6.spec.blockScoping"].canTransform()){for(var i=[e],a=0;a<e.declarations.length;a++){var u=e.declarations[a];if(u.init){var p=b.assignmentExpression("=",u.id,u.init);p._ignoreBlockScopingTDZ=!0,i.push(b.expressionStatement(p))}u.init=n.addHelper("temporal-undefined")}return e._blockHoist=2,i}},Loop:function(e,t,r,n){var i=e.left||e.init;s(i,e)&&(b.ensureBlock(e),e.body._letDeclarators=[i]);var a=new M(this,this.get("body"),t,r,n);return a.run()},"BlockStatement|Program":function(e,t,r,n){if(!b.isLoop(t)){var i=new M(null,this,t,r,n);i.run()}}};r.visitor=C;var w={ReferencedIdentifier:l,AssignmentExpression:function(e,t,r,n){var i=this.getBindingIdentifiers();for(var a in i)l(i[a],e,r,n)}},I={Function:function(e,t,r,n){return this.traverse(_,n),this.skip()}},_={ReferencedIdentifier:function(e,t,r,n){var i=n.letReferences[e.name];if(i){var a=r.getBindingIdentifier(e.name);a&&a!==i||(n.closurify=!0)}}},F={enter:function(e,t,r,n){if(this.isForStatement()){if(u(e.init,e)){var i=n.pushDeclar(e.init);1===i.length?e.init=i[0]:e.init=b.sequenceExpression(i)}}else if(this.isFor())u(e.left,e)&&(n.pushDeclar(e.left),e.left=e.left.declarations[0].id);else{if(u(e,t))return n.pushDeclar(e).map(b.expressionStatement);if(this.isFunction())return this.skip()}}},k={LabeledStatement:function(e,t,r,n){n.innerLabels.push(e.label.name)}},P={enter:function(e,t,r,n){if(this.isAssignmentExpression()||this.isUpdateExpression()){var i=this.getBindingIdentifiers();for(var a in i)n.outsideReferences[a]===r.getBindingIdentifier(a)&&(n.reassignments[a]=!0)}}},B=function(e){return b.isBreakStatement(e)?"break":b.isContinueStatement(e)?"continue":void 0},T={Loop:function(e,t,r,n){var i=n.ignoreLabeless;n.ignoreLabeless=!0,this.traverse(T,n),n.ignoreLabeless=i,this.skip()},Function:function(){this.skip()},SwitchCase:function(e,t,r,n){var i=n.inSwitchCase;n.inSwitchCase=!0,this.traverse(T,n),n.inSwitchCase=i,this.skip()},enter:function(e,t,r,n){var i,a=B(e);if(a){if(e.label){if(n.innerLabels.indexOf(e.label.name)>=0)return;a=a+"|"+e.label.name}else{if(n.ignoreLabeless)return;if(n.inSwitchCase)return;if(b.isBreakStatement(e)&&b.isSwitchCase(t))return}n.hasBreakContinue=!0,n.map[a]=e,i=b.literal(a)}return this.isReturnStatement()&&(n.hasReturn=!0,i=b.objectExpression([b.property("init",b.identifier("v"),e.argument||b.identifier("undefined"))])),i?(i=b.returnStatement(i),this.skip(),b.inherits(i,e)):void 0}},M=function(){function e(t,r,n,i,s){a(this,e),this.parent=n,this.scope=i,this.file=s,this.blockPath=r,this.block=r.node,this.outsideLetReferences=m["default"](),this.hasLetReferences=!1,this.letReferences=this.block._letReferences=m["default"](),this.body=[],t&&(this.loopParent=t.parent,this.loopLabel=b.isLabeledStatement(this.loopParent)&&this.loopParent.label,this.loopPath=t,this.loop=t.node)}return e.prototype.run=function(){var e=this.block;if(!e._letDone){e._letDone=!0;var t=this.getLetReferences();if(!b.isFunction(this.parent)&&!b.isProgram(this.block)&&this.hasLetReferences)return t?this.wrapClosure():this.remap(),this.loopLabel&&!b.isLabeledStatement(this.loopParent)?b.labeledStatement(this.loopLabel,this.loop):void 0}},e.prototype.remap=function(){var e=!1,t=this.letReferences,r=this.scope,n=m["default"]();for(var i in t){var a=t[i];if(r.parentHasBinding(i)||r.hasGlobal(i)){var s=r.generateUidIdentifier(a.name).name;a.name=s,e=!0,n[i]=n[s]={binding:a,uid:s}}}if(e){var o=this.loop;o&&(c(o.right,o,r,n),c(o.test,o,r,n),c(o.update,o,r,n)),this.blockPath.traverse(w,n)}},e.prototype.wrapClosure=function(){var e=this.block,t=this.outsideLetReferences;if(this.loop)for(var r in t){var n=t[r];(this.scope.hasGlobal(n.name)||this.scope.parentHasBinding(n.name))&&(delete t[n.name],delete this.letReferences[n.name],this.scope.rename(n.name),this.letReferences[n.name]=n,t[n.name]=n)}this.has=this.checkLoop(),this.hoistVarDeclarations();var i=x["default"](t),a=x["default"](t),s=b.functionExpression(null,i,b.blockStatement(e.body));s.shadow=!0,this.addContinuations(s),e.body=this.body;var o=s;this.loop&&(o=this.scope.generateUidIdentifier("loop"),this.loopPath.insertBefore(b.variableDeclaration("var",[b.variableDeclarator(o,s)])));var u=b.callExpression(o,a),p=this.scope.generateUidIdentifier("ret"),l=d["default"].hasType(s.body,this.scope,"YieldExpression",b.FUNCTION_TYPES);l&&(s.generator=!0,u=b.yieldExpression(u,!0));var c=d["default"].hasType(s.body,this.scope,"AwaitExpression",b.FUNCTION_TYPES);c&&(s.async=!0,u=b.awaitExpression(u)),this.buildClosure(p,u)},e.prototype.buildClosure=function(e,t){var r=this.has;r.hasReturn||r.hasBreakContinue?this.buildHas(e,t):this.body.push(b.expressionStatement(t))},e.prototype.addContinuations=function(e){var t={reassignments:{},outsideReferences:this.outsideLetReferences};this.scope.traverse(e,P,t);for(var r=0;r<e.params.length;r++){var n=e.params[r];if(t.reassignments[n.name]){var i=this.scope.generateUidIdentifier(n.name);e.params[r]=i,this.scope.rename(n.name,i.name,e),e.body.body.push(b.expressionStatement(b.assignmentExpression("=",n,i)))}}},e.prototype.getLetReferences=function(){for(var e=this.block,t=e._letDeclarators||[],r=0;r<t.length;r++){var n=t[r];A["default"](this.outsideLetReferences,b.getBindingIdentifiers(n))}if(e.body)for(var r=0;r<e.body.length;r++){var n=e.body[r];s(n,e)&&(t=t.concat(n.declarations))}for(var r=0;r<t.length;r++){var n=t[r],i=b.getBindingIdentifiers(n);A["default"](this.letReferences,i),this.hasLetReferences=!0}if(this.hasLetReferences){p(t);var a={letReferences:this.letReferences,closurify:!1};return this.blockPath.traverse(I,a),a.closurify}},e.prototype.checkLoop=function(){var e={hasBreakContinue:!1,ignoreLabeless:!1,inSwitchCase:!1,innerLabels:[],hasReturn:!1,isLoop:!!this.loop,map:{}};return this.blockPath.traverse(k,e),this.blockPath.traverse(T,e),e},e.prototype.hoistVarDeclarations=function(){this.blockPath.traverse(F,this)},e.prototype.pushDeclar=function(e){var t=[],r=b.getBindingIdentifiers(e);for(var n in r)t.push(b.variableDeclarator(r[n]));this.body.push(b.variableDeclaration(e.kind,t));for(var i=[],a=0;a<e.declarations.length;a++){var s=e.declarations[a];if(s.init){var o=b.assignmentExpression("=",s.id,s.init);i.push(b.inherits(o,s))}}return i},e.prototype.buildHas=function(e,t){var r=this.body;r.push(b.variableDeclaration("var",[b.variableDeclarator(e,t)]));var n,i=this.has,a=[];if(i.hasReturn&&(n=g.template("let-scoping-return",{RETURN:e})),i.hasBreakContinue){for(var s in i.map)a.push(b.switchCase(b.literal(s),[i.map[s]]));if(i.hasReturn&&a.push(b.switchCase(null,[n])),1===a.length){var o=a[0];r.push(this.file.attachAuxiliaryComment(b.ifStatement(b.binaryExpression("===",e,o.test),o.consequent[0])))}else{for(var u=0;u<a.length;u++){var p=a[u].consequent[0];b.isBreakStatement(p)&&!p.label&&(p.label=this.loopLabel=this.loopLabel||this.file.scope.generateUidIdentifier("loop"))}r.push(this.file.attachAuxiliaryComment(b.switchStatement(e,a)))}}else i.hasReturn&&r.push(this.file.attachAuxiliaryComment(n))},e}()},{148:148,179:179,182:182,41:41,511:511,517:517}],91:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(92),s=i(a),o=e(93),u=i(o),p=e(179),l=n(p),c=e(61),f={ClassDeclaration:function(e){return l.variableDeclaration("let",[l.variableDeclarator(e.id,l.toExpression(e))])},ClassExpression:function(e,t,r,n){var i=c.bare(e,t,r);return i?i:n.isLoose("es6.classes")?new s["default"](this,n).run():new u["default"](this,n).run()}};r.visitor=f},{179:179,61:61,92:92,93:93}],92:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var o=e(93),u=i(o),p=e(179),l=n(p),c=function(e){function t(){a(this,t),e.apply(this,arguments),this.isLoose=!0}return s(t,e),t.prototype._processMethod=function(e){if(!e.decorators){var t=this.classRef;e["static"]||(t=l.memberExpression(t,l.identifier("prototype")));var r=l.memberExpression(t,e.key,e.computed||l.isLiteral(e.key)),n=l.expressionStatement(l.assignmentExpression("=",r,e.value));return l.inheritsComments(n,e),this.body.push(n),!0}},t}(u["default"]);r["default"]=c,t.exports=r["default"]},{179:179,93:93}],93:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(60),o=i(s),u=e(65),p=i(u),l=e(61),c=n(l),f=e(57),d=n(f),h=e(43),m=n(h),y=e(182),g=n(y),v=e(179),b=n(v),E="__initializeProperties",x={Identifier:{enter:function(e,t,r,n){this.parentPath.isClassProperty({key:e})||this.isReferenced()&&r.getBinding(e.name)===n.scope.getBinding(e.name)&&(n.references[e.name]=!0)}}},S={MethodDefinition:function(){this.skip()},Property:function(e){e.method&&this.skip()},CallExpression:{exit:function(e,t,r,n){if(this.get("callee").isSuper()&&(n.hasBareSuper=!0,n.bareSuper=this,!n.isDerived))throw this.errorWithNode("super call is only allowed in derived constructor")}},"FunctionDeclaration|FunctionExpression":function(){this.skip()},ThisExpression:function(e,t,r,n){if(n.isDerived&&!n.hasBareSuper){if(this.inShadow()){var i=n.constructorPath.getData("this");return i||(i=n.constructorPath.setData("this",n.constructorPath.scope.generateUidIdentifier("this"))),i}throw this.errorWithNode("'this' is not allowed before super()")}},Super:function(e,t,r,n){if(n.isDerived&&!n.hasBareSuper&&!this.parentPath.isCallExpression({callee:e}))throw this.errorWithNode("'super.*' is not allowed before super()")}},A=function(){function e(t,r){a(this,e),this.parent=t.parent,this.scope=t.scope,this.node=t.node,this.path=t,this.file=r,this.clearDescriptors(),this.instancePropBody=[],this.instancePropRefs={},this.staticPropBody=[],this.body=[],this.pushedConstructor=!1,this.pushedInherits=!1,this.hasDecorators=!1,this.isLoose=!1,this.classId=this.node.id,this.classRef=this.node.id||this.scope.generateUidIdentifier("class"),this.directRef=null,this.superName=this.node.superClass||b.identifier("Function"),this.isDerived=!!this.node.superClass}return e.prototype.run=function(){var e=this.superName,t=this.file,r=this.body,n=this.constructorBody=b.blockStatement([]);this.constructor=this.buildConstructor();var i=[],a=[];this.isDerived&&(a.push(e),e=this.scope.generateUidIdentifierBasedOnNode(e),i.push(e),this.superName=e);var s=this.node.decorators;if(s?this.directRef=this.scope.generateUidIdentifier(this.classRef):this.directRef=this.classRef,this.buildBody(),n.body.unshift(b.expressionStatement(b.callExpression(t.addHelper("class-call-check"),[b.thisExpression(),this.directRef]))),this.pushDecorators(),r=r.concat(this.staticPropBody),this.classId&&1===r.length)return b.toExpression(r[0]);r.push(b.returnStatement(this.classRef));var o=b.functionExpression(null,i,b.blockStatement(r));return o.shadow=!0,b.callExpression(o,a)},e.prototype.buildConstructor=function(){var e=b.functionDeclaration(this.classRef,[],this.constructorBody);return b.inherits(e,this.node),e},e.prototype.pushToMap=function(e,t){var r,n=arguments.length<=2||void 0===arguments[2]?"value":arguments[2];e["static"]?(this.hasStaticDescriptors=!0,r=this.staticMutatorMap):(this.hasInstanceDescriptors=!0,r=this.instanceMutatorMap);var i=d.push(r,e,n,this.file);t&&(i.enumerable=b.literal(!0)),i.decorators&&(this.hasDecorators=!0)},e.prototype.constructorMeMaybe=function(){for(var e=!1,t=this.path.get("body.body"),r=t,n=0;n<r.length;n++){var i=r[n];if(e=i.equals("kind","constructor"))break}if(!e){var a;a=this.isDerived?g.template("class-derived-default-constructor"):b.functionExpression(null,[],b.blockStatement([])),this.path.get("body").unshiftContainer("body",b.methodDefinition(b.identifier("constructor"),a,"constructor"))}},e.prototype.buildBody=function(){if(this.constructorMeMaybe(),this.pushBody(),this.placePropertyInitializers(),this.userConstructor){var e=this.constructorBody;e.body=e.body.concat(this.userConstructor.body.body),b.inherits(this.constructor,this.userConstructor),b.inherits(e,this.userConstructor.body)}this.pushDescriptors()},e.prototype.pushBody=function(){for(var e=this.path.get("body.body"),t=e,r=0;r<t.length;r++){var n=t[r],i=n.node;if(i.decorators&&o["default"](i.decorators,this.scope),b.isMethodDefinition(i)){var a="constructor"===i.kind;a&&this.verifyConstructor(n);var s=new p["default"]({methodPath:n,methodNode:i,objectRef:this.directRef,superRef:this.superName,isStatic:i["static"],isLoose:this.isLoose,scope:this.scope,file:this.file},!0);s.replace(),a?this.pushConstructor(i,n):this.pushMethod(i,n)}else b.isClassProperty(i)&&this.pushProperty(i,n)}},e.prototype.clearDescriptors=function(){this.hasInstanceDescriptors=!1,this.hasStaticDescriptors=!1,this.instanceMutatorMap={},this.staticMutatorMap={}},e.prototype.pushDescriptors=function(){this.pushInherits();var e,t,r=this.body,n="create-class";if(this.hasDecorators&&(n="create-decorated-class"),this.hasInstanceDescriptors&&(e=d.toClassObject(this.instanceMutatorMap)),this.hasStaticDescriptors&&(t=d.toClassObject(this.staticMutatorMap)),e||t){e&&(e=d.toComputedObjectFromClass(e)),t&&(t=d.toComputedObjectFromClass(t));var i=b.literal(null),a=[this.classRef,i,i,i,i];e&&(a[1]=e),t&&(a[2]=t),this.instanceInitializersId&&(a[3]=this.instanceInitializersId,r.unshift(this.buildObjectAssignment(this.instanceInitializersId))),this.staticInitializersId&&(a[4]=this.staticInitializersId,r.unshift(this.buildObjectAssignment(this.staticInitializersId)));for(var s=0,o=0;o<a.length;o++)a[o]!==i&&(s=o);a=a.slice(0,s+1),r.push(b.expressionStatement(b.callExpression(this.file.addHelper(n),a)))}this.clearDescriptors()},e.prototype.buildObjectAssignment=function(e){return b.variableDeclaration("var",[b.variableDeclarator(e,b.objectExpression([]))])},e.prototype.placePropertyInitializers=function(){var e=this.instancePropBody;if(e.length)if(this.hasPropertyCollision()){var t=b.expressionStatement(b.callExpression(b.memberExpression(b.thisExpression(),b.identifier(E)),[]));this.pushMethod(b.methodDefinition(b.identifier(E),b.functionExpression(null,[],b.blockStatement(e))),null,!0),this.isDerived?this.bareSuper.insertAfter(t):this.constructorBody.body.unshift(t)}else this.isDerived?this.bareSuper.insertAfter(e):this.constructorBody.body=e.concat(this.constructorBody.body)},e.prototype.hasPropertyCollision=function(){if(this.userConstructorPath)for(var e in this.instancePropRefs)if(this.userConstructorPath.scope.hasOwnBinding(e))return!0;return!1},e.prototype.verifyConstructor=function(e){var t={constructorPath:e.get("value"),hasBareSuper:!1,bareSuper:null,isDerived:this.isDerived,file:this.file};t.constructorPath.traverse(S,t);var r=t.constructorPath.getData("this");if(r&&t.bareSuper&&t.bareSuper.insertAfter(b.variableDeclaration("var",[b.variableDeclarator(r,b.thisExpression())])),this.bareSuper=t.bareSuper,!t.hasBareSuper&&this.isDerived)throw e.errorWithNode("Derived constructor must call super()")},e.prototype.pushMethod=function(e,t,r){if(!r&&b.isLiteral(b.toComputedKey(e),{value:E}))throw this.file.errorWithNode(e,m.get("illegalMethodName",E));"method"===e.kind&&(c.property(e,this.file,t?t.get("value").scope:this.scope),this._processMethod(e))||this.pushToMap(e)},e.prototype._processMethod=function(){return!1},e.prototype.pushProperty=function(e,t){if(t.traverse(x,{references:this.instancePropRefs,scope:this.scope}),e.decorators){var r=[];e.value?(r.push(b.returnStatement(e.value)),e.value=b.functionExpression(null,[],b.blockStatement(r))):e.value=b.literal(null),this.pushToMap(e,!0,"initializer");var n,i;e["static"]?(n=this.staticInitializersId=this.staticInitializersId||this.scope.generateUidIdentifier("staticInitializers"),r=this.staticPropBody,i=this.classRef):(n=this.instanceInitializersId=this.instanceInitializersId||this.scope.generateUidIdentifier("instanceInitializers"),r=this.instancePropBody,i=b.thisExpression()),r.push(b.expressionStatement(b.callExpression(this.file.addHelper("define-decorated-property-descriptor"),[i,b.literal(e.key.name),n])))}else{if(!e.value&&!e.decorators)return;e["static"]?this.pushToMap(e,!0):e.value&&this.instancePropBody.push(b.expressionStatement(b.assignmentExpression("=",b.memberExpression(b.thisExpression(),e.key),e.value)))}},e.prototype.pushConstructor=function(e,t){var r=t.get("value");r.scope.hasOwnBinding(this.classRef.name)&&r.scope.rename(this.classRef.name);var n=this.constructor,i=e.value;this.userConstructorPath=r,this.userConstructor=i,this.hasConstructor=!0,b.inheritsComments(n,e),n._ignoreUserWhitespace=!0,n.params=i.params,b.inherits(n.body,i.body),this._pushConstructor()},e.prototype._pushConstructor=function(){this.pushedConstructor||(this.pushedConstructor=!0,(this.hasInstanceDescriptors||this.hasStaticDescriptors)&&this.pushDescriptors(),this.body.push(this.constructor),this.pushInherits())},e.prototype.pushInherits=function(){this.isDerived&&!this.pushedInherits&&(this.pushedInherits=!0,this.body.unshift(b.expressionStatement(b.callExpression(this.file.addHelper("inherits"),[this.classRef,this.superName]))))},e.prototype.pushDecorators=function(){var e=this.node.decorators;if(e){this.body.push(b.variableDeclaration("var",[b.variableDeclarator(this.directRef,this.classRef)])),e=e.reverse();for(var t=e,r=0;r<t.length;r++){var n=t[r],i=g.template("class-decorator",{DECORATOR:n.expression,CLASS_REF:this.classRef},!0);i.expression._ignoreModulesRemap=!0,this.body.push(i)}}},e}();r["default"]=A,t.exports=r["default"]},{179:179,182:182,43:43,57:57,60:60,61:61,65:65}],94:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(43),a=n(i),s={Scope:function(e,t,r){for(var n in r.bindings){var i=r.bindings[n];if("const"===i.kind||"module"===i.kind)for(var s=i.constantViolations,o=0;o<s.length;o++){var u=s[o];throw u.errorWithNode(a.get("readOnly",n))}}},VariableDeclaration:function(e){"const"===e.kind&&(e.kind="let")}};r.visitor=s},{43:43}],95:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){for(var t=0;t<e.declarations.length;t++)if(l.isPattern(e.declarations[t].id))return!0;return!1}function s(e){for(var t=0;t<e.elements.length;t++)if(l.isRestElement(e.elements[t]))return!0;return!1}r.__esModule=!0;var o=e(43),u=n(o),p=e(179),l=n(p),c={group:"builtin-advanced"};r.metadata=c;var f={ForXStatement:function(e,t,r,n){var i=e.left;if(l.isPattern(i)){var a=r.generateUidIdentifier("ref");return e.left=l.variableDeclaration("var",[l.variableDeclarator(a)]),this.ensureBlock(),void e.body.body.unshift(l.variableDeclaration("var",[l.variableDeclarator(i,a)]))}if(l.isVariableDeclaration(i)){var s=i.declarations[0].id;if(l.isPattern(s)){var o=r.generateUidIdentifier("ref");e.left=l.variableDeclaration(i.kind,[l.variableDeclarator(o,null)]);var u=[],p=new h({kind:i.kind,file:n,scope:r,nodes:u});p.init(s,o),this.ensureBlock();var c=e.body;c.body=u.concat(c.body)}}},Function:function(e,t,r,n){for(var i=!1,a=e.params,s=0;s<a.length;s++){var o=a[s];if(l.isPattern(o)){i=!0;break}}if(i){for(var u=[],p=0;p<e.params.length;p++){var o=e.params[p];if(l.isPattern(o)){var c=r.generateUidIdentifier("ref");if(l.isAssignmentPattern(o)){var f=o;o=o.left,f.left=c}else e.params[p]=c;l.inherits(c,o);var d=new h({blockHoist:e.params.length-p,nodes:u,scope:r,file:n,kind:"let"});d.init(o,c)}}this.ensureBlock();var m=e.body;m.body=u.concat(m.body)}},CatchClause:function(e,t,r,n){var i=e.param;if(l.isPattern(i)){var a=r.generateUidIdentifier("ref");e.param=a;var s=[],o=new h({kind:"let",file:n,scope:r,nodes:s});o.init(i,a),e.body.body=s.concat(e.body.body)}},AssignmentExpression:function(e,t,r,n){if(l.isPattern(e.left)){var i,a=[],s=new h({operator:e.operator,file:n,scope:r,nodes:a});return(this.isCompletionRecord()||!this.parentPath.isExpressionStatement())&&(i=r.generateUidIdentifierBasedOnNode(e.right,"ref"),a.push(l.variableDeclaration("var",[l.variableDeclarator(i,e.right)])),l.isArrayExpression(e.right)&&(s.arrays[i.name]=!0)),s.init(e.left,i||e.right),i&&a.push(l.expressionStatement(i)),a}},VariableDeclaration:function(e,t,r,n){if(!l.isForXStatement(t)&&a(e)){for(var i,s=[],o=0;o<e.declarations.length;o++){i=e.declarations[o];var p=i.init,c=i.id,f=new h({nodes:s,scope:r,kind:e.kind,file:n});l.isPattern(c)?(f.init(c,p),+o!==e.declarations.length-1&&l.inherits(s[s.length-1],i)):s.push(l.inherits(f.buildVariableAssignment(i.id,i.init),i))}if(!l.isProgram(t)&&!l.isBlockStatement(t)){for(i=null,o=0;o<s.length;o++){if(e=s[o],i=i||l.variableDeclaration(e.kind,[]),!l.isVariableDeclaration(e)&&i.kind!==e.kind)throw n.errorWithNode(e,u.get("invalidParentForThisNode"));i.declarations=i.declarations.concat(e.declarations)}return i}return s}}};r.visitor=f;var d={ReferencedIdentifier:function(e,t,r,n){n.bindings[e.name]&&(n.deopt=!0,this.stop())}},h=function(){function e(t){i(this,e),this.blockHoist=t.blockHoist,this.operator=t.operator,this.arrays={},this.nodes=t.nodes||[],this.scope=t.scope,this.file=t.file,this.kind=t.kind}return e.prototype.buildVariableAssignment=function(e,t){var r=this.operator;l.isMemberExpression(e)&&(r="=");var n;return n=r?l.expressionStatement(l.assignmentExpression(r,e,t)):l.variableDeclaration(this.kind,[l.variableDeclarator(e,t)]),n._blockHoist=this.blockHoist,n},e.prototype.buildVariableDeclaration=function(e,t){var r=l.variableDeclaration("var",[l.variableDeclarator(e,t)]);return r._blockHoist=this.blockHoist,r},e.prototype.push=function(e,t){l.isObjectPattern(e)?this.pushObjectPattern(e,t):l.isArrayPattern(e)?this.pushArrayPattern(e,t):l.isAssignmentPattern(e)?this.pushAssignmentPattern(e,t):this.nodes.push(this.buildVariableAssignment(e,t))},e.prototype.toArray=function(e,t){return this.file.isLoose("es6.destructuring")||l.isIdentifier(e)&&this.arrays[e.name]?e:this.scope.toArray(e,t)},e.prototype.pushAssignmentPattern=function(e,t){var r=this.scope.generateUidIdentifierBasedOnNode(t),n=l.variableDeclaration("var",[l.variableDeclarator(r,t)]);n._blockHoist=this.blockHoist,this.nodes.push(n);var i=l.conditionalExpression(l.binaryExpression("===",r,l.identifier("undefined")),e.right,r),a=e.left;if(l.isPattern(a)){var s=l.expressionStatement(l.assignmentExpression("=",r,i));s._blockHoist=this.blockHoist,this.nodes.push(s),this.push(a,r)}else this.nodes.push(this.buildVariableAssignment(a,i))},e.prototype.pushObjectSpread=function(e,t,r,n){for(var i=[],a=0;a<e.properties.length;a++){var s=e.properties[a];if(a>=n)break;if(!l.isSpreadProperty(s)){var o=s.key;l.isIdentifier(o)&&!s.computed&&(o=l.literal(s.key.name)),i.push(o)}}i=l.arrayExpression(i);var u=l.callExpression(this.file.addHelper("object-without-properties"),[t,i]);this.nodes.push(this.buildVariableAssignment(r.argument,u))},e.prototype.pushObjectProperty=function(e,t){l.isLiteral(e.key)&&(e.computed=!0);var r=e.value,n=l.memberExpression(t,e.key,e.computed);l.isPattern(r)?this.push(r,n):this.nodes.push(this.buildVariableAssignment(r,n))},e.prototype.pushObjectPattern=function(e,t){if(e.properties.length||this.nodes.push(l.expressionStatement(l.callExpression(this.file.addHelper("object-destructuring-empty"),[t]))),e.properties.length>1&&!this.scope.isStatic(t)){var r=this.scope.generateUidIdentifierBasedOnNode(t);this.nodes.push(this.buildVariableDeclaration(r,t)),t=r}for(var n=0;n<e.properties.length;n++){var i=e.properties[n];l.isSpreadProperty(i)?this.pushObjectSpread(e,t,i,n):this.pushObjectProperty(i,t)}},e.prototype.canUnpackArrayPattern=function(e,t){if(!l.isArrayExpression(t))return!1;if(!(e.elements.length>t.elements.length)){if(e.elements.length<t.elements.length&&!s(e))return!1;for(var r=e.elements,n=0;n<r.length;n++){var i=r[n];if(!i)return!1;if(l.isMemberExpression(i))return!1}for(var a=t.elements,o=0;o<a.length;o++){var i=a[o];if(l.isSpreadElement(i))return!1}var u=l.getBindingIdentifiers(e),p={deopt:!1,bindings:u};return this.scope.traverse(t,d,p),!p.deopt}},e.prototype.pushUnpackedArrayPattern=function(e,t){for(var r=0;r<e.elements.length;r++){var n=e.elements[r];l.isRestElement(n)?this.push(n.argument,l.arrayExpression(t.elements.slice(r))):this.push(n,t.elements[r])}},e.prototype.pushArrayPattern=function(e,t){if(e.elements){if(this.canUnpackArrayPattern(e,t))return this.pushUnpackedArrayPattern(e,t);var r=!s(e)&&e.elements.length,n=this.toArray(t,r);l.isIdentifier(n)?t=n:(t=this.scope.generateUidIdentifierBasedOnNode(t),this.arrays[t.name]=!0,this.nodes.push(this.buildVariableDeclaration(t,n)));for(var i=0;i<e.elements.length;i++){var a=e.elements[i];if(a){var o;l.isRestElement(a)?(o=this.toArray(t),i>0&&(o=l.callExpression(l.memberExpression(o,l.identifier("slice")),[l.literal(i)])),a=a.argument):o=l.memberExpression(t,l.literal(i),!0),this.push(a,o)}}}},e.prototype.init=function(e,t){if(!l.isArrayExpression(t)&&!l.isMemberExpression(t)){var r=this.scope.maybeGenerateMemoised(t,!0);r&&(this.nodes.push(this.buildVariableDeclaration(r,t)),t=r)}return this.push(e,t),this.nodes},e}()},{179:179,43:43}],96:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=[],n=e.right;if(!l.isIdentifier(n)||!t.hasBinding(n.name)){var i=t.generateUidIdentifier("arr");r.push(l.variableDeclaration("var",[l.variableDeclarator(i,n)])),n=i}var a=t.generateUidIdentifier("i"),s=u.template("for-of-array",{BODY:e.body,KEY:a,ARR:n});l.inherits(s,e),l.ensureBlock(s);var o=l.memberExpression(n,a,!0),p=e.left;return l.isVariableDeclaration(p)?(p.declarations[0].init=o,s.body.body.unshift(p)):s.body.body.unshift(l.expressionStatement(l.assignmentExpression("=",p,o))),this.parentPath.isLabeledStatement()&&(s=l.labeledStatement(this.parentPath.node.label,s)),r.push(s),r}r.__esModule=!0,r._ForOfStatementArray=i;var a=e(43),s=n(a),o=e(182),u=n(o),p=e(179),l=n(p),c={ForOfStatement:function(e,t,r,n){if(this.get("right").isArrayExpression())return i.call(this,e,r,n);var a=d;n.isLoose("es6.forOf")&&(a=f);var s=a(e,t,r,n),o=s.declar,u=s.loop,p=u.body;return this.ensureBlock(),o&&p.body.push(o),p.body=p.body.concat(e.body.body),l.inherits(u,e),l.inherits(u.body,e.body),s.replaceParent?(this.parentPath.replaceWithMultiple(s.node),void this.dangerouslyRemove()):s.node}};r.visitor=c;var f=function(e,t,r,n){var i,a,o=e.left;if(l.isIdentifier(o)||l.isPattern(o)||l.isMemberExpression(o))a=o;else{if(!l.isVariableDeclaration(o))throw n.errorWithNode(o,s.get("unknownForHead",o.type));a=r.generateUidIdentifier("ref"),i=l.variableDeclaration(o.kind,[l.variableDeclarator(o.declarations[0].id,a)])}var p=r.generateUidIdentifier("iterator"),c=r.generateUidIdentifier("isArray"),f=u.template("for-of-loose",{LOOP_OBJECT:p,IS_ARRAY:c,OBJECT:e.right,INDEX:r.generateUidIdentifier("i"),ID:a});return i||f.body.body.shift(),{declar:i,node:f,loop:f}},d=function(e,t,r,n){var i,a=e.left,o=r.generateUidIdentifier("step"),p=l.memberExpression(o,l.identifier("value"));if(l.isIdentifier(a)||l.isPattern(a)||l.isMemberExpression(a))i=l.expressionStatement(l.assignmentExpression("=",a,p));else{if(!l.isVariableDeclaration(a))throw n.errorWithNode(a,s.get("unknownForHead",a.type));i=l.variableDeclaration(a.kind,[l.variableDeclarator(a.declarations[0].id,p)])}var c=r.generateUidIdentifier("iterator"),f=u.template("for-of",{ITERATOR_HAD_ERROR_KEY:r.generateUidIdentifier("didIteratorError"),ITERATOR_COMPLETION:r.generateUidIdentifier("iteratorNormalCompletion"),ITERATOR_ERROR_KEY:r.generateUidIdentifier("iteratorError"),ITERATOR_KEY:c,STEP_KEY:o,OBJECT:e.right,BODY:null}),d=l.isLabeledStatement(t),h=f[3].block.body,m=h[0];return d&&(h[0]=l.labeledStatement(t.label,m)),{replaceParent:d,declar:i,loop:m,node:f}}},{179:179,182:182,43:43}],97:[function(e,t,r){"use strict";r.__esModule=!0;var n={group:"builtin-pre"};r.metadata=n;var i={Literal:function(e){"number"==typeof e.value&&/^0[ob]/i.test(e.raw)&&(e.raw=void 0),"string"==typeof e.value&&/\\[u]/gi.test(e.raw)&&(e.raw=void 0)}};r.visitor=i},{}],98:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(e._blockHoist)for(var r=0;r<t.length;r++)t[r]._blockHoist=e._blockHoist}r.__esModule=!0;var a=e(179),s=n(a),o={group:"builtin-modules"};r.metadata=o;var u={ImportDeclaration:function(e,t,r,n){if("type"!==e.importKind&&"typeof"!==e.importKind){var i=[];if(e.specifiers.length)for(var a=e.specifiers,s=0;s<a.length;s++){var o=a[s];n.moduleFormatter.importSpecifier(o,e,i,r)}else n.moduleFormatter.importDeclaration(e,i,r);return 1===i.length&&(i[0]._blockHoist=e._blockHoist),i}},ExportAllDeclaration:function(e,t,r,n){var a=[];return n.moduleFormatter.exportAllDeclaration(e,a,r),i(e,a),a},ExportDefaultDeclaration:function(e,t,r,n){var a=[];return n.moduleFormatter.exportDeclaration(e,a,r),i(e,a),a},ExportNamedDeclaration:function(e,t,r,n){
if(!this.get("declaration").isTypeAlias()){var a=[];if(e.declaration){if(s.isVariableDeclaration(e.declaration)){var o=e.declaration.declarations[0];o.init=o.init||s.identifier("undefined")}n.moduleFormatter.exportDeclaration(e,a,r)}else if(e.specifiers)for(var u=0;u<e.specifiers.length;u++)n.moduleFormatter.exportSpecifier(e.specifiers[u],e,a,r);return i(e,a),a}}};r.visitor=u},{179:179}],99:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n,i){if((t.method||"init"!==t.kind)&&p.isFunction(t.value)){var a=new o["default"]({getObjectRef:n,methodNode:t,methodPath:e,isStatic:!0,scope:r,file:i});a.replace()}}r.__esModule=!0;var s=e(65),o=i(s),u=e(179),p=n(u),l={ObjectExpression:function(e,t,r,n){for(var i,s=function(){return i=i||r.generateUidIdentifier("obj")},o=this.get("properties"),u=0;u<e.properties.length;u++)a(o[u],e.properties[u],r,s,n);return i?(r.push({id:i}),p.assignmentExpression("=",i,e)):void 0}};r.visitor=l},{179:179,65:65}],100:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(56),s=i(a),o=e(59),u=i(o),p=e(182),l=n(p),c=e(179),f=n(c),d=function(e){for(var t=0;t<e.params.length;t++)if(!f.isIdentifier(e.params[t]))return!0;return!1},h={ReferencedIdentifier:function(e,t,r,n){if("eval"!==e.name){if(!n.scope.hasOwnBinding(e.name))return;if(n.scope.bindingIdentifierEquals(e.name,e))return}n.iife=!0,this.stop()}},m={Function:function(e,t,r,n){function i(t,r,i){var s;s=a(i)||f.isPattern(t)||n.transformers["es6.spec.blockScoping"].canTransform()?l.template("default-parameter",{VARIABLE_NAME:t,DEFAULT_VALUE:r,ARGUMENT_KEY:f.literal(i),ARGUMENTS:c},!0):l.template("default-parameter-assign",{VARIABLE_NAME:t,DEFAULT_VALUE:r},!0),s._blockHoist=e.params.length-i,p.push(s)}function a(e){return e+1>m}if(d(e)){this.ensureBlock();var o={iife:!1,scope:r},p=[],c=f.identifier("arguments");c._shadowedFunctionLiteral=this;for(var m=u["default"](e),y=this.get("params"),g=0;g<y.length;g++){var v=y[g];if(v.isAssignmentPattern()){var b=v.get("left"),E=v.get("right");if(a(g)||b.isPattern()){var x=r.generateUidIdentifier("x");x._isDefaultPlaceholder=!0,e.params[g]=x}else e.params[g]=b.node;o.iife||(E.isIdentifier()&&r.hasOwnBinding(E.node.name)?o.iife=!0:E.traverse(h,o)),i(b.node,E.node,g)}else v.isIdentifier()||v.traverse(h,o),n.transformers["es6.spec.blockScoping"].canTransform()&&v.isIdentifier()&&i(v.node,f.identifier("undefined"),g)}e.params=e.params.slice(0,m),o.iife?(p.push(s["default"](e,r)),e.body=f.blockStatement(p)):e.body.body=p.concat(e.body.body)}}};r.visitor=m},{179:179,182:182,56:56,59:59}],101:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(168),a=n(i),s=e(100),o=n(s),u=e(102),p=n(u),l={group:"builtin-advanced"};r.metadata=l;var c=a.merge([p.visitor,o.visitor]);r.visitor=c},{100:100,102:102,168:168}],102:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(0!==t){var r,n=e.property;p.isLiteral(n)?(n.value+=t,n.raw=String(n.value)):(r=p.binaryExpression("+",n,p.literal(t)),e.property=r)}}function a(e){return p.isRestElement(e.params[e.params.length-1])}r.__esModule=!0;var s=e(182),o=n(s),u=e(179),p=n(u),l={Scope:function(e,t,r,n){r.bindingIdentifierEquals(n.name,n.outerBinding)||this.skip()},Flow:function(){this.skip()},Function:function(e,t,r,n){var i=n.noOptimise;n.noOptimise=!0,this.traverse(l,n),n.noOptimise=i,this.skip()},ReferencedIdentifier:function(e,t,r,n){if("arguments"===e.name&&(n.deopted=!0),e.name===n.name)if(n.noOptimise)n.deopted=!0;else{if(this.parentPath.isMemberExpression({computed:!0,object:e})){var i=this.parentPath.get("property");if(i.isBaseType("number"))return void n.candidates.push(this)}if(this.parentPath.isSpreadElement()&&0===n.offset){var a=this.parentPath.parentPath;if(a.isCallExpression()&&1===a.node.arguments.length)return void n.candidates.push(this)}n.references.push(this)}},BindingIdentifier:function(e,t,r,n){e.name===n.name&&(n.deopted=!0)}},c={Function:function(e,t,r){if(a(e)){var n=e.params.pop(),s=n.argument,u=p.identifier("arguments");if(u._shadowedFunctionLiteral=this,p.isPattern(s)){var c=s;s=r.generateUidIdentifier("ref");var f=p.variableDeclaration("let",c.elements.map(function(e,t){var r=p.memberExpression(s,p.literal(t),!0);return p.variableDeclarator(e,r)}));e.body.body.unshift(f)}var d={references:[],offset:e.params.length,argumentsNode:u,outerBinding:r.getBindingIdentifier(s.name),candidates:[],name:s.name,deopted:!1};if(this.traverse(l,d),d.deopted||d.references.length){d.references=d.references.concat(d.candidates),d.deopted=d.deopted||!!e.shadow;var h=p.literal(e.params.length),m=r.generateUidIdentifier("key"),y=r.generateUidIdentifier("len"),g=m,v=y;e.params.length&&(g=p.binaryExpression("-",m,h),v=p.conditionalExpression(p.binaryExpression(">",y,h),p.binaryExpression("-",y,h),p.literal(0)));var b=o.template("rest",{ARRAY_TYPE:n.typeAnnotation,ARGUMENTS:u,ARRAY_KEY:g,ARRAY_LEN:v,START:h,ARRAY:s,KEY:m,LEN:y});if(d.deopted)b._blockHoist=e.params.length+1,e.body.body.unshift(b);else{b._blockHoist=1;var E,x=this.getEarliestCommonAncestorFrom(d.references).getStatementParent();x.findParent(function(e){if(e.isLoop())E=e;else if(e.isFunction())return!0}),E&&(x=E),x.insertBefore(b)}}else if(d.candidates.length)for(var S=d.candidates,A=0;A<S.length;A++){var D=S[A];D.replaceWith(u),D.parentPath.isMemberExpression()&&i(D.parent,d.offset)}}}};r.visitor=c},{179:179,182:182}],103:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t,r){for(var n=e.properties,i=0;i<n.length;i++){var a=n[i];t.push(o.expressionStatement(o.assignmentExpression("=",o.memberExpression(r,a.key,a.computed||o.isLiteral(a.key)),a.value)))}}function a(e,t,r,n,i){for(var a=e.properties,s=0;s<a.length;s++){var u=a[s];if(o.isLiteral(o.toComputedKey(u),{value:"__proto__"}))n.push(u);else{var p=u.key;o.isIdentifier(p)&&!u.computed&&(p=o.literal(p.name));var l=o.callExpression(i.addHelper("define-property"),[r,p,u.value]);t.push(o.expressionStatement(l))}}if(1===t.length){var c=t[0].expression;if(o.isCallExpression(c))return c.arguments[0]=o.objectExpression(n),c}}r.__esModule=!0;var s=e(179),o=n(s),u={ObjectExpression:{exit:function(e,t,r,n){for(var s=!1,u=e.properties,p=0;p<u.length;p++){var l=u[p];if(s=o.isProperty(l,{computed:!0,kind:"init"}))break}if(s){var c=[],f=!1;e.properties=e.properties.filter(function(e){return e.computed&&(f=!0),"init"===e.kind&&f?!0:(c.push(e),!1)});var d=r.generateUidIdentifierBasedOnNode(t),h=[],m=a;n.isLoose("es6.properties.computed")&&(m=i);var y=m(e,h,d,c,n);return y?y:(h.unshift(o.variableDeclaration("var",[o.variableDeclarator(d,o.objectExpression(c))])),h.push(o.expressionStatement(d)),h)}}}};r.visitor=u},{179:179}],104:[function(e,t,r){"use strict";r.__esModule=!0;var n={Property:function(e){e.method&&(e.method=!1),e.shorthand&&(e.shorthand=!1)}};r.visitor=n},{}],105:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(63),a=n(i),s=e(179),o=n(s),u={Literal:function(e){return a.is(e,"y")?o.newExpression(o.identifier("RegExp"),[o.literal(e.regex.pattern),o.literal(e.regex.flags)]):void 0}};r.visitor=u},{179:179,63:63}],106:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(583),s=i(a),o=e(63),u=n(o),p={Literal:function(e){u.is(e,"u")&&(e.regex.pattern=s["default"](e.regex.pattern,e.regex.flags),u.pullFlag(e,"u"))}};r.visitor=p},{583:583,63:63}],107:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-pre",optional:!0};r.metadata=s;var o={ArrowFunctionExpression:function(e,t,r,n){if(!e.shadow){e.shadow={"this":!1};var i=a.thisExpression();return i._forceShadow=this,a.ensureBlock(e),this.get("body").unshiftContainer("body",a.expressionStatement(a.callExpression(n.addHelper("new-arrow-check"),[a.thisExpression(),i]))),a.callExpression(a.memberExpression(e,a.identifier("bind")),[a.thisExpression()])}}};r.visitor=o},{179:179}],108:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){return o.callExpression(t.addHelper("temporal-assert-defined"),[e,o.literal(e.name),t.addHelper("temporal-undefined")])}function a(e,t,r){var n=r.letRefs[e.name];return n?t.getBindingIdentifier(e.name)===n:!1}r.__esModule=!0;var s=e(179),o=n(s),u={ReferencedIdentifier:function(e,t,r,n){if((!o.isFor(t)||t.left!==e)&&a(e,r,n)){var s=i(e,n.file);return this.skip(),o.isUpdateExpression(t)?void(t._ignoreBlockScopingTDZ||this.parentPath.replaceWith(o.sequenceExpression([s,t]))):o.logicalExpression("&&",s,e)}},AssignmentExpression:{exit:function(e,t,r,n){if(!e._ignoreBlockScopingTDZ){var s=[],u=this.getBindingIdentifiers();for(var p in u){var l=u[p];a(l,r,n)&&s.push(i(l,n.file))}return s.length?(e._ignoreBlockScopingTDZ=!0,s.push(e),s.map(o.expressionStatement)):void 0}}}},p={optional:!0,group:"builtin-advanced"};r.metadata=p;var l={"Program|Loop|BlockStatement":{exit:function(e,t,r,n){var i=e._letReferences;i&&this.traverse(u,{letRefs:i,file:n})}}};r.visitor=l},{179:179}],109:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-pre",optional:!0};r.metadata=s;var o={Program:function(){var e=this.scope.generateUidIdentifier("null");this.unshiftContainer("body",[a.variableDeclaration("var",[a.variableDeclarator(e,a.literal(null))]),a.exportNamedDeclaration(null,[a.exportSpecifier(e,a.identifier("__proto__"))])])}};r.visitor=o},{179:179}],110:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0};r.metadata=s;var o={UnaryExpression:function(e,t,r,n){if(!e._ignoreSpecSymbols){if(this.parentPath.isBinaryExpression()&&a.EQUALITY_BINARY_OPERATORS.indexOf(t.operator)>=0){var i=this.getOpposite();if(i.isLiteral()&&"symbol"!==i.node.value&&"object"!==i.node.value)return}if("typeof"===e.operator){var s=a.callExpression(n.addHelper("typeof"),[e.argument]);if(this.get("argument").isIdentifier()){var o=a.literal("undefined"),u=a.unaryExpression("typeof",e.argument);return u._ignoreSpecSymbols=!0,a.conditionalExpression(a.binaryExpression("===",u,o),o,s)}return s}}},BinaryExpression:function(e,t,r,n){return"instanceof"===e.operator?a.callExpression(n.addHelper("instanceof"),[e.left,e.right]):void 0},"VariableDeclaration|FunctionDeclaration":function(e){e._generated&&this.skip()}};r.visitor=o},{179:179}],111:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0,group:"builtin-pre"};r.metadata=s;var o={TemplateLiteral:function(e,t){if(!a.isTaggedTemplateExpression(t))for(var r=0;r<e.expressions.length;r++)e.expressions[r]=a.callExpression(a.identifier("String"),[e.expressions[r]])}};r.visitor=o},{179:179}],112:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){return t.hub.file.isLoose("es6.spread")&&!u.isIdentifier(e.argument,{name:"arguments"})?e.argument:t.toArray(e.argument,!0)}function a(e){for(var t=0;t<e.length;t++)if(u.isSpreadElement(e[t]))return!0;return!1}function s(e,t){for(var r=[],n=[],a=function(){n.length&&(r.push(u.arrayExpression(n)),n=[])},s=0;s<e.length;s++){var o=e[s];u.isSpreadElement(o)?(a(),r.push(i(o,t))):n.push(o)}return a(),r}r.__esModule=!0;var o=e(179),u=n(o),p={group:"builtin-advanced"};r.metadata=p;var l={ArrayExpression:function(e,t,r){var n=e.elements;if(a(n)){var i=s(n,r),o=i.shift();return u.isArrayExpression(o)||(i.unshift(o),o=u.arrayExpression([])),u.callExpression(u.memberExpression(o,u.identifier("concat")),i)}},CallExpression:function(e,t,r){var n=e.arguments;if(a(n)){var i=u.identifier("undefined");e.arguments=[];var o;o=1===n.length&&"arguments"===n[0].argument.name?[n[0].argument]:s(n,r);var p=o.shift();o.length?e.arguments.push(u.callExpression(u.memberExpression(p,u.identifier("concat")),o)):e.arguments.push(p);var l=e.callee;if(this.get("callee").isMemberExpression()){var c=r.maybeGenerateMemoised(l.object);c?(l.object=u.assignmentExpression("=",c,l.object),i=c):i=l.object,u.appendToMemberExpression(l,u.identifier("apply"))}else e.callee=u.memberExpression(e.callee,u.identifier("apply"));e.arguments.unshift(i)}},NewExpression:function(e,t,r,n){var i=e.arguments;if(a(i)){var o=s(i,r),p=u.arrayExpression([u.literal(null)]);return i=u.callExpression(u.memberExpression(p,u.identifier("concat")),o),u.newExpression(u.callExpression(u.memberExpression(n.addHelper("bind"),u.identifier("apply")),[e.callee,i]),[])}}};r.visitor=l},{179:179}],113:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e){return v.blockStatement([v.returnStatement(e)])}r.__esModule=!0;var o=e(415),u=i(o),p=e(43),l=n(p),c=e(406),f=i(c),d=e(182),h=n(d),m=e(414),y=i(m),g=e(179),v=n(g),b={group:"builtin-trailing"};r.metadata=b;var E={Function:function(e,t,r,n){if(!e.generator&&!e.async){var i=new x(this,r,n);i.run()}}};r.visitor=E;var E={enter:function(e,t){v.isTryStatement(t)&&(e===t.block?this.skip():t.finalizer&&e!==t.finalizer&&this.skip())},ReturnStatement:function(e,t,r,n){return n.subTransform(e.argument)},Function:function(){this.skip()},VariableDeclaration:function(e,t,r,n){n.vars.push(e)},ThisExpression:function(e,t,r,n){n.isShadowed||(n.needsThis=!0,n.thisPaths.push(this))},ReferencedIdentifier:function(e,t,r,n){"arguments"!==e.name||n.isShadowed&&!e._shadowedFunctionLiteral||(n.needsArguments=!0,n.argumentsPaths.push(this))}},x=function(){function e(t,r,n){a(this,e),this.hasTailRecursion=!1,this.needsArguments=!1,this.argumentsPaths=[],this.setsArguments=!1,this.needsThis=!1,this.thisPaths=[],this.isShadowed=t.isArrowFunctionExpression()||t.is("shadow"),this.ownerId=t.node.id,this.vars=[],this.scope=r,this.path=t,this.file=n,this.node=t.node}return e.prototype.getArgumentsId=function(){return this.argumentsId=this.argumentsId||this.scope.generateUidIdentifier("arguments")},e.prototype.getThisId=function(){return this.thisId=this.thisId||this.scope.generateUidIdentifier("this")},e.prototype.getLeftId=function(){return this.leftId=this.leftId||this.scope.generateUidIdentifier("left")},e.prototype.getFunctionId=function(){return this.functionId=this.functionId||this.scope.generateUidIdentifier("function")},e.prototype.getAgainId=function(){return this.againId=this.againId||this.scope.generateUidIdentifier("again")},e.prototype.getParams=function(){var e=this.params;if(!e){e=this.node.params,this.paramDecls=[];for(var t=0;t<e.length;t++){var r=e[t];r._isDefaultPlaceholder||this.paramDecls.push(v.variableDeclarator(r,e[t]=this.scope.generateUidIdentifier("x")))}}return this.params=e},e.prototype.hasDeopt=function(){var e=this.scope.getBinding(this.ownerId.name);return e&&!e.constant},e.prototype.run=function(){var e=this.node,t=this.ownerId;if(t&&(this.path.traverse(E,this),this.hasTailRecursion)){if(this.hasDeopt())return void this.file.log.deopt(e,l.get("tailCallReassignmentDeopt"));for(var r=this.path.ensureBlock().body,n=0;n<r.length;n++){var i=r[n];v.isFunctionDeclaration(i)&&(i=r[n]=v.variableDeclaration("var",[v.variableDeclarator(i.id,v.toExpression(i))]),i._blockHoist=2)}var a=this.paramDecls;if(a.length>0){var s=v.variableDeclaration("var",a);s._blockHoist=1/0,r.unshift(s)}r.unshift(v.expressionStatement(v.assignmentExpression("=",this.getAgainId(),v.literal(!1)))),e.body=h.template("tail-call-body",{FUNCTION_ID:this.getFunctionId(),AGAIN_ID:this.getAgainId(),BLOCK:e.body});var o=[];if(this.needsThis){for(var u=this.thisPaths,p=0;p<u.length;p++){var c=u[p];c.replaceWith(this.getThisId())}o.push(v.variableDeclarator(this.getThisId(),v.thisExpression()))}if(this.needsArguments||this.setsArguments){for(var f=this.argumentsPaths,d=0;d<f.length;d++){var m=f[d];m.replaceWith(this.argumentsId)}var y=v.variableDeclarator(this.argumentsId);this.argumentsId&&(y.init=v.identifier("arguments"),y.init._shadowedFunctionLiteral=this.path),o.push(y)}var g=this.leftId;g&&o.push(v.variableDeclarator(g)),o.length>0&&e.body.body.unshift(v.variableDeclaration("var",o))}},e.prototype.subTransform=function(e){if(e){var t=this["subTransform"+e.type];return t?t.call(this,e):void 0}},e.prototype.subTransformConditionalExpression=function(e){var t=this.subTransform(e.consequent),r=this.subTransform(e.alternate);return t||r?(e.type="IfStatement",e.consequent=t?v.toBlock(t):s(e.consequent),r?e.alternate=v.isIfStatement(r)?r:v.toBlock(r):e.alternate=s(e.alternate),[e]):void 0},e.prototype.subTransformLogicalExpression=function(e){var t=this.subTransform(e.right);if(t){var r=this.getLeftId(),n=v.assignmentExpression("=",r,e.left);return"&&"===e.operator&&(n=v.unaryExpression("!",n)),[v.ifStatement(n,s(r))].concat(t)}},e.prototype.subTransformSequenceExpression=function(e){var t=e.expressions,r=this.subTransform(t[t.length-1]);return r?(1===--t.length&&(e=t[0]),[v.expressionStatement(e)].concat(r)):void 0},e.prototype.subTransformCallExpression=function(e){var t,r,n=e.callee;if(v.isMemberExpression(n,{computed:!1})&&v.isIdentifier(n.property)){switch(n.property.name){case"call":r=v.arrayExpression(e.arguments.slice(1));break;case"apply":r=e.arguments[1]||v.identifier("undefined"),this.needsArguments=!0;break;default:return}t=e.arguments[0],n=n.object}if(v.isIdentifier(n)&&this.scope.bindingIdentifierEquals(n.name,this.ownerId)&&(this.hasTailRecursion=!0,!this.hasDeopt())){var i=[];this.needsThis&&!v.isThisExpression(t)&&i.push(v.expressionStatement(v.assignmentExpression("=",this.getThisId(),t||v.identifier("undefined")))),r||(r=v.arrayExpression(e.arguments));var a=this.getArgumentsId(),s=this.getParams();if(this.needsArguments&&i.push(v.expressionStatement(v.assignmentExpression("=",a,r))),v.isArrayExpression(r)){for(var o=r.elements;o.length<s.length;)o.push(v.identifier("undefined"));for(var p=0;p<o.length;p++){var l=s[p],c=o[p];l&&!l._isDefaultPlaceholder&&(o[p]=v.assignmentExpression("=",l,c))}if(!this.needsArguments)for(var d=o,h=0;h<d.length;h++){var c=d[h];this.scope.isPure(c)||i.push(v.expressionStatement(c))}}else{this.setsArguments=!0;for(var p=0;p<s.length;p++){var l=s[p];l._isDefaultPlaceholder||i.push(v.expressionStatement(v.assignmentExpression("=",l,v.memberExpression(a,v.literal(p),!0))))}}if(i.push(v.expressionStatement(v.assignmentExpression("=",this.getAgainId(),v.literal(!0)))),this.vars.length>0){var m=f["default"](y["default"](this.vars,function(e){return e.declarations})),g=u["default"](m,function(e,t){return v.assignmentExpression("=",t.id,e)},v.identifier("undefined")),b=v.expressionStatement(g);i.push(b)}return i.push(v.continueStatement(this.getFunctionId())),i}},e}()},{179:179,182:182,406:406,414:414,415:415,43:43}],114:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return o.isLiteral(e)&&"string"==typeof e.value}function a(e,t){var r=o.binaryExpression("+",e,t);return r._templateLiteralProduced=!0,r}r.__esModule=!0;var s=e(179),o=n(s),u={group:"builtin-pre"};r.metadata=u;var p={TaggedTemplateExpression:function(e,t,r,n){for(var i=e.quasi,a=[],s=[],u=[],p=i.quasis,l=0;l<p.length;l++){var c=p[l];s.push(o.literal(c.value.cooked)),u.push(o.literal(c.value.raw))}s=o.arrayExpression(s),u=o.arrayExpression(u);var f="tagged-template-literal";n.isLoose("es6.templateLiterals")&&(f+="-loose");var d=n.addTemplateObject(f,s,u);return a.push(d),a=a.concat(i.expressions),o.callExpression(e.tag,a)},TemplateLiteral:function(e,t,r,n){for(var s=[],u=e.quasis,p=0;p<u.length;p++){var l=u[p];s.push(o.literal(l.value.cooked));var c=e.expressions.shift();c&&s.push(c)}if(s=s.filter(function(e){return!o.isLiteral(e,{value:""})}),i(s[0])||i(s[1])||s.unshift(o.literal("")),!(s.length>1))return s[0];for(var f=a(s.shift(),s.shift()),d=s,h=0;h<d.length;h++){var m=d[h];f=a(f,m)}this.replaceWith(f)}};r.visitor=p},{179:179}],115:[function(e,t,r){"use strict";r.__esModule=!0;var n={stage:3};r.metadata=n},{}],116:[function(e,t,r){"use strict";r.__esModule=!0;var n={stage:1,dependencies:["es6.classes"]};r.metadata=n},{}],117:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=[],r=h.functionExpression(null,[],h.blockStatement(t),!0);return r.shadow=!0,t.push(u["default"](e,function(){return h.expressionStatement(h.yieldExpression(e.body))})),h.callExpression(r,[])}function s(e,t,r){var n=r.generateUidIdentifierBasedOnNode(t),i=f.template("array-comprehension-container",{KEY:n});i.callee.shadow=!0;var a=i.callee.body,s=a.body;l["default"].hasType(e,r,"YieldExpression",h.FUNCTION_TYPES)&&(i.callee.generator=!0,i=h.yieldExpression(i,!0));var o=s.pop();return s.push(u["default"](e,function(){return f.template("array-push",{STATEMENT:e.body,KEY:n},!0)})),s.push(o),i}r.__esModule=!0;var o=e(54),u=i(o),p=e(148),l=i(p),c=e(182),f=n(c),d=e(179),h=n(d),m={stage:0};r.metadata=m;var y={ComprehensionExpression:function(e,t,r){var n=s;return e.generator&&(n=a),n(e,t,r)}};r.visitor=y},{148:148,179:179,182:182,54:54}],118:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(60),s=i(a),o=e(57),u=n(o),p=e(179),l=n(p),c={dependencies:["es6.classes"],optional:!0,stage:1};r.metadata=c;var f={ObjectExpression:function(e,t,r,n){for(var i=!1,a=0;a<e.properties.length;a++){var o=e.properties[a];if(o.decorators){i=!0;break}}if(i){for(var p={},a=0;a<e.properties.length;a++){var o=e.properties[a];o.decorators&&s["default"](o.decorators,r),"init"!==o.kind||o.method||(o.kind="",o.value=l.functionExpression(null,[],l.blockStatement([l.returnStatement(o.value)]))),u.push(p,o,"initializer",n)}var c=u.toClassObject(p);return c=u.toComputedObjectFromClass(c),l.callExpression(n.addHelper("create-decorated-object"),[c])}}};r.visitor=f},{179:179,57:57,60:60}],119:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0,stage:0};r.metadata=s;var o={DoExpression:function(e){var t=e.body.body;return t.length?t:a.identifier("undefined")}};r.visitor=o},{179:179}],120:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var a=e(53),s=i(a),o=e(179),u=n(o),p={stage:3};r.metadata=p;var l=u.memberExpression(u.identifier("Math"),u.identifier("pow")),c=s["default"]({operator:"**",build:function(e,t){return u.callExpression(l,[e,t])}});r.visitor=c},{179:179,53:53}],121:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t,r){var n=e.specifiers[0];if(s.isExportNamespaceSpecifier(n)||s.isExportDefaultSpecifier(n)){var a,o=e.specifiers.shift(),u=r.generateUidIdentifier(o.exported.name);a=s.isExportNamespaceSpecifier(o)?s.importNamespaceSpecifier(u):s.importDefaultSpecifier(u),t.push(s.importDeclaration([a],e.source)),t.push(s.exportNamedDeclaration(null,[s.exportSpecifier(u,o.exported)])),i(e,t,r)}}r.__esModule=!0;var a=e(179),s=n(a),o={stage:1};r.metadata=o;var u={ExportNamedDeclaration:function(e,t,r){var n=[];return i(e,n,r),n.length?(e.specifiers.length>=1&&n.push(e),n):void 0}};r.visitor=u},{179:179}],122:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){var t=e.path.getData("functionBind");return t?t:(t=e.generateDeclaredUidIdentifier("context"),e.path.setData("functionBind",t))}function a(e,t){var r=e.object||e.callee.object;return t.isStatic(r)&&r}function s(e,t){var r=a(e,t);if(r)return r;var n=i(t);return e.object?e.callee=u.sequenceExpression([u.assignmentExpression("=",n,e.object),e.callee]):e.callee.object=u.assignmentExpression("=",n,e.callee.object),n}r.__esModule=!0;var o=e(179),u=n(o),p={optional:!0,stage:0};r.metadata=p;var l={CallExpression:function(e,t,r){var n=e.callee;if(u.isBindExpression(n)){var i=s(n,r);e.callee=u.memberExpression(n.callee,u.identifier("call")),e.arguments.unshift(i)}},BindExpression:function(e,t,r){var n=s(e,r);return u.callExpression(u.memberExpression(e.callee,u.identifier("bind")),[n])}};r.visitor=l},{179:179}],123:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={stage:2,dependencies:["es6.destructuring"]};r.metadata=s;var o=function(e){for(var t=0;t<e.properties.length;t++)if(a.isSpreadProperty(e.properties[t]))return!0;return!1},u={ObjectExpression:function(e,t,r,n){if(o(e)){for(var i=[],s=[],u=function(){s.length&&(i.push(a.objectExpression(s)),s=[])},p=0;p<e.properties.length;p++){var l=e.properties[p];a.isSpreadProperty(l)?(u(),i.push(l.argument)):s.push(l)}return u(),a.isObjectExpression(i[0])||i.unshift(a.objectExpression([])),a.callExpression(n.addHelper("extends"),i)}}};r.visitor=u},{179:179}],124:[function(e,t,r){"use strict";r.__esModule=!0;var n={stage:2};r.metadata=n},{}],125:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return"_"===e.key[0]?!0:void 0}function a(e,t){var r=t.blacklist;return r.length&&l["default"](r,e.key)?!1:void 0}function s(e,t){var r=t.whitelist;return r?l["default"](r,e.key):void 0}function o(e,t){var r=e.metadata.stage;return null!=r&&r>=t.stage?!0:void 0}function u(e,t){return e.metadata.optional&&!l["default"](t.optional,e.key)?!1:void 0}r.__esModule=!0,r.internal=i,r.blacklist=a,r.whitelist=s,r.stage=o,r.optional=u;var p=e(413),l=n(p)},{413:413}],126:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]={"minification.constantFolding":e(183),strict:e(142),eval:e(185),_validation:e(132),_hoistDirectives:e(128),"minification.removeDebugger":e(194),"minification.removeConsole":e(193),"utility.inlineEnvironmentVariables":e(186),"minification.deadCodeElimination":e(184),_modules:e(130),"react.displayName":e(192),"es6.spec.modules":e(109),"es6.spec.arrowFunctions":e(107),"es6.spec.templateLiterals":e(111),"es6.templateLiterals":e(114),"es6.literals":e(97),"validation.undeclaredVariableCheck":e(197),"spec.functionName":e(144),"es7.classProperties":e(116),"es7.trailingFunctionCommas":e(124),"es7.asyncFunctions":e(115),"es7.decorators":e(118),"validation.react":e(145),"es6.arrowFunctions":e(89),"spec.blockScopedFunctions":e(143),"optimisation.react.constantElements":e(191),"optimisation.react.inlineElements":e(135),"es7.comprehensions":e(117),"es6.classes":e(91),asyncToGenerator:e(136),bluebirdCoroutines:e(137),"es6.objectSuper":e(99),"es7.objectRestSpread":e(123),"es7.exponentiationOperator":e(120),"es5.properties.mutators":e(88),"es6.properties.shorthand":e(104),"es6.properties.computed":e(103),"optimisation.flow.forOf":e(133),"es6.forOf":e(96),"es6.regex.sticky":e(105),"es6.regex.unicode":e(106),"es6.constants":e(94),"es7.exportExtensions":e(121),"spec.protoToAssign":e(190),"es7.doExpressions":e(119),"es6.spec.symbols":e(110),"es7.functionBind":e(122),"spec.undefinedToVoid":e(199),"es6.spread":e(112),"es6.parameters":e(101),"es6.destructuring":e(95),"es6.blockScoping":e(90),"es6.spec.blockScoping":e(108),reactCompat:e(139),react:e(140),regenerator:e(141),runtime:e(196),"es6.modules":e(98),_moduleFormatter:e(129),"es6.tailCall":e(113),_shadowFunctions:e(131),"es3.propertyLiterals":e(87),"es3.memberExpressionLiterals":e(86),"minification.memberExpressionLiterals":e(188),"minification.propertyLiterals":e(189),_blockHoist:e(127),jscript:e(187),flow:e(138),"optimisation.modules.system":e(134)},t.exports=r["default"]},{101:101,103:103,104:104,105:105,106:106,107:107,108:108,109:109,110:110,111:111,112:112,113:113,114:114,115:115,116:116,117:117,118:118,119:119,120:120,121:121,122:122,123:123,124:124,127:127,128:128,129:129,130:130,131:131,132:132,133:133,134:134,135:135,136:136,137:137,138:138,139:139,140:140,141:141,142:142,143:143,144:144,145:145,183:183,184:184,185:185,186:186,187:187,188:188,189:189,190:190,191:191,192:192,193:193,194:194,196:196,197:197,199:199,86:86,87:87,88:88,89:89,90:90,91:91,94:94,95:95,96:96,97:97,98:98,99:99}],127:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(417),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o={Block:{exit:function(e){for(var t=!1,r=0;r<e.body.length;r++){var n=e.body[r];if(n&&null!=n._blockHoist){t=!0;break}}t&&(e.body=a["default"](e.body,function(e){var t=e&&e._blockHoist;return null==t&&(t=1),t===!0&&(t=2),-1*t}))}}};r.visitor=o},{417:417}],128:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-pre"};r.metadata=s;var o={Block:{exit:function(e){for(var t=0;t<e.body.length;t++){var r=e.body[t];if(!a.isExpressionStatement(r)||!a.isLiteral(r.expression))return;r._blockHoist=1/0}}}};r.visitor=o},{179:179}],129:[function(e,t,r){"use strict";r.__esModule=!0;var n={group:"builtin-modules"};r.metadata=n;var i={Program:{exit:function(e,t,r,n){for(var i=n.dynamicImports,a=0;a<i.length;a++){var s=i[a];s._blockHoist=3}e.body=n.dynamicImports.concat(e.body),n.transformers["es6.modules"].canTransform()&&n.moduleFormatter.transform&&n.moduleFormatter.transform(e);
}}};r.visitor=i},{}],130:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){var t=e.declaration;return u.inheritsComments(t,e),u.removeComments(e),t._ignoreUserWhitespace=!0,t}function a(e){return u.exportSpecifier(s(e),s(e))}function s(e){var t=e.name,r=e.loc,n=u.identifier(t);return n._loc=r,n}r.__esModule=!0;var o=e(179),u=n(o),p={group:"builtin-pre"};r.metadata=p;var l={ExportDefaultDeclaration:function(e,t,r){var n=e.declaration;if(u.isClassDeclaration(n)){var a=[i(e),e];return e.declaration=n.id,a}if(u.isClassExpression(n)){var s=r.generateUidIdentifier("default");e.declaration=u.variableDeclaration("var",[u.variableDeclarator(s,n)]);var a=[i(e),e];return e.declaration=s,a}if(u.isFunctionDeclaration(n)){e._blockHoist=2;var a=[i(e),e];return e.declaration=n.id,a}},ExportNamedDeclaration:function(e){var t=e.declaration;if(u.isClassDeclaration(t)){e.specifiers=[a(t.id)];var r=[i(e),e];return e.declaration=null,r}if(u.isFunctionDeclaration(t)){var n=u.exportNamedDeclaration(null,[a(t.id)]);return n._blockHoist=2,[i(e),n]}if(u.isVariableDeclaration(t)){var s=[],o=this.get("declaration").getBindingIdentifiers();for(var p in o)s.push(a(o[p]));return[t,u.exportNamedDeclaration(null,s)]}},Program:{enter:function(e){for(var t=[],r=[],n=0;n<e.body.length;n++){var i=e.body[n];u.isImportDeclaration(i)?t.push(i):r.push(i)}e.body=t.concat(r)},exit:function(e,t,r,n){n.transformers["es6.modules"].canTransform()&&n.moduleFormatter.setup&&n.moduleFormatter.setup()}}};r.visitor=l},{179:179}],131:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){return e.is("_forceShadow")?!0:t&&!t.isArrowFunctionExpression()}function a(e,t,r){var n=e.inShadow(t);if(i(e,n)){var a,s=e.node._shadowedFunctionLiteral,o=e.findParent(function(e){return(e.isProgram()||e.isFunction())&&(a=a||e),e.isProgram()?!0:e.isFunction()?s?e===s||e.node===s.node:!e.is("shadow"):!1});if(o!==a){var u=o.getData(t);if(u)return u;var p=r(),l=e.scope.generateUidIdentifier(t);return o.setData(t,l),o.scope.push({id:l,init:p}),l}}}r.__esModule=!0;var s=e(179),o=n(s),u={group:"builtin-trailing"};r.metadata=u;var p={ThisExpression:function(){return a(this,"this",function(){return o.thisExpression()})},ReferencedIdentifier:function(e){return"arguments"===e.name?a(this,"arguments",function(){return o.identifier("arguments")}):void 0}};r.visitor=p},{179:179}],132:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(43),a=n(i),s=e(179),o=n(s),u={group:"builtin-pre"};r.metadata=u;var p={ForXStatement:function(e,t,r,n){var i=e.left;if(o.isVariableDeclaration(i)){var s=i.declarations[0];if(s.init)throw n.errorWithNode(s,a.get("noAssignmentsInForHead"))}},Property:function(e,t,r,n){if("set"===e.kind){var i=e.value.params[0];if(o.isRestElement(i))throw n.errorWithNode(i,a.get("settersNoRest"))}}};r.visitor=p},{179:179,43:43}],133:[function(e,t,r){"use strict";r.__esModule=!0;var n=e(96),i={optional:!0};r.metadata=i;var a={ForOfStatement:function(e,t,r,i){return this.get("right").isGenericType("Array")?n._ForOfStatementArray.call(this,e,r,i):void 0}};r.visitor=a},{96:96}],134:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={optional:!0,group:"builtin-trailing"};r.metadata=s;var o={Program:function(e,t,r,n){n.moduleFormatter._setters&&r.traverse(n.moduleFormatter._setters,u,{exportFunctionIdentifier:n.moduleFormatter.exportIdentifier})}};r.visitor=o;var u={FunctionExpression:{enter:function(e,t,r,n){n.hasExports=!1,n.exportObjectIdentifier=r.generateUidIdentifier("exportObj")},exit:function(e,t,r,n){n.hasExports&&(e.body.body.unshift(a.variableDeclaration("var",[a.variableDeclarator(a.cloneDeep(n.exportObjectIdentifier),a.objectExpression([]))])),e.body.body.push(a.expressionStatement(a.callExpression(a.cloneDeep(n.exportFunctionIdentifier),[a.cloneDeep(n.exportObjectIdentifier)]))))}},CallExpression:function(e,t,r,n){if(a.isIdentifier(e.callee,{name:n.exportFunctionIdentifier.name})){n.hasExports=!0;var i=a.memberExpression(a.cloneDeep(n.exportObjectIdentifier),e.arguments[0],!0);return a.assignmentExpression("=",i,e.arguments[1])}}}},{179:179}],135:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){for(var t=0;t<e.length;t++){var r=e[t];if(p.isJSXSpreadAttribute(r))return!0;if(a(r,"ref"))return!0}return!1}function a(e,t){return p.isJSXAttribute(e)&&p.isJSXIdentifier(e.name,{name:t})}r.__esModule=!0;var s=e(62),o=n(s),u=e(179),p=n(u),l={optional:!0};r.metadata=l;var c={JSXElement:function(e,t,r,n){function s(e,t){u(d.properties,p.identifier(e),t)}function u(e,t,r){e.push(p.property("init",t,r))}var l=e.openingElement;if(!i(l.attributes)){var c=!0,f=p.objectExpression([]),d=p.objectExpression([]),h=p.literal(null),m=l.name;if(p.isJSXIdentifier(m)&&o.isCompatTag(m.name)&&(m=p.literal(m.name),c=!1),e.children.length){var y=o.buildChildren(e);y=1===y.length?y[0]:p.arrayExpression(y),u(f.properties,p.identifier("children"),y)}for(var g=0;g<l.attributes.length;g++){var v=l.attributes[g];a(v,"key")?h=v.value:u(f.properties,v.name,v.value||p.identifier("true"))}return c&&(f=p.callExpression(n.addHelper("default-props"),[p.memberExpression(m,p.identifier("defaultProps")),f])),s("$$typeof",n.addHelper("typeof-react-element")),s("type",m),s("key",h),s("ref",p.literal(null)),s("props",f),s("_owner",p.literal(null)),d}}};r.visitor=c},{179:179,62:62}],136:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(64),a=n(i),s=e(137);r.manipulateOptions=s.manipulateOptions;var o={optional:!0,dependencies:["es7.asyncFunctions","es6.classes"]};r.metadata=o;var u={Function:function(e,t,r,n){return e.async&&!e.generator?a["default"](this,n.addHelper("async-to-generator")):void 0}};r.visitor=u},{137:137,64:64}],137:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){e.blacklist.push("regenerator")}r.__esModule=!0,r.manipulateOptions=a;var s=e(64),o=i(s),u=e(179),p=n(u),l={optional:!0,dependencies:["es7.asyncFunctions","es6.classes"]};r.metadata=l;var c={Function:function(e,t,r,n){return e.async&&!e.generator?o["default"](this,p.memberExpression(n.addImport("bluebird",null,"absolute"),p.identifier("coroutine"))):void 0}};r.visitor=c},{179:179,64:64}],138:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s={group:"builtin-trailing"};r.metadata=s;var o="@flow",u={Program:function(e,t,r,n){for(var i=n.ast.comments,a=0;a<i.length;a++){var s=i[a];s.value.indexOf(o)>=0&&(s.value=s.value.replace(o,""),s.value.replace(/\*/g,"").trim()||(s._displayed=!0))}},Flow:function(){this.dangerouslyRemove()},ClassProperty:function(e){e.typeAnnotation=null,e.value||this.dangerouslyRemove()},Class:function(e){e["implements"]=null},Function:function(e){for(var t=0;t<e.params.length;t++){var r=e.params[t];r.optional=!1}},TypeCastExpression:function(e){do e=e.expression;while(a.isTypeCastExpression(e));return e}};r.visitor=u},{179:179}],139:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){e.blacklist.push("react")}r.__esModule=!0,r.manipulateOptions=i;var a=e(62),s=n(a),o=e(179),u=n(o),p={optional:!0,group:"builtin-advanced"};r.metadata=p;var l=e(55)({pre:function(e){e.callee=e.tagExpr},post:function(e){s.isCompatTag(e.tagName)&&(e.call=u.callExpression(u.memberExpression(u.memberExpression(u.identifier("React"),u.identifier("DOM")),e.tagExpr,u.isLiteral(e.tagExpr)),e.args))}});r.visitor=l},{179:179,55:55,62:62}],140:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(62),a=n(i),s=e(179),o=n(s),u=/^\*\s*@jsx\s+([^\s]+)/,p={group:"builtin-advanced"};r.metadata=p;var l=e(55)({pre:function(e){var t=e.tagName,r=e.args;a.isCompatTag(t)?r.push(o.literal(t)):r.push(e.tagExpr)},post:function(e,t){e.callee=t.get("jsxIdentifier")}});r.visitor=l,l.Program=function(e,t,r,n){for(var i=n.opts.jsxPragma,a=0;a<n.ast.comments.length;a++){var s=n.ast.comments[a],p=u.exec(s.value);if(p){if(i=p[1],"React.DOM"===i)throw n.errorWithNode(s,"The @jsx React.DOM pragma has been deprecated as of React 0.12");break}}n.set("jsxIdentifier",i.split(".").map(o.identifier).reduce(function(e,t){return o.memberExpression(e,t)}))}},{179:179,55:55,62:62}],141:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){for(var t,r=[];e;){var n=e.parentPath,i=n&&n.node;if(i){if(r.push(e.key),i!==e.container){var a=Object.keys(i).some(function(t){return i[t]===e.container?(r.push(t),!0):void 0});if(!a)throw new Error("Failed to find container object in parent node")}if(p.isProgram(i)){t=i;break}}e=n}if(!t)throw new Error("Failed to find root Program node");for(var s=new l(t);r.length>0;)s=s.get(r.pop());return s}r.__esModule=!0;var s=e(535),o=i(s),u=e(179),p=n(u),l=o["default"].types.NodePath,c={group:"builtin-advanced"};r.metadata=c;var f={Function:{exit:function(e){(e.async||e.generator)&&o["default"].transform(a(this))}}};r.visitor=f},{179:179,535:535}],142:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return s.isLiteral(e)?e.raw&&e.rawValue===e.value?"use strict"===e.rawValue:"use strict"===e.value:!1}r.__esModule=!0;var a=e(179),s=n(a),o={group:"builtin-pre"};r.metadata=o;var u=["FunctionExpression","FunctionDeclaration","ClassProperty"],p={Program:{enter:function(e){var t,r=e.body[0];s.isExpressionStatement(r)&&i(r.expression)?t=r:(t=s.expressionStatement(s.literal("use strict")),this.unshiftContainer("body",t),r&&(t.leadingComments=r.leadingComments,r.leadingComments=[])),t._blockHoist=1/0}},ThisExpression:function(){return this.findParent(function(e){return!e.is("shadow")&&u.indexOf(e.type)>=0})?void 0:s.identifier("undefined")}};r.visitor=p},{179:179}],143:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){for(var r=t.get(e),n=0;n<r.length;n++){var i=r[n],a=i.node;if(s.isFunctionDeclaration(a)){var o=s.variableDeclaration("let",[s.variableDeclarator(a.id,s.toExpression(a))]);o._blockHoist=2,a.id=null,i.replaceWith(o)}}}r.__esModule=!0;var a=e(179),s=n(a),o={BlockStatement:function(e,t){s.isFunction(t)&&t.body===e||s.isExportDeclaration(t)||i("body",this)},SwitchCase:function(){i("consequent",this)}};r.visitor=o},{179:179}],144:[function(e,t,r){"use strict";r.__esModule=!0;var n=e(61),i={group:"builtin-basic"};r.metadata=i;var a={"ArrowFunctionExpression|FunctionExpression":{exit:function(){return this.parentPath.isProperty()?void 0:n.bare.apply(this,arguments)}},ObjectExpression:function(){for(var e=this.get("properties"),t=e,r=0;r<t.length;r++){var i=t[r],a=i.get("value");if(a.isFunction()){var s=n.bare(a.node,i.node,a.scope);s&&a.replaceWith(s)}}}};r.visitor=a},{61:61}],145:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(u.isLiteral(e)){var r=e.value,n=r.toLowerCase();if("react"===n&&r!==n)throw t.errorWithNode(e,s.get("didYouMean","react"))}}r.__esModule=!0;var a=e(43),s=n(a),o=e(179),u=n(o),p={CallExpression:function(e,t,r,n){this.get("callee").isIdentifier({name:"require"})&&1===e.arguments.length&&i(e.arguments[0],n)},ModuleDeclaration:function(e,t,r,n){i(e.source,n)}};r.visitor=p},{179:179,43:43}],146:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(155),o=i(s),u=e(179),p=n(u),l=function(){function e(t,r,n,i){a(this,e),this.queue=null,this.parentPath=i,this.scope=t,this.state=n,this.opts=r}return e.prototype.shouldVisit=function(e){var t=this.opts;if(t.enter||t.exit)return!0;if(t[e.type])return!0;var r=p.VISITOR_KEYS[e.type];if(!r||!r.length)return!1;for(var n=r,i=0;i<n.length;i++){var a=n[i];if(e[a])return!0}return!1},e.prototype.create=function(e,t,r,n){var i=o["default"].get({parentPath:this.parentPath,parent:e,container:t,key:r,listKey:n});return i.unshiftContext(this),i},e.prototype.visitMultiple=function(e,t,r){if(0===e.length)return!1;for(var n=[],i=this.queue=[],a=!1,s=0;s<e.length;s++){var o=e[s];o&&this.shouldVisit(o)&&i.push(this.create(t,e,s,r))}for(var u=i,p=0;p<u.length;p++){var l=u[p];if(l.resync(),!(n.indexOf(l.node)>=0)&&(n.push(l.node),l.visit())){a=!0;break}}for(var c=i,f=0;f<c.length;f++){var l=c[f];l.shiftContext()}return this.queue=null,a},e.prototype.visitSingle=function(e,t){if(this.shouldVisit(e[t])){var r=this.create(e,e,t);r.visit(),r.shiftContext()}},e.prototype.visit=function(e,t){var r=e[t];if(r)return Array.isArray(r)?this.visitMultiple(r,e,t):this.visitSingle(e,t)},e}();r["default"]=l,t.exports=r["default"]},{155:155,179:179}],147:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function a(e){n(this,a),this.file=e};r["default"]=i,t.exports=r["default"]},{}],148:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,r,n,i){if(e){if(t||(t={}),!t.noScope&&!r&&"Program"!==e.type&&"File"!==e.type)throw new Error(f.get("traverseNeedsParent",e.type));if(l.explode(t),Array.isArray(e))for(var s=0;s<e.length;s++)a.node(e[s],t,r,n,i);else a.node(e,t,r,n,i)}}function s(e,t,r,n){e.type===n.type&&(n.has=!0,this.skip())}r.__esModule=!0,r["default"]=a;var o=e(146),u=i(o),p=e(168),l=n(p),c=e(43),f=n(c),d=e(413),h=i(d),m=e(179),y=n(m);a.visitors=l,a.verify=l.verify,a.explode=l.explode,a.node=function(e,t,r,n,i,a){var s=y.VISITOR_KEYS[e.type];if(s)for(var o=new u["default"](r,t,n,i),p=s,l=0;l<p.length;l++){var c=p[l];if((!a||!a[c])&&o.visit(e,c))return}};var g=y.COMMENT_KEYS.concat(["_scopeInfo","_paths","tokens","comments","start","end","loc","raw","rawValue"]);a.clearNode=function(e){for(var t=0;t<g.length;t++){var r=g[t];null!=e[r]&&(e[r]=void 0)}};var v={noScope:!0,exit:a.clearNode};a.removeProperties=function(e){return a(e,v),a.clearNode(e),e},a.hasType=function(e,t,r,n){if(h["default"](n,e.type))return!1;if(e.type===r)return!0;var i={has:!1,type:r};return a(e,{blacklist:n,enter:s},t,i),i.has},t.exports=r["default"]},{146:146,168:168,179:179,413:413,43:43}],149:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){for(var t=this;t=t.parentPath;)if(e(t))return t;return null}function s(){return this.findParent(function(e){return e.isFunction()||e.isProgram()})}function o(){var e=this;do if(Array.isArray(e.container))return e;while(e=e.parentPath)}function u(e){return this.getDeepestCommonAncestorFrom(e,function(e,t,r){for(var n,i=h.VISITOR_KEYS[e.type],a=r,s=0;s<a.length;s++){var o=a[s],u=o[t+1];if(n)if(u.listKey&&n.listKey===u.listKey&&u.key<n.key)n=u;else{var p=i.indexOf(n.parentKey),l=i.indexOf(u.parentKey);p>l&&(n=u)}else n=u}return n})}function p(e,t){var r=this;if(!e.length)return this;if(1===e.length)return e[0];var n,i,a=1/0,s=e.map(function(e){var t=[];do t.unshift(e);while((e=e.parentPath)&&e!==r);return t.length<a&&(a=t.length),t}),o=s[0];e:for(var u=0;a>u;u++){for(var p=o[u],l=s,c=0;c<l.length;c++){var f=l[c];if(f[u]!==p)break e}n=u,i=p}if(i)return t?t(i,n,s):i;throw new Error("Couldn't find intersection")}function l(){var e=this,t=[];do t.push(e);while(e=e.parentPath);return t}function c(){for(var e=this;e;){for(var t=arguments,r=0;r<t.length;r++){var n=t[r];if(e.node.type===n)return!0}e=e.parentPath}return!1}function f(e){var t=this;do if(t.isFunction()){var r=t.node.shadow;if(r){if(!e||r[e]!==!1)return t}else if(t.isArrowFunctionExpression())return t;return null}while(t=t.parentPath);return null}r.__esModule=!0,r.findParent=a,r.getFunctionParent=s,r.getStatementParent=o,r.getEarliestCommonAncestorFrom=u,r.getDeepestCommonAncestorFrom=p,r.getAncestry=l,r.inType=c,r.inShadow=f;var d=e(179),h=i(d),m=e(155);n(m)},{155:155,179:179}],150:[function(e,t,r){"use strict";function n(){var e=this.node;if(e){var t=e.trailingComments,r=e.leadingComments;if(t||r){var n=this.getSibling(this.key-1),i=this.getSibling(this.key+1);n.node||(n=i),i.node||(i=n),n.addComments("trailing",r),i.addComments("leading",t)}}}function i(e,t,r){this.addComments(e,[{type:r?"CommentLine":"CommentBlock",value:t}])}function a(e,t){if(t){var r=this.node;if(r){var n=e+"Comments";r[n]?r[n]=r[n].concat(t):r[n]=t}}}r.__esModule=!0,r.shareCommentsWithSiblings=n,r.addComment=i,r.addComments=a},{}],151:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){var t=this.node;if(t)for(var r=this.opts,n=[r[e],r[t.type]&&r[t.type][e]],i=0;i<n.length;i++){var a=n[i];if(a)for(var s=a,o=0;o<s.length;o++){var u=s[o];if(u){var p=this.node;if(!p)return;var l=this.type,c=u.call(this,p,this.parent,this.scope,this.state);if(c&&this.replaceWith(c,!0),this.shouldStop||this.shouldSkip||this.removed)return;if(l!==this.type)return void this.queueNode(this)}}}}function a(){var e=this.opts.blacklist;return e&&e.indexOf(this.node.type)>-1}function s(){if(this.isBlacklisted())return!1;if(this.opts.shouldSkip&&this.opts.shouldSkip(this))return!1;if(this.call("enter"),this.shouldSkip)return this.shouldStop;var e=this.node,t=this.opts;if(e)if(Array.isArray(e))for(var r=0;r<e.length;r++)A["default"].node(e[r],t,this.scope,this.state,this,this.skipKeys);else A["default"].node(e,t,this.scope,this.state,this,this.skipKeys),this.call("exit");return this.shouldStop}function o(){this.shouldSkip=!0}function u(e){this.skipKeys[e]=!0}function p(){this.shouldStop=!0,this.shouldSkip=!0}function l(){if(!this.opts||!this.opts.noScope){var e=this.context||this.parentPath;this.scope=this.getScope(e&&e.scope),this.scope&&this.scope.init()}}function c(e){return this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.skipKeys={},e&&(this.context=e,this.state=e.state,this.opts=e.opts),this.setScope(),this}function f(){this.removed||(this._resyncParent(),this._resyncList(),this._resyncKey())}function d(){this.parentPath&&(this.parent=this.parentPath.node)}function h(){if(this.container&&this.node!==this.container[this.key]){if(Array.isArray(this.container)){for(var e=0;e<this.container.length;e++)if(this.container[e]===this.node)return this.setKey(e)}else for(var t in this.container)if(this.container[t]===this.node)return this.setKey(t);this.key=null}}function m(){var e=this.listKey,t=this.parentPath;if(e&&t){var r=t.node[e];this.container!==r&&(r?this.container=r:this.container=null)}}function y(){null!=this.key&&this.container&&this.container[this.key]===this.node||this._markRemoved()}function g(){this.contexts.shift(),this.setContext(this.contexts[0])}function v(e){this.contexts.unshift(e),this.setContext(e)}function b(e,t,r,n){this.inList=!!r,this.listKey=r,this.parentKey=r||n,this.container=t,this.parentPath=e||this.parentPath,this.setKey(n)}function E(e){this.key=e,this.node=this.container[this.key],this.type=this.node&&this.node.type}function x(e){for(var t=this.contexts,r=0;r<t.length;r++){var n=t[r];n.queue&&n.queue.push(e)}}r.__esModule=!0,r.call=i,r.isBlacklisted=a,r.visit=s,r.skip=o,r.skipKey=u,r.stop=p,r.setScope=l,r.setContext=c,r.resync=f,r._resyncParent=d,r._resyncKey=h,r._resyncList=m,r._resyncRemoved=y,r.shiftContext=g,r.unshiftContext=v,r.setup=b,r.setKey=E,r.queueNode=x;var S=e(148),A=n(S)},{148:148}],152:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){var e,t=this.node;if(this.isMemberExpression())e=t.property;else{if(!this.isProperty())throw new ReferenceError("todo");e=t.key}return t.computed||o.isIdentifier(e)&&(e=o.literal(e.name)),e}function a(){return o.ensureBlock(this.node)}r.__esModule=!0,r.toComputedKey=i,r.ensureBlock=a;var s=e(179),o=n(s)},{179:179}],153:[function(e,t,r){(function(e){"use strict";function t(){var e=this.evaluate();return e.confident?!!e.value:void 0}function n(){function t(n){if(r){var a=n.node;if(n.isSequenceExpression()){var s=n.get("expressions");return t(s[s.length-1])}if(n.isLiteral()&&!a.regex)return a.value;if(n.isConditionalExpression())return t(t(n.get("test"))?n.get("consequent"):n.get("alternate"));if(n.isTypeCastExpression())return t(n.get("expression"));if(n.isIdentifier()&&!n.scope.hasBinding(a.name,!0)){if("undefined"===a.name)return void 0;if("Infinity"===a.name)return 1/0;if("NaN"===a.name)return NaN}if(n.isMemberExpression()&&!n.parentPath.isCallExpression({callee:a})){var o=n.get("property"),u=n.get("object");if(u.isLiteral()&&o.isIdentifier()){var p=u.node.value,l=typeof p;if("number"===l||"string"===l)return p[o.node.name]}}if(n.isReferencedIdentifier()){var c=n.scope.getBinding(a.name);if(c&&c.hasValue)return c.value;var f=n.resolve();return f===n?r=!1:t(f)}if(n.isUnaryExpression({prefix:!0})){var d=n.get("argument"),h=t(d);switch(a.operator){case"void":return void 0;case"!":return!h;case"+":return+h;case"-":return-h;case"~":return~h;case"typeof":return d.isFunction()?"function":typeof h}}if(n.isArrayExpression()||n.isObjectExpression(),n.isLogicalExpression()){var m=r,y=t(n.get("left")),g=r;r=m;var v=t(n.get("right")),b=r,E=g!==b;switch(r=g&&b,a.operator){case"||":return(y||v)&&E&&(r=!0),y||v;case"&&":return(!y&&g||!v&&b)&&(r=!0),y&&v}}if(n.isBinaryExpression()){var y=t(n.get("left")),v=t(n.get("right"));switch(a.operator){case"-":return y-v;case"+":return y+v;case"/":return y/v;case"*":return y*v;case"%":return y%v;case"**":return Math.pow(y,v);case"<":return v>y;case">":return y>v;case"<=":return v>=y;case">=":return y>=v;case"==":return y==v;case"!=":return y!=v;case"===":return y===v;case"!==":return y!==v;case"|":return y|v;case"&":return y&v;case"^":return y^v;case"<<":return y<<v;case">>":return y>>v;case">>>":return y>>>v}}if(n.isCallExpression()){var x,S,A=n.get("callee");if(A.isIdentifier()&&!n.scope.getBinding(A.node.name,!0)&&i.indexOf(A.node.name)>=0&&(S=e[a.callee.name]),A.isMemberExpression()){var u=A.get("object"),D=A.get("property");if(u.isIdentifier()&&D.isIdentifier()&&i.indexOf(u.node.name)>=0&&(x=e[u.node.name],S=x[D.node.name]),u.isLiteral()&&D.isIdentifier()){var l=typeof u.node.value;("string"===l||"number"===l)&&(x=u.node.value,S=x[D.node.name])}}if(S){var C=n.get("arguments").map(t);if(!r)return;return S.apply(x,C)}}r=!1}}var r=!0,n=t(this);return r||(n=void 0),{confident:r,value:n}}r.__esModule=!0,r.evaluateTruthy=t,r.evaluate=n;var i=["String","Number","Math"]}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],154:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(){var e=this;do{if(!e.parentPath||Array.isArray(e.container)&&e.isStatement())break;e=e.parentPath}while(e);if(e&&(e.isProgram()||e.isFile()))throw new Error("File/Program node, we can't possibly find a statement parent to this");return e}function s(){return"left"===this.key?this.getSibling("right"):"right"===this.key?this.getSibling("left"):void 0}function o(){var e=[],t=function(t){t&&(e=e.concat(t.getCompletionRecords()))};if(this.isIfStatement())t(this.get("consequent")),t(this.get("alternate"));else if(this.isDoExpression()||this.isFor()||this.isWhile())t(this.get("body"));else if(this.isProgram()||this.isBlockStatement())t(this.get("body").pop());else{if(this.isFunction())return this.get("body").getCompletionRecords();this.isTryStatement()?(t(this.get("block")),t(this.get("handler")),t(this.get("finalizer"))):e.push(this)}return e}function u(e){return h["default"].get({parentPath:this.parentPath,parent:this.parent,container:this.container,listKey:this.listKey,key:e})}function p(e,t){t===!0&&(t=this.context);var r=e.split(".");return 1===r.length?this._getKey(e,t):this._getPattern(r,t)}function l(e,t){var r=this,n=this.node,i=n[e];return Array.isArray(i)?i.map(function(a,s){return h["default"].get({listKey:e,parentPath:r,parent:n,container:i,key:s}).setContext(t)}):h["default"].get({parentPath:this,parent:n,container:n,key:e}).setContext(t)}function c(e,t){for(var r=this,n=e,i=0;i<n.length;i++){var a=n[i];r="."===a?r.parentPath:Array.isArray(r)?r[a]:r.get(a,t)}return r}function f(e){return y.getBindingIdentifiers(this.node,e)}r.__esModule=!0,r.getStatementParent=a,r.getOpposite=s,r.getCompletionRecords=o,r.getSibling=u,r.get=p,r._getKey=l,r._getPattern=c,r.getBindingIdentifiers=f;var d=e(155),h=i(d),m=e(179),y=n(m)},{155:155,179:179}],155:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=e(162),o=i(s),u=e(148),p=n(u),l=e(509),c=n(l),f=e(167),d=n(f),h=e(179),m=i(h),y=function(){function e(t,r){a(this,e),this.contexts=[],this.parent=r,this.data={},this.hub=t,this.shouldSkip=!1,this.shouldStop=!1,this.removed=!1,this.state=null,this.opts=null,this.skipKeys=null,this.parentPath=null,this.context=null,this.container=null,this.listKey=null,this.inList=!1,this.parentKey=null,this.key=null,this.node=null,this.scope=null,this.type=null,this.typeAnnotation=null}return e.get=function(t){var r=t.hub,n=t.parentPath,i=t.parent,a=t.container,s=t.listKey,o=t.key;!r&&n&&(r=n.hub);for(var u,p=a[o],l=i._paths=i._paths||[],c=0;c<l.length;c++){var f=l[c];if(f.node===p){u=f;break}}return u||(u=new e(r,i),l.push(u)),u.setup(n,a,s,o),u},e.prototype.getScope=function(e){var t=e;return this.isScope()&&(t=new d["default"](this,e)),t},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e,t){var r=this.data[e];return!r&&t&&(r=this.data[e]=t),r},e.prototype.errorWithNode=function(e){var t=arguments.length<=1||void 0===arguments[1]?SyntaxError:arguments[1];return this.hub.file.errorWithNode(this.node,e,t)},e.prototype.traverse=function(e,t){p["default"](this.node,e,this.scope,t,this)},e}();r["default"]=y,c["default"](y.prototype,e(149)),c["default"](y.prototype,e(156)),c["default"](y.prototype,e(165)),c["default"](y.prototype,e(153)),c["default"](y.prototype,e(152)),c["default"](y.prototype,e(159)),c["default"](y.prototype,e(151)),c["default"](y.prototype,e(164)),c["default"](y.prototype,e(163)),c["default"](y.prototype,e(154)),c["default"](y.prototype,e(150));for(var g=m.TYPES,v=function(){var e=g[b],t="is"+e;y.prototype[t]=function(e){return m[t](this.node,e)}},b=0;b<g.length;b++)v();var E=function(e){return"_"===e[0]?"continue":(m.TYPES.indexOf(e)<0&&m.TYPES.push(e),void(y.prototype["is"+e]=function(t){return o[e].checkPath(this,t)}))};for(var x in o){E(x)}t.exports=r["default"]},{148:148,149:149,150:150,151:151,152:152,153:153,154:154,156:156,159:159,162:162,163:163,164:164,165:165,167:167,179:179,509:509}],156:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){if(this.typeAnnotation)return this.typeAnnotation;var e=this._getTypeAnnotation()||h.anyTypeAnnotation();return h.isTypeAnnotation(e)&&(e=e.typeAnnotation),this.typeAnnotation=e}function a(){var e=this.node;{if(e){if(e.typeAnnotation)return e.typeAnnotation;var t=f[e.type];return t?t.call(this,e):(t=f[this.parentPath.type],t&&t.validParent?this.parentPath.getTypeAnnotation():void 0)}if("init"===this.key&&this.parentPath.isVariableDeclarator()){var r=this.parentPath.parentPath,n=r.parentPath;return"left"===r.key&&n.isForInStatement()?h.stringTypeAnnotation():"left"===r.key&&n.isForOfStatement()?h.anyTypeAnnotation():h.voidTypeAnnotation()}}}function s(e,t){return o(e,this.getTypeAnnotation(),t)}function o(e,t,r){if("string"===e)return h.isStringTypeAnnotation(t);if("number"===e)return h.isNumberTypeAnnotation(t);if("boolean"===e)return h.isBooleanTypeAnnotation(t);if("any"===e)return h.isAnyTypeAnnotation(t);if("mixed"===e)return h.isMixedTypeAnnotation(t);if("void"===e)return h.isVoidTypeAnnotation(t);if(r)return!1;throw new Error("Unknown base type "+e)}function u(e){var t=this.getTypeAnnotation();if(h.isAnyTypeAnnotation(t))return!0;if(h.isUnionTypeAnnotation(t)){for(var r=t.types,n=0;n<r.length;n++){var i=r[n];if(h.isAnyTypeAnnotation(i)||o(e,i,!0))return!0}return!1}return o(e,t,!0)}function p(e){var t=this.getTypeAnnotation();return e=e.getTypeAnnotation(),!h.isAnyTypeAnnotation()&&h.isFlowBaseAnnotation(t)?e.type===t.type:void 0}function l(e){var t=this.getTypeAnnotation();return h.isGenericTypeAnnotation(t)&&h.isIdentifier(t.id,{name:e})}r.__esModule=!0,r.getTypeAnnotation=i,r._getTypeAnnotation=a,r.isBaseType=s,r.couldBeBaseType=u,r.baseTypeStrictlyMatches=p,r.isGenericType=l;var c=e(158),f=n(c),d=e(179),h=n(d)},{158:158,179:179}],157:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){var r=e.scope.getBinding(t),n=[];e.typeAnnotation=l.unionTypeAnnotation(n);var i=[],s=a(r,e,i),o=u(e,t);if(o){var p=a(r,o.ifStatement);s=s.filter(function(e){return p.indexOf(e)<0}),n.push(o.typeAnnotation)}if(s.length){var c=s.reverse(),f=[];s=[];for(var d=c,h=0;h<d.length;h++){var m=d[h],y=m.scope;if(!(f.indexOf(y)>=0)&&(f.push(y),s.push(m),y===e.scope)){s=[m];break}}s=s.concat(i);for(var g=s,v=0;v<g.length;v++){var m=g[v];n.push(m.getTypeAnnotation())}}return n.length?l.createUnionTypeAnnotation(n):void 0}function a(e,t,r){var n=e.constantViolations.slice();return n.unshift(e.path),n.filter(function(e){e=e.resolve();var n=e._guessExecutionStatusRelativeTo(t);return r&&"function"===n&&r.push(e),"before"===n;
})}function s(e,t){var r,n=t.node.operator,i=t.get("right").resolve(),a=t.get("left").resolve();if(a.isIdentifier({name:e})?r=i:i.isIdentifier({name:e})&&(r=a),r)return"==="===n?r.getTypeAnnotation():l.BOOLEAN_NUMBER_BINARY_OPERATORS.indexOf(n)>=0?l.numberTypeAnnotation():void 0;if("==="===n){var s,o;if(a.isUnaryExpression({operator:"typeof"})?(s=a,o=i):i.isUnaryExpression({operator:"typeof"})&&(s=i,o=a),(o||s)&&(o=o.resolve(),o.isLiteral())){var u=o.node.value;if("string"==typeof u&&s.get("argument").isIdentifier({name:e}))return l.createTypeAnnotationBasedOnTypeof(o.node.value)}}}function o(e){for(var t;t=e.parentPath;){if(t.isIfStatement()||t.isConditionalExpression())return"test"===e.key?void 0:t;e=t}}function u(e,t){var r=o(e);if(r){var n=r.get("test"),i=[n],a=[];do{var p=i.shift().resolve();if(p.isLogicalExpression()&&(i.push(p.get("left")),i.push(p.get("right"))),p.isBinaryExpression()){var c=s(t,p);c&&a.push(c)}}while(i.length);return a.length?{typeAnnotation:l.createUnionTypeAnnotation(a),ifStatement:r}:u(r,t)}}r.__esModule=!0;var p=e(179),l=n(p);r["default"]=function(e){if(this.isReferenced()){var t=this.scope.getBinding(e.name);return t?t.identifier.typeAnnotation?t.identifier.typeAnnotation:i(this,e.name):"undefined"===e.name?l.voidTypeAnnotation():"NaN"===e.name||"Infinity"===e.name?l.numberTypeAnnotation():void("arguments"===e.name)}},t.exports=r["default"]},{179:179}],158:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e["default"]:e}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(){var e=this.get("id");return e.isIdentifier()?this.get("init").getTypeAnnotation():void 0}function s(e){return e.typeAnnotation}function o(e){return this.get("callee").isIdentifier()?C.genericTypeAnnotation(e.callee):void 0}function u(){return C.stringTypeAnnotation()}function p(e){var t=e.operator;return"void"===t?C.voidTypeAnnotation():C.NUMBER_UNARY_OPERATORS.indexOf(t)>=0?C.numberTypeAnnotation():C.STRING_UNARY_OPERATORS.indexOf(t)>=0?C.stringTypeAnnotation():C.BOOLEAN_UNARY_OPERATORS.indexOf(t)>=0?C.booleanTypeAnnotation():void 0}function l(e){var t=e.operator;if(C.NUMBER_BINARY_OPERATORS.indexOf(t)>=0)return C.numberTypeAnnotation();if(C.BOOLEAN_BINARY_OPERATORS.indexOf(t)>=0)return C.booleanTypeAnnotation();if("+"===t){var r=this.get("right"),n=this.get("left");return n.isBaseType("number")&&r.isBaseType("number")?C.numberTypeAnnotation():n.isBaseType("string")||r.isBaseType("string")?C.stringTypeAnnotation():C.unionTypeAnnotation([C.stringTypeAnnotation(),C.numberTypeAnnotation()])}}function c(){return C.createUnionTypeAnnotation([this.get("left").getTypeAnnotation(),this.get("right").getTypeAnnotation()])}function f(){return C.createUnionTypeAnnotation([this.get("consequent").getTypeAnnotation(),this.get("alternate").getTypeAnnotation()])}function d(){return this.get("expressions").pop().getTypeAnnotation()}function h(){return this.get("right").getTypeAnnotation()}function m(e){var t=e.operator;return"++"===t||"--"===t?C.numberTypeAnnotation():void 0}function y(e){var t=e.value;return"string"==typeof t?C.stringTypeAnnotation():"number"==typeof t?C.numberTypeAnnotation():"boolean"==typeof t?C.booleanTypeAnnotation():null===t?C.voidTypeAnnotation():e.regex?C.genericTypeAnnotation(C.identifier("RegExp")):void 0}function g(){return C.genericTypeAnnotation(C.identifier("Object"))}function v(){return C.genericTypeAnnotation(C.identifier("Array"))}function b(){return v()}function E(){return C.genericTypeAnnotation(C.identifier("Function"))}function x(){return A(this.get("callee"))}function S(){return A(this.get("tag"))}function A(e){if(e=e.resolve(),e.isFunction()){if(e.is("async"))return e.is("generator")?C.genericTypeAnnotation(C.identifier("AsyncIterator")):C.genericTypeAnnotation(C.identifier("Promise"));if(e.node.returnType)return e.node.returnType}}r.__esModule=!0,r.VariableDeclarator=a,r.TypeCastExpression=s,r.NewExpression=o,r.TemplateLiteral=u,r.UnaryExpression=p,r.BinaryExpression=l,r.LogicalExpression=c,r.ConditionalExpression=f,r.SequenceExpression=d,r.AssignmentExpression=h,r.UpdateExpression=m,r.Literal=y,r.ObjectExpression=g,r.ArrayExpression=v,r.RestElement=b,r.CallExpression=x,r.TaggedTemplateExpression=S;var D=e(179),C=i(D),w=e(157);r.Identifier=n(w),s.validParent=!0,b.validParent=!0,r.Function=E,r.Class=E},{157:157,179:179}],159:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){function r(e){var t=n[a];return"*"===t||e===t}if(!this.isMemberExpression())return!1;for(var n=e.split("."),i=[this.node],a=0;i.length;){var s=i.shift();if(t&&a===n.length)return!0;if(A.isIdentifier(s)){if(!r(s.name))return!1}else if(A.isLiteral(s)){if(!r(s.value))return!1}else{if(A.isMemberExpression(s)){if(s.computed&&!A.isLiteral(s.property))return!1;i.unshift(s.property),i.unshift(s.object);continue}if(!A.isThisExpression(s))return!1;if(!r("this"))return!1}if(++a>n.length)return!1}return a===n.length}function s(e){var t=this.node[e];return t&&Array.isArray(t)?!!t.length:!!t}function o(e){return!this.has(e)}function u(e,t){return this.node[e]===t}function p(e){return A.isType(this.type,e)}function l(){return("init"===this.key||"left"===this.key)&&this.parentPath.isFor()}function c(e){return"body"===this.key&&this.parentPath.isArrowFunctionExpression()?this.isExpression()?A.isBlockStatement(e):this.isBlockStatement()?A.isExpression(e):!1:!1}function f(e){var t=this,r=!0;do{var n=t.container;if(t.isFunction()&&!r)return!!e;if(r=!1,Array.isArray(n)&&t.key!==n.length-1)return!1}while((t=t.parentPath)&&!t.isProgram());return!0}function d(){return this.parentPath.isLabeledStatement()||A.isBlockStatement(this.container)?!1:x["default"](A.STATEMENT_OR_BLOCK_KEYS,this.key)}function h(e,t){if(!this.isReferencedIdentifier())return!1;var r=this.scope.getBinding(this.node.name);if(!r||"module"!==r.kind)return!1;var n=r.path,i=n.parentPath;return i.isImportDeclaration()?i.node.source.value!==e?!1:t?n.isImportDefaultSpecifier()&&"default"===t?!0:n.isImportNamespaceSpecifier()&&"*"===t?!0:n.isImportSpecifier()&&n.node.imported.name===t?!0:!1:!0:!1}function m(){var e=this.node;return e.end?this.hub.file.code.slice(e.start,e.end):""}function y(e){return"after"!==this._guessExecutionStatusRelativeTo(e)}function g(e){var t=e.scope.getFunctionParent(),r=this.scope.getFunctionParent();if(t!==r)return"function";var n,i,a,s=e.getAncestry(),o=this.getAncestry();for(a=0;a<o.length;a++){var u=o[a];if(i=s.indexOf(u),i>=0){n=u;break}}if(!n)return"before";var p=s[i-1],l=o[a-1];if(!p||!l)return"before";if(p.listKey&&p.container===l.container)return p.key>l.key?"before":"after";var c=A.VISITOR_KEYS[p.type].indexOf(p.key),f=A.VISITOR_KEYS[l.type].indexOf(l.key);return c>f?"before":"after"}function v(e,t){return this._resolve(e,t)||this}function b(e,t){if(!(t&&t.indexOf(this)>=0))if(t=t||[],t.push(this),this.isVariableDeclarator()){if(this.get("id").isIdentifier())return this.get("init").resolve(e,t)}else if(this.isReferencedIdentifier()){var r=this.scope.getBinding(this.node.name);if(!r)return;if(!r.constant)return;if("module"===r.kind)return;if(r.path!==this)return r.path.resolve(e,t)}else{if(this.isTypeCastExpression())return this.get("expression").resolve(e,t);if(e&&this.isMemberExpression()){var n=this.toComputedKey();if(!A.isLiteral(n))return;var i=n.value,a=this.get("object").resolve(e,t);if(a.isObjectExpression())for(var s=a.get("properties"),o=s,u=0;u<o.length;u++){var p=o[u];if(p.isProperty()){var l=p.get("key"),c=p.isnt("computed")&&l.isIdentifier({name:i});if(c=c||l.isLiteral({value:i}))return p.get("value").resolve(e,t)}}else if(a.isArrayExpression()&&!isNaN(+i)){var f=a.get("elements"),d=f[i];if(d)return d.resolve(e,t)}}}}r.__esModule=!0,r.matchesPattern=a,r.has=s,r.isnt=o,r.equals=u,r.isNodeType=p,r.canHaveVariableDeclarationOrExpression=l,r.canSwapBetweenExpressionAndStatement=c,r.isCompletionRecord=f,r.isStatementOrBlock=d,r.referencesImport=h,r.getSource=m,r.willIMaybeExecuteBefore=y,r._guessExecutionStatusRelativeTo=g,r.resolve=v,r._resolve=b;var E=e(413),x=i(E),S=e(179),A=n(S),D=s;r.is=D},{179:179,413:413}],160:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var a=e(62),s=n(a),o=e(179),u=n(o),p={ReferencedIdentifier:function(e,t,r,n){if(!this.isJSXIdentifier()||!s.isCompatTag(e.name)){var i=r.getBinding(e.name);if(i&&i===n.scope.getBinding(e.name))if(i.constant)n.bindings[e.name]=i;else for(var a=i.constantViolations,o=0;o<a.length;o++){var u=a[o];n.breakOnScopePaths=n.breakOnScopePaths.concat(u.getAncestry())}}}},l=function(){function e(t,r){i(this,e),this.breakOnScopePaths=[],this.bindings={},this.scopes=[],this.scope=r,this.path=t}return e.prototype.isCompatibleScope=function(e){for(var t in this.bindings){var r=this.bindings[t];if(!e.bindingIdentifierEquals(t,r.identifier))return!1}return!0},e.prototype.getCompatibleScopes=function(){var e=this.path.scope;do{if(!this.isCompatibleScope(e))break;if(this.scopes.push(e),this.breakOnScopePaths.indexOf(e.path)>=0)break}while(e=e.parent)},e.prototype.getAttachmentPath=function(){var e=this.scopes,t=e.pop();if(t){if(t.path.isFunction()){if(this.hasOwnParamBindings(t)){if(this.scope===t)return;return t.path.get("body").get("body")[0]}return this.getNextScopeStatementParent()}return t.path.isProgram()?this.getNextScopeStatementParent():void 0}},e.prototype.getNextScopeStatementParent=function(){var e=this.scopes.pop();return e?e.path.getStatementParent():void 0},e.prototype.hasOwnParamBindings=function(e){for(var t in this.bindings)if(e.hasOwnBinding(t)){var r=this.bindings[t];if("param"===r.kind)return!0}return!1},e.prototype.run=function(){var e=this.path.node;if(!e._hoisted){e._hoisted=!0,this.path.traverse(p,this),this.getCompatibleScopes();var t=this.getAttachmentPath();if(t&&t.getFunctionParent()!==this.path.getFunctionParent()){var r=t.scope.generateUidIdentifier("ref");t.insertBefore([u.variableDeclaration("var",[u.variableDeclarator(r,this.path.node)])]);var n=this.path.parentPath;n.isJSXElement()&&this.path.container===n.node.children&&(r=u.JSXExpressionContainer(r)),this.path.replaceWith(r)}}},e}();r["default"]=l,t.exports=r["default"]},{179:179,62:62}],161:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(179),a=n(i),s=[function(e){return"body"===e.key&&(e.isBlockStatement()||e.isClassBody())?(e.node.body=[],!0):void 0},function(e,t){var r=!1;return r=r||"body"===e.key&&t.isArrowFunctionExpression(),r=r||"argument"===e.key&&t.isThrowStatement(),r?(e.replaceWith(a.identifier("undefined")),!0):void 0}];r.pre=s;var o=[function(e,t){var r=!1;return r=r||"test"===e.key&&(t.isWhile()||t.isSwitchCase()),r=r||"declaration"===e.key&&t.isExportDeclaration(),r=r||"body"===e.key&&t.isLabeledStatement(),r=r||"declarations"===e.listKey&&t.isVariableDeclaration()&&0===t.node.declarations.length,r=r||"expression"===e.key&&t.isExpressionStatement(),r=r||"test"===e.key&&t.isIfStatement(),r?(t.dangerouslyRemove(),!0):void 0},function(e,t){return t.isSequenceExpression()&&1===t.node.expressions.length?(t.replaceWith(t.node.expressions[0]),!0):void 0},function(e,t){return t.isBinary()?("left"===e.key?t.replaceWith(t.node.right):t.replaceWith(t.node.left),!0):void 0}];r.post=o},{179:179}],162:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}r.__esModule=!0;var i=e(62),a=n(i),s=e(179),o=n(s),u={types:["Identifier","JSXIdentifier"],checkPath:function(e,t){var r=e.node,n=e.parent;if(!o.isIdentifier(r,t)){if(!o.isJSXIdentifier(r,t))return!1;if(a.isCompatTag(r.name))return!1}return o.isReferenced(r,n)}};r.ReferencedIdentifier=u;var p={types:["Identifier"],checkPath:function(e){var t=e.node,r=e.parent;return o.isBinding(t,r)}};r.BindingIdentifier=p;var l={types:["Statement"],checkPath:function(e){var t=e.node,r=e.parent;if(o.isStatement(t)){if(o.isVariableDeclaration(t)){if(o.isForXStatement(r,{left:t}))return!1;if(o.isForStatement(r,{init:t}))return!1}return!0}return!1}};r.Statement=l;var c={types:["Expression"],checkPath:function(e){return e.isIdentifier()?e.isReferencedIdentifier():o.isExpression(e.node)}};r.Expression=c;var f={types:["Scopable"],checkPath:function(e){return o.isScope(e.node,e.parent)}};r.Scope=f;var d={checkPath:function(e){return o.isReferenced(e.node,e.parent)}};r.Referenced=d;var h={checkPath:function(e){return o.isBlockScoped(e.node)}};r.BlockScoped=h;var m={types:["VariableDeclaration"],checkPath:function(e){return o.isVar(e.node)}};r.Var=m;var y={types:["Literal"],checkPath:function(e){return e.isLiteral()&&e.parentPath.isExpressionStatement()}};r.DirectiveLiteral=y;var g={types:["ExpressionStatement"],checkPath:function(e){return e.get("expression").isLiteral()}};r.Directive=g;var v={checkPath:function(e){return e.node&&!!e.node.loc}};r.User=v;var b={checkPath:function(e){return!e.isUser()}};r.Generated=b;var E={types:["Flow","ImportDeclaration","ExportDeclaration"],checkPath:function(e){var t=e.node;return o.isFlow(t)?!0:o.isImportDeclaration(t)?"type"===t.importKind||"typeof"===t.importKind:o.isExportDeclaration(t)?"type"===t.exportKind:!1}};r.Flow=E},{179:179,62:62}],163:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertBefore(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key)this.node&&e.push(this.node),this.replaceExpressionWithStatements(e);else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertBefore(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.push(this.node),this.node=this.container[this.key]=x.blockStatement(e)}return[this]}function s(e,t){this.updateSiblingKeys(e,t.length);for(var r=[],n=0;n<t.length;n++){var i=e+n,a=t[n];if(this.container.splice(i,0,a),this.context){var s=this.context.create(this.parent,this.container,i,this.listKey);r.push(s),this.queueNode(s)}else r.push(b["default"].get({parentPath:this,parent:a,container:this.container,listKey:this.listKey,key:i}))}return r}function o(e){return this._containerInsert(this.key,e)}function u(e){return this._containerInsert(this.key+1,e)}function p(e){var t=e[e.length-1];x.isExpressionStatement(t)&&x.isIdentifier(t.expression)&&!this.isCompletionRecord()&&e.pop()}function l(e){if(this._assertUnremoved(),e=this._verifyNodeList(e),this.parentPath.isExpressionStatement()||this.parentPath.isLabeledStatement())return this.parentPath.insertAfter(e);if(this.isNodeType("Expression")||this.parentPath.isForStatement()&&"init"===this.key){if(this.node){var t=this.scope.generateDeclaredUidIdentifier();e.unshift(x.expressionStatement(x.assignmentExpression("=",t,this.node))),e.push(x.expressionStatement(t))}this.replaceExpressionWithStatements(e)}else{if(this._maybePopFromStatements(e),Array.isArray(this.container))return this._containerInsertAfter(e);if(!this.isStatementOrBlock())throw new Error("We don't know what to do with this node type. We were previously a Statement but we can't fit in here?");this.node&&e.unshift(this.node),this.node=this.container[this.key]=x.blockStatement(e)}return[this]}function c(e,t){for(var r=this.parent._paths,n=0;n<r.length;n++){var i=r[n];i.key>=e&&(i.key+=t)}}function f(e){e.constructor!==Array&&(e=[e]);for(var t=0;t<e.length;t++){var r=e[t];if(!r)throw new Error("Node list has falsy node with the index of "+t);if("object"!=typeof r)throw new Error("Node list contains a non-object node with the index of "+t);if(!r.type)throw new Error("Node list contains a node without a type with the index of "+t);r instanceof b["default"]&&(e[t]=r.node)}return e}function d(e,t){this._assertUnremoved(),t=this._verifyNodeList(t);var r=this.node[e],n=b["default"].get({parentPath:this,parent:this.node,container:r,listKey:e,key:0});return n.insertBefore(t)}function h(e,t){this._assertUnremoved(),t=this._verifyNodeList(t);var r=this.node[e],n=r.length,i=b["default"].get({parentPath:this,parent:this.node,container:r,listKey:e,key:n});return i.replaceWith(t,!0)}function m(){var e=arguments.length<=0||void 0===arguments[0]?this.scope:arguments[0],t=new g["default"](this,e);return t.run()}r.__esModule=!0,r.insertBefore=a,r._containerInsert=s,r._containerInsertBefore=o,r._containerInsertAfter=u,r._maybePopFromStatements=p,r.insertAfter=l,r.updateSiblingKeys=c,r._verifyNodeList=f,r.unshiftContainer=d,r.pushContainer=h,r.hoist=m;var y=e(160),g=i(y),v=e(155),b=i(v),E=e(179),x=n(E)},{155:155,160:160,179:179}],164:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(){return console.trace("Path#remove has been renamed to Path#dangerouslyRemove, removing a node is extremely dangerous so please refrain using it."),this.dangerouslyRemove()}function a(){return this._assertUnremoved(),this.resync(),this._callRemovalHooks("pre")?void this._markRemoved():(this.shareCommentsWithSiblings(),this._remove(),this._markRemoved(),void this._callRemovalHooks("post"))}function s(e){for(var t=c[e],r=0;r<t.length;r++){var n=t[r];if(n(this,this.parentPath))return!0}}function o(){Array.isArray(this.container)?(this.container.splice(this.key,1),this.updateSiblingKeys(this.key,-1)):this.container[this.key]=null}function u(){this.shouldSkip=!0,this.removed=!0,this.node=null}function p(){if(this.removed)throw this.errorWithNode("NodePath has been removed so is read-only.")}r.__esModule=!0,r.remove=i,r.dangerouslyRemove=a,r._callRemovalHooks=s,r._remove=o,r._markRemoved=u,r._assertUnremoved=p;var l=e(161),c=n(l)},{161:161}],165:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){this.resync(),e=this._verifyNodeList(e),b.inheritLeadingComments(e[0],this.node),b.inheritTrailingComments(e[e.length-1],this.node),this.node=this.container[this.key]=null,this.insertAfter(e),this.node||this.dangerouslyRemove()}function s(e){this.resync();try{e="("+e+")",e=g["default"](e)}catch(t){var r=t.loc;throw r&&(t.message+=" - make sure this is an expression.",t.message+="\n"+c["default"](e,r.line,r.column+1)),t}return e=e.program.body[0].expression,d["default"].removeProperties(e),this.replaceWith(e)}function o(e,t){if(this.resync(),this.removed)throw new Error("You can't replace this node, we've already removed it");if(e instanceof m["default"]&&(e=e.node),!e)throw new Error("You passed `path.replaceWith()` a falsy node, use `path.dangerouslyRemove()` instead");if(this.node!==e){if(this.isProgram()&&!b.isProgram(e))throw new Error("You can only replace a Program root node with another Program node");if(b.isProgram(e)&&!this.isProgram()&&(e=e.body,t=!0),Array.isArray(e)){if(t)return this.replaceWithMultiple(e);throw new Error("Don't use `path.replaceWith()` with an array of nodes, use `path.replaceWithMultiple()`")}if("string"==typeof e)return this.replaceWithSourceString();if(this.isNodeType("Statement")&&b.isExpression(e)&&(this.canHaveVariableDeclarationOrExpression()||this.canSwapBetweenExpressionAndStatement(e)||(e=b.expressionStatement(e))),this.isNodeType("Expression")&&b.isStatement(e)&&!this.canSwapBetweenExpressionAndStatement(e))return this.replaceExpressionWithStatements([e]);var r=this.node;r&&b.inheritsComments(e,r),this.node=this.container[this.key]=e,this.type=e.type,this.setScope()}}function u(e){this.resync();var t=b.toSequenceExpression(e,this.scope);if(t)return this.replaceWith(t);var r=b.functionExpression(null,[],b.blockStatement(e));r.shadow=!0,this.replaceWith(b.callExpression(r,[])),this.traverse(E);for(var n=this.get("callee").getCompletionRecords(),i=n,a=0;a<i.length;a++){var s=i[a];if(s.isExpressionStatement()){var o=s.findParent(function(e){return e.isLoop()});if(o){var u=this.get("callee").scope.generateDeclaredUidIdentifier("ret");this.get("callee.body").pushContainer("body",b.returnStatement(u)),s.get("expression").replaceWith(b.assignmentExpression("=",u,s.node.expression))}else s.replaceWith(b.returnStatement(s.node.expression))}}return this.node}function p(e){return this.resync(),Array.isArray(e)?Array.isArray(this.container)?(e=this._verifyNodeList(e),this._containerInsertAfter(e),this.dangerouslyRemove()):this.replaceWithMultiple(e):this.replaceWith(e)}r.__esModule=!0,r.replaceWithMultiple=a,r.replaceWithSourceString=s,r.replaceWith=o,r.replaceExpressionWithStatements=u,r.replaceInline=p;var l=e(38),c=i(l),f=e(148),d=i(f),h=e(155),m=i(h),y=e(42),g=i(y),v=e(179),b=n(v),E={Function:function(){this.skip()},VariableDeclaration:function(e,t,r){if("var"===e.kind){var n=this.getBindingIdentifiers();for(var i in n)r.push({id:n[i]});for(var a=[],s=e.declarations,o=0;o<s.length;o++){var u=s[o];u.init&&a.push(b.expressionStatement(b.assignmentExpression("=",u.id,u.init)))}return a}}}},{148:148,155:155,179:179,38:38,42:42}],166:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=function(){function e(t){var r=t.existing,i=t.identifier,a=t.scope,s=t.path,o=t.kind;n(this,e),this.constantViolations=[],this.constant=!0,this.identifier=i,this.references=0,this.referenced=!1,this.scope=a,this.path=s,this.kind=o,this.hasValue=!1,this.hasDeoptedValue=!1,this.value=null,this.clearValue(),r&&(this.constantViolations=[].concat(r.path,r.constantViolations,this.constantViolations))}return e.prototype.deoptValue=function(){this.clearValue(),this.hasDeoptedValue=!0},e.prototype.setValue=function(e){this.hasDeoptedValue||(this.hasValue=!0,this.value=e)},e.prototype.clearValue=function(){this.hasDeoptedValue=!1,this.hasValue=!1,this.value=null},e.prototype.reassign=function(e){this.constant=!1,this.constantViolations.push(e)},e.prototype.reference=function(){this.referenced=!0,this.references++},e.prototype.dereference=function(){this.references--,this.referenced=!!this.references},e}();r["default"]=i,t.exports=r["default"]},{}],167:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=e(413),u=i(o),p=e(584),l=i(p),c=e(148),f=i(c),d=e(510),h=i(d),m=e(43),y=n(m),g=e(166),v=i(g),b=e(397),E=i(b),x=e(406),S=i(x),A=e(511),D=i(A),C=e(41),w=i(C),I=e(179),_=n(I),F={For:function(){for(var e=_.FOR_INIT_KEYS,t=0;t<e.length;t++){var r=e[t],n=this.get(r);n.isVar()&&this.scope.getFunctionParent().registerBinding("var",n)}},Declaration:function(){this.isBlockScoped()||this.isExportDeclaration()&&this.get("declaration").isDeclaration()||this.scope.getFunctionParent().registerDeclaration(this)},ReferencedIdentifier:function(e,t,r,n){n.references.push(this)},ForXStatement:function(e,t,r,n){var i=this.get("left");(i.isPattern()||i.isIdentifier())&&n.constantViolations.push(i)},ExportDeclaration:{exit:function(e,t,r){var n=e.declaration;if(_.isClassDeclaration(n)||_.isFunctionDeclaration(n)){var i=r.getBinding(n.id.name);i&&i.reference()}else if(_.isVariableDeclaration(n))for(var a=n.declarations,s=0;s<a.length;s++){var o=a[s],u=_.getBindingIdentifiers(o);for(var p in u){var i=r.getBinding(p);i&&i.reference()}}}},LabeledStatement:function(){this.scope.getProgramParent().addGlobal(this.node),this.scope.getBlockParent().registerDeclaration(this)},AssignmentExpression:function(e,t,r,n){n.assignments.push(this)},UpdateExpression:function(e,t,r,n){n.constantViolations.push(this.get("argument"))},UnaryExpression:function(e,t,r,n){"delete"===this.node.operator&&n.constantViolations.push(this.get("argument"))},BlockScoped:function(){var e=this.scope;e.path===this&&(e=e.parent),e.getBlockParent().registerDeclaration(this)},ClassDeclaration:function(){var e=this.node.id.name;this.scope.bindings[e]=this.scope.getBinding(e)},Block:function(){for(var e=this.get("body"),t=e,r=0;r<t.length;r++){var n=t[r];n.isFunctionDeclaration()&&this.scope.getBlockParent().registerDeclaration(n)}}},k={ReferencedIdentifier:function(e,t,r,n){e.name===n.oldName&&(e.name=n.newName)},Scope:function(e,t,r,n){r.bindingIdentifierEquals(n.oldName,n.binding)||this.skip()},"AssignmentExpression|Declaration":function(e,t,r,n){var i=this.getBindingIdentifiers();for(var a in i)a===n.oldName&&(i[a].name=n.newName)}},P=function(){function e(t,r){if(a(this,e),r&&r.block===t.node)return r;var n=t.getData("scope");return n&&n.parent===r&&n.block===t.node?n:(t.setData("scope",this),this.parent=r,this.hub=t.hub,this.parentBlock=t.parent,this.block=t.node,void(this.path=t))}return e.prototype.traverse=function(e,t,r){f["default"](e,t,this,r,this.path)},e.prototype.generateDeclaredUidIdentifier=function(){var e=arguments.length<=0||void 0===arguments[0]?"temp":arguments[0],t=this.generateUidIdentifier(e);return this.push({id:t}),t},e.prototype.generateUidIdentifier=function(e){return _.identifier(this.generateUid(e))},e.prototype.generateUid=function(e){e=_.toIdentifier(e).replace(/^_+/,"");var t,r=0;do t=this._generateUid(e,r),r++;while(this.hasBinding(t)||this.hasGlobal(t)||this.hasReference(t));var n=this.getProgramParent();return n.references[t]=!0,n.uids[t]=!0,t},e.prototype._generateUid=function(e,t){var r=e;return t>1&&(r+=t),"_"+r},e.prototype.generateUidIdentifierBasedOnNode=function(e,t){var r=e;_.isAssignmentExpression(e)?r=e.left:_.isVariableDeclarator(e)?r=e.id:_.isProperty(r)&&(r=r.key);var n=[],i=function s(e){if(_.isModuleDeclaration(e))if(e.source)s(e.source);else if(e.specifiers&&e.specifiers.length)for(var t=e.specifiers,r=0;r<t.length;r++){var i=t[r];s(i)}else e.declaration&&s(e.declaration);else if(_.isModuleSpecifier(e))s(e.local);else if(_.isMemberExpression(e))s(e.object),s(e.property);else if(_.isIdentifier(e))n.push(e.name);else if(_.isLiteral(e))n.push(e.value);else if(_.isCallExpression(e))s(e.callee);else if(_.isObjectExpression(e)||_.isObjectPattern(e))for(var a=e.properties,o=0;o<a.length;o++){var u=a[o];s(u.key||u.argument)}};i(r);var a=n.join("$");return a=a.replace(/^_/,"")||t||"ref",this.generateUidIdentifier(a)},e.prototype.isStatic=function(e){if(_.isThisExpression(e)||_.isSuper(e))return!0;if(_.isIdentifier(e)){var t=this.getBinding(e.name);return t?t.constant:this.hasBinding(e.name)}return!1},e.prototype.maybeGenerateMemoised=function(e,t){if(this.isStatic(e))return null;var r=this.generateUidIdentifierBasedOnNode(e);return t||this.push({id:r}),r},e.prototype.checkBlockScopedCollisions=function(e,t,r,n){if("param"!==t&&("hoisted"!==t||"let"!==e.kind)){var i=!1;if(i||(i="let"===t||"let"===e.kind||"const"===e.kind||"module"===e.kind),i||(i="param"===e.kind&&("let"===t||"const"===t)),i)throw this.hub.file.errorWithNode(n,y.get("scopeDuplicateDeclaration",r),TypeError)}},e.prototype.rename=function(e,t,r){t=t||this.generateUidIdentifier(e).name;var n=this.getBinding(e);if(n){var i={newName:t,oldName:e,binding:n.identifier,info:n},a=n.scope;a.traverse(r||a.block,k,i),r||(a.removeOwnBinding(e),a.bindings[t]=n,i.binding.name=t);var s=this.hub.file;s&&this._renameFromMap(s.moduleFormatter.localImports,e,t,i.binding)}},e.prototype._renameFromMap=function(e,t,r,n){e[t]&&(e[r]=n,e[t]=null)},e.prototype.dump=function(){var e=l["default"]("-",60);console.log(e);var t=this;do{console.log("#",t.block.type);for(var r in t.bindings){var n=t.bindings[r];console.log(" -",r,{constant:n.constant,references:n.references,kind:n.kind})}}while(t=t.parent);console.log(e)},e.prototype.toArray=function(e,t){var r=this.hub.file;if(_.isIdentifier(e)){var n=this.getBinding(e.name);if(n&&n.constant&&n.path.isGenericType("Array"))return e}if(_.isArrayExpression(e))return e;if(_.isIdentifier(e,{name:"arguments"}))return _.callExpression(_.memberExpression(r.addHelper("slice"),_.identifier("call")),[e]);var i="to-array",a=[e];return t===!0?i="to-consumable-array":t&&(a.push(_.literal(t)),i="sliced-to-array",this.hub.file.isLoose("es6.forOf")&&(i+="-loose")),_.callExpression(r.addHelper(i),a)},e.prototype.registerDeclaration=function(e){if(e.isLabeledStatement())this.registerBinding("label",e);else if(e.isFunctionDeclaration())this.registerBinding("hoisted",e.get("id"));else if(e.isVariableDeclaration())for(var t=e.get("declarations"),r=t,n=0;n<r.length;n++){var i=r[n];this.registerBinding(e.node.kind,i)}else if(e.isClassDeclaration())this.registerBinding("let",e);else if(e.isImportDeclaration())for(var a=e.get("specifiers"),s=a,o=0;o<s.length;o++){var u=s[o];this.registerBinding("module",u)}else if(e.isExportDeclaration()){var i=e.get("declaration");(i.isClassDeclaration()||i.isFunctionDeclaration()||i.isVariableDeclaration())&&this.registerDeclaration(i)}else this.registerBinding("unknown",e)},e.prototype.registerConstantViolation=function(e){var t=e.getBindingIdentifiers();for(var r in t){var n=this.getBinding(r);n&&n.reassign(e)}},e.prototype.registerBinding=function(e,t){if(!e)throw new ReferenceError("no `kind`");if(t.isVariableDeclaration())for(var r=t.get("declarations"),n=r,i=0;i<n.length;i++){var a=n[i];this.registerBinding(e,a)}else{var s=this.getProgramParent(),o=t.getBindingIdentifiers(!0);for(var u in o)for(var p=o[u],l=0;l<p.length;l++){var c=p[l],f=this.getOwnBinding(u);if(f){if(f.identifier===c)continue;this.checkBlockScopedCollisions(f,e,u,c)}s.references[u]=!0,this.bindings[u]=new v["default"]({identifier:c,existing:f,scope:this,path:t,kind:e})}}},e.prototype.addGlobal=function(e){this.globals[e.name]=e},e.prototype.hasUid=function(e){var t=this;do if(t.uids[e])return!0;while(t=t.parent);return!1},e.prototype.hasGlobal=function(e){var t=this;do if(t.globals[e])return!0;while(t=t.parent);return!1},e.prototype.hasReference=function(e){var t=this;do if(t.references[e])return!0;while(t=t.parent);return!1},e.prototype.isPure=function(e,t){if(_.isIdentifier(e)){var r=this.getBinding(e.name);return r?t?r.constant:!0:!1}if(_.isClass(e))return!e.superClass||this.isPure(e.superClass,t);if(_.isBinary(e))return this.isPure(e.left,t)&&this.isPure(e.right,t);if(_.isArrayExpression(e)){for(var n=e.elements,i=0;i<n.length;i++){var a=n[i];if(!this.isPure(a,t))return!1}return!0}if(_.isObjectExpression(e)){for(var s=e.properties,o=0;o<s.length;o++){var u=s[o];if(!this.isPure(u,t))return!1}return!0}return _.isProperty(e)?e.computed&&!this.isPure(e.key,t)?!1:this.isPure(e.value,t):_.isPure(e)},e.prototype.setData=function(e,t){return this.data[e]=t},e.prototype.getData=function(e){var t=this;do{var r=t.data[e];
if(null!=r)return r}while(t=t.parent)},e.prototype.removeData=function(e){var t=this;do{var r=t.data[e];null!=r&&(t.data[e]=null)}while(t=t.parent)},e.prototype.init=function(){this.references||this.crawl()},e.prototype.crawl=function(){var e=this.path,t=this.block._scopeInfo;if(t)return D["default"](this,t);if(t=this.block._scopeInfo={references:w["default"](),bindings:w["default"](),globals:w["default"](),uids:w["default"](),data:w["default"]()},D["default"](this,t),e.isLoop())for(var r=_.FOR_INIT_KEYS,n=0;n<r.length;n++){var i=r[n],a=e.get(i);a.isBlockScoped()&&this.registerBinding(a.node.kind,a)}if(e.isFunctionExpression()&&e.has("id")&&this.registerBinding("local",e),e.isClassExpression()&&e.has("id")&&this.registerBinding("local",e),e.isFunction())for(var s=e.get("params"),o=s,u=0;u<o.length;u++){var p=o[u];this.registerBinding("param",p)}e.isCatchClause()&&this.registerBinding("let",e),e.isComprehensionExpression()&&this.registerBinding("let",e);var l=this.getProgramParent();if(!l.crawling){var c={references:[],constantViolations:[],assignments:[]};this.crawling=!0,e.traverse(F,c),this.crawling=!1;for(var f=c.assignments,d=Array.isArray(f),h=0,f=d?f:f[Symbol.iterator]();;){var m;if(d){if(h>=f.length)break;m=f[h++]}else{if(h=f.next(),h.done)break;m=h.value}var y=m,g=y.getBindingIdentifiers(),v=void 0;for(var b in g)y.scope.getBinding(b)||(v=v||y.scope.getProgramParent(),v.addGlobal(g[b]));y.scope.registerConstantViolation(y)}for(var E=c.references,x=Array.isArray(E),S=0,E=x?E:E[Symbol.iterator]();;){var A;if(x){if(S>=E.length)break;A=E[S++]}else{if(S=E.next(),S.done)break;A=S.value}var C=A,I=C.scope.getBinding(C.node.name);I?I.reference(C):C.scope.getProgramParent().addGlobal(C.node)}for(var k=c.constantViolations,P=Array.isArray(k),B=0,k=P?k:k[Symbol.iterator]();;){var T;if(P){if(B>=k.length)break;T=k[B++]}else{if(B=k.next(),B.done)break;T=B.value}var M=T;M.scope.registerConstantViolation(M)}}},e.prototype.push=function(e){var t=this.path;t.isSwitchStatement()&&(t=this.getFunctionParent().path),(t.isLoop()||t.isCatchClause()||t.isFunction())&&(_.ensureBlock(t.node),t=t.get("body")),t.isBlockStatement()||t.isProgram()||(t=this.getBlockParent().path);var r=e.unique,n=e.kind||"var",i=null==e._blockHoist?2:e._blockHoist,a="declaration:"+n+":"+i,s=!r&&t.getData(a);if(!s){var o=_.variableDeclaration(n,[]);o._generated=!0,o._blockHoist=i,this.hub.file.attachAuxiliaryComment(o);var u=t.unshiftContainer("body",[o]);s=u[0],r||t.setData(a,s)}var p=_.variableDeclarator(e.id,e.init);s.node.declarations.push(p),this.registerBinding(n,s.get("declarations").pop())},e.prototype.getProgramParent=function(){var e=this;do if(e.path.isProgram())return e;while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getFunctionParent=function(){var e=this;do if(e.path.isFunctionParent())return e;while(e=e.parent);throw new Error("We couldn't find a Function or Program...")},e.prototype.getBlockParent=function(){var e=this;do if(e.path.isBlockParent())return e;while(e=e.parent);throw new Error("We couldn't find a BlockStatement, For, Switch, Function, Loop or Program...")},e.prototype.getAllBindings=function(){var e=w["default"](),t=this;do h["default"](e,t.bindings),t=t.parent;while(t);return e},e.prototype.getAllBindingsOfKind=function(){for(var e=w["default"](),t=arguments,r=0;r<t.length;r++){var n=t[r],i=this;do{for(var a in i.bindings){var s=i.bindings[a];s.kind===n&&(e[a]=s)}i=i.parent}while(i)}return e},e.prototype.bindingIdentifierEquals=function(e,t){return this.getBindingIdentifier(e)===t},e.prototype.getBinding=function(e){var t=this;do{var r=t.getOwnBinding(e);if(r)return r}while(t=t.parent)},e.prototype.getOwnBinding=function(e){return this.bindings[e]},e.prototype.getBindingIdentifier=function(e){var t=this.getBinding(e);return t&&t.identifier},e.prototype.getOwnBindingIdentifier=function(e){var t=this.bindings[e];return t&&t.identifier},e.prototype.hasOwnBinding=function(e){return!!this.getOwnBinding(e)},e.prototype.hasBinding=function(t,r){return t?this.hasOwnBinding(t)?!0:this.parentHasBinding(t,r)?!0:this.hasUid(t)?!0:!r&&u["default"](e.globals,t)?!0:!r&&u["default"](e.contextVariables,t)?!0:!1:!1},e.prototype.parentHasBinding=function(e,t){return this.parent&&this.parent.hasBinding(e,t)},e.prototype.moveBindingTo=function(e,t){var r=this.getBinding(e);r&&(r.scope.removeOwnBinding(e),r.scope=t,t.bindings[e]=r)},e.prototype.removeOwnBinding=function(e){delete this.bindings[e]},e.prototype.removeBinding=function(e){var t=this.getBinding(e);t&&t.scope.removeOwnBinding(e);var r=this;do r.uids[e]&&(r.uids[e]=!1);while(r=r.parent)},s(e,null,[{key:"globals",value:S["default"]([E["default"].builtin,E["default"].browser,E["default"].node].map(Object.keys)),enumerable:!0},{key:"contextVariables",value:["arguments","undefined","Infinity","NaN"],enumerable:!0}]),e}();r["default"]=P,t.exports=r["default"]},{148:148,166:166,179:179,397:397,406:406,41:41,413:413,43:43,510:510,511:511,584:584}],168:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function a(e){if(e._exploded)return e;e._exploded=!0;for(var t in e)if(!c(t)){var r=t.split("|");if(1!==r.length){var n=e[t];delete e[t];for(var i=r,a=0;a<i.length;a++){var o=i[a];e[o]=n}}}s(e),delete e.__esModule,u(e),p(e);for(var d=Object.keys(e),m=0;m<d.length;m++){var t=d[m];if(!c(t)){var y=h[t];if(y){var n=e[t];for(var g in n)n[g]=l(y,n[g]);if(delete e[t],y.types)for(var b=y.types,x=0;x<b.length;x++){var g=b[x];e[g]?f(e[g],n):e[g]=n}else f(e,n)}}}for(var t in e)if(!c(t)){var n=e[t],S=v.FLIPPED_ALIAS_KEYS[t];if(S){delete e[t];for(var A=S,D=0;D<A.length;D++){var C=A[D],w=e[C];w?f(w,n):e[C]=E["default"](n)}}}for(var t in e)c(t)||p(e[t]);return e}function s(e){if(!e._verified){if("function"==typeof e)throw new Error(y.get("traverseVerifyRootFunction"));for(var t in e)if(!c(t)){if(v.TYPES.indexOf(t)<0)throw new Error(y.get("traverseVerifyNodeType",t));var r=e[t];if("object"==typeof r)for(var n in r)if("enter"!==n&&"exit"!==n)throw new Error(y.get("traverseVerifyVisitorProperty",t,n))}e._verified=!0}}function o(e){for(var t={},r=e,n=0;n<r.length;n++){var i=r[n];a(i);for(var s in i){var o=t[s]=t[s]||{};f(o,i[s])}}return t}function u(e){for(var t in e)if(!c(t)){var r=e[t];"function"==typeof r&&(e[t]={enter:r})}}function p(e){e.enter&&!Array.isArray(e.enter)&&(e.enter=[e.enter]),e.exit&&!Array.isArray(e.exit)&&(e.exit=[e.exit])}function l(e,t){return function(){return e.checkPath(this)?t.apply(this,arguments):void 0}}function c(e){return"_"===e[0]?!0:"enter"===e||"exit"===e||"shouldSkip"===e?!0:"blacklist"===e||"noScope"===e||"skipKeys"===e?!0:!1}function f(e,t){for(var r in t)e[r]=[].concat(e[r]||[],t[r])}r.__esModule=!0,r.explode=a,r.verify=s,r.merge=o;var d=e(162),h=i(d),m=e(43),y=i(m),g=e(179),v=i(g),b=e(494),E=n(b)},{162:162,179:179,43:43,494:494}],169:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e){var t=arguments.length<=1||void 0===arguments[1]?e.key||e.property:arguments[1];return function(){return e.computed||C.isIdentifier(t)&&(t=C.literal(t.name)),t}()}function s(e,t){function r(e){for(var t=!1,a=[],s=e,o=0;o<s.length;o++){var u=s[o];if(C.isExpression(u))a.push(u);else if(C.isExpressionStatement(u))a.push(u.expression);else{if(C.isVariableDeclaration(u)){if("var"!==u.kind)return i=!0;for(var p=u.declarations,l=0;l<p.length;l++){var c=p[l],f=C.getBindingIdentifiers(c);for(var d in f)n.push({kind:u.kind,id:f[d]});c.init&&a.push(C.assignmentExpression("=",c.id,c.init))}t=!0;continue}if(C.isIfStatement(u)){var h=u.consequent?r([u.consequent]):C.identifier("undefined"),m=u.alternate?r([u.alternate]):C.identifier("undefined");if(!h||!m)return i=!0;a.push(C.conditionalExpression(u.test,h,m))}else{if(!C.isBlockStatement(u)){if(C.isEmptyStatement(u)){t=!0;continue}return i=!0}a.push(r(u.body))}}t=!1}return t&&a.push(C.identifier("undefined")),1===a.length?a[0]:C.sequenceExpression(a)}var n=[],i=!1,a=r(e);if(!i){for(var s=0;s<n.length;s++)t.push(n[s]);return a}}function o(e){var t=arguments.length<=1||void 0===arguments[1]?e.key:arguments[1];return function(){var r;return"method"===e.kind?o.uid++:(r=C.isIdentifier(t)?t.name:C.isLiteral(t)?JSON.stringify(t.value):JSON.stringify(A["default"].removeProperties(C.cloneDeep(t))),e.computed&&(r="["+r+"]"),r)}()}function u(e){return C.isIdentifier(e)?e.name:(e+="",e=e.replace(/[^a-zA-Z0-9$_]/g,"-"),e=e.replace(/^[-0-9]+/,""),e=e.replace(/[-\s]+(.)?/g,function(e,t){return t?t.toUpperCase():""}),C.isValidIdentifier(e)||(e="_"+e),e||"_")}function p(e){return e=u(e),("eval"===e||"arguments"===e)&&(e="_"+e),e}function l(e,t){if(C.isStatement(e))return e;var r,n=!1;if(C.isClass(e))n=!0,r="ClassDeclaration";else if(C.isFunction(e))n=!0,r="FunctionDeclaration";else if(C.isAssignmentExpression(e))return C.expressionStatement(e);if(n&&!e.id&&(r=!1),!r){if(t)return!1;throw new Error("cannot turn "+e.type+" to a statement")}return e.type=r,e}function c(e){if(C.isExpressionStatement(e)&&(e=e.expression),C.isClass(e)?e.type="ClassExpression":C.isFunction(e)&&(e.type="FunctionExpression"),C.isExpression(e))return e;throw new Error("cannot turn "+e.type+" to an expression")}function f(e,t){return C.isBlockStatement(e)?e:(C.isEmptyStatement(e)&&(e=[]),Array.isArray(e)||(C.isStatement(e)||(e=C.isFunction(t)?C.returnStatement(e):C.expressionStatement(e)),e=[e]),C.blockStatement(e))}function d(e){if(void 0===e)return C.identifier("undefined");if(e===!0||e===!1||null===e||x["default"](e)||g["default"](e)||b["default"](e))return C.literal(e);if(Array.isArray(e))return C.arrayExpression(e.map(C.valueToNode));if(m["default"](e)){var t=[];for(var r in e){var n;n=C.isValidIdentifier(r)?C.identifier(r):C.literal(r),t.push(C.property("init",n,C.valueToNode(e[r])))}return C.objectExpression(t)}throw new Error("don't know how to turn this value into a node")}r.__esModule=!0,r.toComputedKey=a,r.toSequenceExpression=s,r.toKeyAlias=o,r.toIdentifier=u,r.toBindingIdentifierName=p,r.toStatement=l,r.toExpression=c,r.toBlock=f,r.valueToNode=d;var h=e(504),m=i(h),y=e(502),g=i(y),v=e(505),b=i(v),E=e(506),x=i(E),S=e(148),A=i(S),D=e(179),C=n(D);o.uid=0},{148:148,179:179,502:502,504:504,505:505,506:506}],170:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("ArrayExpression",{visitor:["elements"],aliases:["Expression"]}),a["default"]("AssignmentExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Expression"]}),a["default"]("BinaryExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"]}),a["default"]("BlockStatement",{visitor:["body"],aliases:["Scopable","BlockParent","Block","Statement"]}),a["default"]("BreakStatement",{visitor:["label"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("CallExpression",{visitor:["callee","arguments"],aliases:["Expression"]}),a["default"]("CatchClause",{visitor:["param","body"],aliases:["Scopable"]}),a["default"]("ConditionalExpression",{visitor:["test","consequent","alternate"],aliases:["Expression"]}),a["default"]("ContinueStatement",{visitor:["label"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("DebuggerStatement",{aliases:["Statement"]}),a["default"]("DoWhileStatement",{visitor:["body","test"],aliases:["Statement","BlockParent","Loop","While","Scopable"]}),a["default"]("EmptyStatement",{aliases:["Statement"]}),a["default"]("ExpressionStatement",{visitor:["expression"],aliases:["Statement"]}),a["default"]("File",{builder:["program","comments","tokens"],visitor:["program"]}),a["default"]("ForInStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"]}),a["default"]("ForStatement",{visitor:["init","test","update","body"],aliases:["Scopable","Statement","For","BlockParent","Loop"]}),a["default"]("FunctionDeclaration",{builder:{id:null,params:null,body:null,generator:!1,async:!1},visitor:["id","params","body","returnType","typeParameters"],aliases:["Scopable","Function","Func","BlockParent","FunctionParent","Statement","Pure","Declaration"]}),a["default"]("FunctionExpression",{builder:{id:null,params:null,body:null,generator:!1,async:!1},visitor:["id","params","body","returnType","typeParameters"],aliases:["Scopable","Function","Func","BlockParent","FunctionParent","Expression","Pure"]}),a["default"]("Identifier",{builder:["name"],visitor:["typeAnnotation"],aliases:["Expression"]}),a["default"]("IfStatement",{visitor:["test","consequent","alternate"],aliases:["Statement"]}),a["default"]("LabeledStatement",{visitor:["label","body"],aliases:["Statement"]}),a["default"]("Literal",{builder:["value"],aliases:["Expression","Pure"]}),a["default"]("LogicalExpression",{builder:["operator","left","right"],visitor:["left","right"],aliases:["Binary","Expression"]}),a["default"]("MemberExpression",{builder:{object:null,property:null,computed:!1},visitor:["object","property"],aliases:["Expression"]}),a["default"]("NewExpression",{visitor:["callee","arguments"],aliases:["Expression"]}),a["default"]("ObjectExpression",{visitor:["properties"],aliases:["Expression"]}),a["default"]("Program",{visitor:["body"],aliases:["Scopable","BlockParent","Block","FunctionParent"]}),a["default"]("Property",{builder:{kind:"init",key:null,value:null,computed:!1},visitor:["key","value","decorators"],aliases:["UserWhitespacable"]}),a["default"]("RestElement",{visitor:["argument","typeAnnotation"]}),a["default"]("ReturnStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("SequenceExpression",{visitor:["expressions"],aliases:["Expression"]}),a["default"]("SwitchCase",{visitor:["test","consequent"]}),a["default"]("SwitchStatement",{visitor:["discriminant","cases"],aliases:["Statement","BlockParent","Scopable"]}),a["default"]("ThisExpression",{aliases:["Expression"]}),a["default"]("ThrowStatement",{visitor:["argument"],aliases:["Statement","Terminatorless","CompletionStatement"]}),a["default"]("TryStatement",{builder:["block","handler","finalizer"],visitor:["block","handlers","handler","guardedHandlers","finalizer"],aliases:["Statement"]}),a["default"]("UnaryExpression",{builder:{operator:null,argument:null,prefix:!1},visitor:["argument"],aliases:["UnaryLike","Expression"]}),a["default"]("UpdateExpression",{builder:{operator:null,argument:null,prefix:!1},visitor:["argument"],aliases:["Expression"]}),a["default"]("VariableDeclaration",{builder:["kind","declarations"],visitor:["declarations"],aliases:["Statement","Declaration"]}),a["default"]("VariableDeclarator",{visitor:["id","init"]}),a["default"]("WhileStatement",{visitor:["test","body"],aliases:["Statement","BlockParent","Loop","While","Scopable"]}),a["default"]("WithStatement",{visitor:["object","body"],aliases:["Statement"]})},{174:174}],171:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("AssignmentPattern",{visitor:["left","right"],aliases:["Pattern"]}),a["default"]("ArrayPattern",{visitor:["elements","typeAnnotation"],aliases:["Pattern"]}),a["default"]("ArrowFunctionExpression",{builder:["params","body","async"],visitor:["params","body","returnType"],aliases:["Scopable","Function","Func","BlockParent","FunctionParent","Expression","Pure"]}),a["default"]("ClassBody",{visitor:["body"]}),a["default"]("ClassDeclaration",{visitor:["id","body","superClass","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Statement","Declaration"]}),a["default"]("ClassExpression",{visitor:["id","body","superClass","typeParameters","superTypeParameters","implements","decorators"],aliases:["Scopable","Class","Expression"]}),a["default"]("ExportAllDeclaration",{visitor:["source","exported"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"]}),a["default"]("ExportDefaultDeclaration",{visitor:["declaration"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"]}),a["default"]("ExportNamedDeclaration",{visitor:["declaration","specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration","ExportDeclaration"]}),a["default"]("ExportDefaultSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"]}),a["default"]("ExportNamespaceSpecifier",{visitor:["exported"],aliases:["ModuleSpecifier"]}),a["default"]("ExportSpecifier",{visitor:["local","exported"],aliases:["ModuleSpecifier"]}),a["default"]("ForOfStatement",{visitor:["left","right","body"],aliases:["Scopable","Statement","For","BlockParent","Loop","ForXStatement"]}),a["default"]("ImportDeclaration",{visitor:["specifiers","source"],aliases:["Statement","Declaration","ModuleDeclaration"]}),a["default"]("ImportDefaultSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"]}),a["default"]("ImportNamespaceSpecifier",{visitor:["local"],aliases:["ModuleSpecifier"]}),a["default"]("ImportSpecifier",{visitor:["local","imported"],aliases:["ModuleSpecifier"]}),a["default"]("MetaProperty",{visitor:["meta","property"],aliases:["Expression"]}),a["default"]("MethodDefinition",{builder:{key:null,value:null,kind:"method",computed:!1,"static":!1},visitor:["key","value","decorators"]}),a["default"]("ObjectPattern",{visitor:["properties","typeAnnotation"],aliases:["Pattern"]}),a["default"]("SpreadElement",{visitor:["argument"],aliases:["UnaryLike"]}),a["default"]("Super",{aliases:["Expression"]}),a["default"]("TaggedTemplateExpression",{visitor:["tag","quasi"],aliases:["Expression"]}),a["default"]("TemplateElement"),a["default"]("TemplateLiteral",{visitor:["quasis","expressions"],aliases:["Expression"]}),a["default"]("YieldExpression",{builder:["argument","delegate"],visitor:["argument"],aliases:["Expression","Terminatorless"]})},{174:174}],172:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("AwaitExpression",{builder:["argument","all"],visitor:["argument"],aliases:["Expression","Terminatorless"]}),a["default"]("BindExpression",{visitor:["object","callee"]}),a["default"]("ComprehensionBlock",{visitor:["left","right"]}),a["default"]("ComprehensionExpression",{visitor:["filter","blocks","body"],aliases:["Expression","Scopable"]}),a["default"]("Decorator",{visitor:["expression"]}),a["default"]("DoExpression",{visitor:["body"],aliases:["Expression"]}),a["default"]("SpreadProperty",{visitor:["argument"],aliases:["UnaryLike"]})},{174:174}],173:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("AnyTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("ArrayTypeAnnotation",{visitor:["elementType"],aliases:["Flow"]}),a["default"]("BooleanTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("BooleanLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("ClassImplements",{visitor:["id","typeParameters"],aliases:["Flow"]}),a["default"]("ClassProperty",{visitor:["key","value","typeAnnotation","decorators"],aliases:["Flow"]}),a["default"]("DeclareClass",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareFunction",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareModule",{visitor:["id","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("DeclareVariable",{visitor:["id"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("FunctionTypeAnnotation",{visitor:["typeParameters","params","rest","returnType"],aliases:["Flow"]}),a["default"]("FunctionTypeParam",{visitor:["name","typeAnnotation"],aliases:["Flow"]}),a["default"]("GenericTypeAnnotation",{visitor:["id","typeParameters"],aliases:["Flow"]}),a["default"]("InterfaceExtends",{visitor:["id","typeParameters"],aliases:["Flow"]}),a["default"]("InterfaceDeclaration",{visitor:["id","typeParameters","extends","body"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("IntersectionTypeAnnotation",{visitor:["types"],aliases:["Flow"]}),a["default"]("MixedTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("NullableTypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"]}),a["default"]("NumberLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("NumberTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("StringLiteralTypeAnnotation",{aliases:["Flow"]}),a["default"]("StringTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]}),a["default"]("TupleTypeAnnotation",{visitor:["types"],aliases:["Flow"]}),a["default"]("TypeofTypeAnnotation",{visitor:["argument"],aliases:["Flow"]}),a["default"]("TypeAlias",{visitor:["id","typeParameters","right"],aliases:["Flow","FlowDeclaration","Statement","Declaration"]}),a["default"]("TypeAnnotation",{visitor:["typeAnnotation"],aliases:["Flow"]}),a["default"]("TypeCastExpression",{visitor:["expression","typeAnnotation"],aliases:["Flow"]}),a["default"]("TypeParameterDeclaration",{visitor:["params"],aliases:["Flow"]}),a["default"]("TypeParameterInstantiation",{visitor:["params"],aliases:["Flow"]}),a["default"]("ObjectTypeAnnotation",{visitor:["properties","indexers","callProperties"],aliases:["Flow"]}),a["default"]("ObjectTypeCallProperty",{visitor:["value"],aliases:["Flow","UserWhitespacable"]}),a["default"]("ObjectTypeIndexer",{visitor:["id","key","value"],aliases:["Flow","UserWhitespacable"]}),a["default"]("ObjectTypeProperty",{visitor:["key","value"],aliases:["Flow","UserWhitespacable"]}),a["default"]("QualifiedTypeIdentifier",{visitor:["id","qualification"],aliases:["Flow"]}),a["default"]("UnionTypeAnnotation",{visitor:["types"],aliases:["Flow"]}),a["default"]("VoidTypeAnnotation",{aliases:["Flow","FlowBaseAnnotation"]})},{174:174}],174:[function(e,t,r){"use strict";function n(e){for(var t={},r=e,n=0;n<r.length;n++){var i=r[n];t[i]=null}return t}function i(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.visitor=t.visitor||[],t.aliases=t.aliases||[],t.builder||(t.builder=n(t.visitor)),Array.isArray(t.builder)&&(t.builder=n(t.builder)),a[e]=t.visitor,s[e]=t.aliases,o[e]=t.builder}r.__esModule=!0,r["default"]=i;var a={};r.VISITOR_KEYS=a;var s={};r.ALIAS_KEYS=s;var o={};r.BUILDER_KEYS=o},{}],175:[function(e,t,r){"use strict";e(174),e(170),e(171),e(173),e(176),e(177),e(172)},{170:170,171:171,172:172,173:173,174:174,176:176,177:177}],176:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("JSXAttribute",{visitor:["name","value"],aliases:["JSX","Immutable"]}),a["default"]("JSXClosingElement",{visitor:["name"],aliases:["JSX","Immutable"]}),a["default"]("JSXElement",{visitor:["openingElement","closingElement","children"],aliases:["JSX","Immutable","Expression"]}),a["default"]("JSXEmptyExpression",{aliases:["JSX","Expression"]}),a["default"]("JSXExpressionContainer",{visitor:["expression"],aliases:["JSX","Immutable"]}),a["default"]("JSXIdentifier",{aliases:["JSX","Expression"]}),a["default"]("JSXMemberExpression",{visitor:["object","property"],aliases:["JSX","Expression"]}),a["default"]("JSXNamespacedName",{visitor:["namespace","name"],aliases:["JSX"]}),a["default"]("JSXOpeningElement",{visitor:["name","attributes"],aliases:["JSX","Immutable"]}),a["default"]("JSXSpreadAttribute",{visitor:["argument"],aliases:["JSX"]})},{174:174}],177:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(174),a=n(i);a["default"]("Noop",{visitor:[]}),a["default"]("ParenthesizedExpression",{visitor:["expression"],aliases:["Expression"]})},{174:174}],178:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){var t=a(e);return 1===t.length?t[0]:u.unionTypeAnnotation(t)}function a(e){for(var t={},r={},n=[],i=[],s=0;s<e.length;s++){var o=e[s];if(o&&!(i.indexOf(o)>=0)){if(u.isAnyTypeAnnotation(o))return[o];if(u.isFlowBaseAnnotation(o))r[o.type]=o;else if(u.isUnionTypeAnnotation(o))n.indexOf(o.types)<0&&(e=e.concat(o.types),n.push(o.types));else if(u.isGenericTypeAnnotation(o)){var p=o.id.name;if(t[p]){var l=t[p];l.typeParameters?o.typeParameters&&(l.typeParameters.params=a(l.typeParameters.params.concat(o.typeParameters.params))):l=o.typeParameters}else t[p]=o}else i.push(o)}}for(var c in r)i.push(r[c]);for(var f in t)i.push(t[f]);return i}function s(e){if("string"===e)return u.stringTypeAnnotation();if("number"===e)return u.numberTypeAnnotation();if("undefined"===e)return u.voidTypeAnnotation();if("boolean"===e)return u.booleanTypeAnnotation();if("function"===e)return u.genericTypeAnnotation(u.identifier("Function"));if("object"===e)return u.genericTypeAnnotation(u.identifier("Object"));if("symbol"===e)return u.genericTypeAnnotation(u.identifier("Symbol"));throw new Error("Invalid typeof value")}r.__esModule=!0,r.createUnionTypeAnnotation=i,r.removeTypeDuplicates=a,r.createTypeAnnotationBasedOnTypeof=s;var o=e(179),u=n(o)},{179:179}],179:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){var r=B["is"+e]=function(r,n){return B.is(e,r,n,t)};B["assert"+e]=function(t,n){if(n=n||{},!r(t,n))throw new Error("Expected type "+JSON.stringify(e)+" with option "+JSON.stringify(n))}}function a(e,t,r,n){if(!t)return!1;var i=s(t.type,e);return i?"undefined"==typeof r?!0:B.shallowEqual(t,r):!1}function s(e,t){if(e===t)return!0;var r=B.FLIPPED_ALIAS_KEYS[t];if(r){if(r[0]===e)return!0;for(var n=r,i=0;i<n.length;i++){var a=n[i];if(e===a)return!0}}return!1}function o(e,t){for(var r=Object.keys(t),n=r,i=0;i<n.length;i++){var a=n[i];if(e[a]!==t[a])return!1}return!0}function u(e,t,r){return e.object=B.memberExpression(e.object,e.property,e.computed),e.property=t,e.computed=!!r,e}function p(e,t){return e.object=B.memberExpression(t,e.object),e}function l(e){var t=arguments.length<=1||void 0===arguments[1]?"body":arguments[1];return e[t]=B.toBlock(e[t],e)}function c(e){var t={};for(var r in e)"_"!==r[0]&&(t[r]=e[r]);return t}function f(e){var t={};for(var r in e)if("_"!==r[0]){var n=e[r];n&&(n.type?n=B.cloneDeep(n):Array.isArray(n)&&(n=n.map(B.cloneDeep))),t[r]=n}return t}function d(e,t){var r=e.split(".");return function(e){if(!B.isMemberExpression(e))return!1;for(var n=[e],i=0;n.length;){var a=n.shift();if(t&&i===r.length)return!0;if(B.isIdentifier(a)){if(r[i]!==a.name)return!1}else{if(!B.isLiteral(a)){if(B.isMemberExpression(a)){if(a.computed&&!B.isLiteral(a.property))return!1;n.push(a.object),n.push(a.property);continue}return!1}if(r[i]!==a.value)return!1}if(++i>r.length)return!1}return!0}}function h(e){for(var t=j,r=0;r<t.length;r++){var n=t[r];delete e[n]}return e}function m(e,t){return y(e,t),g(e,t),v(e,t),e}function y(e,t){b("trailingComments",e,t)}function g(e,t){b("leadingComments",e,t)}function v(e,t){b("innerComments",e,t)}function b(e,t,r){t&&r&&(t[e]=k["default"](D["default"]([].concat(t[e],r[e]))))}function E(e,t){if(!e||!t)return e;for(var r=B.INHERIT_KEYS.optional,n=0;n<r.length;n++){var i=r[n];null==e[i]&&(e[i]=t[i])}for(var a=B.INHERIT_KEYS.force,s=0;s<a.length;s++){var i=a[s];e[i]=t[i]}return B.inheritsComments(e,t),e}r.__esModule=!0,r.is=a,r.isType=s,r.shallowEqual=o,r.appendToMemberExpression=u,r.prependToMemberExpression=p,r.ensureBlock=l,r.clone=c,r.cloneDeep=f,r.buildMatchMemberExpression=d,r.removeComments=h,r.inheritsComments=m,r.inheritTrailingComments=y,r.inheritLeadingComments=g,r.inheritInnerComments=v,r.inherits=E;var x=e(600),S=n(x),A=e(405),D=n(A),C=e(509),w=n(C),I=e(411),_=n(I),F=e(409),k=n(F);e(175);var P=e(174),B=r,T=["consequent","body","alternate"];r.STATEMENT_OR_BLOCK_KEYS=T;var M=["body","expressions"];r.FLATTENABLE_KEYS=M;var O=["left","init"];r.FOR_INIT_KEYS=O;var j=["leadingComments","trailingComments","innerComments"];r.COMMENT_KEYS=j;var L={optional:["typeAnnotation","typeParameters","returnType"],force:["_scopeInfo","_paths","start","loc","end"]};r.INHERIT_KEYS=L;var N=[">","<",">=","<="];r.BOOLEAN_NUMBER_BINARY_OPERATORS=N;var R=["==","===","!=","!=="];r.EQUALITY_BINARY_OPERATORS=R;var V=R.concat(["in","instanceof"]);r.COMPARISON_BINARY_OPERATORS=V;var U=[].concat(V,N);r.BOOLEAN_BINARY_OPERATORS=U;var q=["-","/","*","**","&","|",">>",">>>","<<","^"];r.NUMBER_BINARY_OPERATORS=q;var G=["delete","!"];r.BOOLEAN_UNARY_OPERATORS=G;var H=["+","-","++","--","~"];r.NUMBER_UNARY_OPERATORS=H;var W=["typeof"];r.STRING_UNARY_OPERATORS=W,r.VISITOR_KEYS=P.VISITOR_KEYS,r.BUILDER_KEYS=P.BUILDER_KEYS,r.ALIAS_KEYS=P.ALIAS_KEYS,_["default"](B.VISITOR_KEYS,function(e,t){i(t,!0)}),B.FLIPPED_ALIAS_KEYS={},_["default"](B.ALIAS_KEYS,function(e,t){_["default"](e,function(e){var r=B.FLIPPED_ALIAS_KEYS[e]=B.FLIPPED_ALIAS_KEYS[e]||[];r.push(t)})}),_["default"](B.FLIPPED_ALIAS_KEYS,function(e,t){B[t.toUpperCase()+"_TYPES"]=e,i(t,!1)});var X=Object.keys(B.VISITOR_KEYS).concat(Object.keys(B.FLIPPED_ALIAS_KEYS));r.TYPES=X,_["default"](B.VISITOR_KEYS,function(e,t){if(!B.BUILDER_KEYS[t]){var r={};_["default"](e,function(e){r[e]=null}),B.BUILDER_KEYS[t]=r}}),_["default"](B.BUILDER_KEYS,function(e,t){var r=function(){var r={};r.type=t;var n=0;for(var i in e){var a=arguments[n++];void 0===a&&(a=e[i]),r[i]=a}return r};B[t]=r,B[t[0].toLowerCase()+t.slice(1)]=r}),S["default"](B),S["default"](B.VISITOR_KEYS),w["default"](B,e(180)),w["default"](B,e(181)),w["default"](B,e(169)),w["default"](B,e(178))},{169:169,174:174,175:175,178:178,180:180,181:181,405:405,409:409,411:411,509:509,600:600}],180:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e,t){for(var r=[].concat(e),n=Object.create(null);r.length;){var i=r.shift();if(i){var a=s.getBindingIdentifiers.keys[i.type];if(s.isIdentifier(i))if(t){var o=n[i.name]=n[i.name]||[];o.push(i)}else n[i.name]=i;else if(s.isExportDeclaration(i))s.isDeclaration(e.declaration)&&r.push(e.declaration);else if(a)for(var u=0;u<a.length;u++){var p=a[u];i[p]&&(r=r.concat(i[p]))}}}return n}r.__esModule=!0,r.getBindingIdentifiers=i;var a=e(179),s=n(a);i.keys={DeclareClass:["id"],DeclareFunction:["id"],DeclareModule:["id"],DeclareVariable:["id"],InterfaceDeclaration:["id"],TypeAlias:["id"],ComprehensionExpression:["blocks"],ComprehensionBlock:["left"],CatchClause:["param"],LabeledStatement:["label"],UnaryExpression:["argument"],AssignmentExpression:["left"],ImportSpecifier:["local"],ImportNamespaceSpecifier:["local"],ImportDefaultSpecifier:["local"],ImportDeclaration:["specifiers"],FunctionDeclaration:["id","params"],FunctionExpression:["id","params"],ClassDeclaration:["id"],ClassExpression:["id"],RestElement:["argument"],UpdateExpression:["argument"],SpreadProperty:["argument"],Property:["value"],AssignmentPattern:["left"],ArrayPattern:["elements"],ObjectPattern:["properties"],VariableDeclaration:["declarations"],VariableDeclarator:["id"]}},{179:179}],181:[function(e,t,r){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=h.getBindingIdentifiers.keys[t.type];if(r)for(var n=0;n<r.length;n++){var i=r[n],a=t[i];if(Array.isArray(a)){if(a.indexOf(e)>=0)return!0}else if(a===e)return!0}return!1}function s(e,t){switch(t.type){case"MemberExpression":case"JSXMemberExpression":return t.property===e&&t.computed?!0:t.object===e?!0:!1;
case"MetaProperty":return!1;case"Property":if(t.key===e)return t.computed;case"VariableDeclarator":return t.id!==e;case"ArrowFunctionExpression":case"FunctionDeclaration":case"FunctionExpression":for(var r=t.params,n=0;n<r.length;n++){var i=r[n];if(i===e)return!1}return t.id!==e;case"ExportSpecifier":return t.source?!1:t.local===e;case"JSXAttribute":return t.name!==e;case"ClassProperty":return t.value===e;case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"ImportSpecifier":return!1;case"ClassDeclaration":case"ClassExpression":return t.id!==e;case"MethodDefinition":return t.key===e&&t.computed;case"LabeledStatement":return!1;case"CatchClause":return t.param!==e;case"RestElement":return!1;case"AssignmentExpression":return t.right===e;case"AssignmentPattern":return t.right===e;case"ObjectPattern":case"ArrayPattern":return!1}return!0}function o(e){return"string"!=typeof e||y["default"].keyword.isReservedWordES6(e,!0)?!1:y["default"].keyword.isIdentifierNameES6(e)}function u(e){return v.isVariableDeclaration(e)&&("var"!==e.kind||e._let)}function p(e){return v.isFunctionDeclaration(e)||v.isClassDeclaration(e)||v.isLet(e)}function l(e){return v.isVariableDeclaration(e,{kind:"var"})&&!e._let}function c(e){return v.isImportDefaultSpecifier(e)||v.isIdentifier(e.imported||e.exported,{name:"default"})}function f(e,t){return v.isBlockStatement(e)&&v.isFunction(t,{body:e})?!1:v.isScopable(e)}function d(e){return v.isType(e.type,"Immutable")?!0:v.isLiteral(e)?e.regex?!1:!0:v.isIdentifier(e)&&"undefined"===e.name?!0:!1}r.__esModule=!0,r.isBinding=a,r.isReferenced=s,r.isValidIdentifier=o,r.isLet=u,r.isBlockScoped=p,r.isVar=l,r.isSpecifierDefault=c,r.isScope=f,r.isImmutable=d;var h=e(180),m=e(395),y=i(m),g=e(179),v=n(g)},{179:179,180:180,395:395}],182:[function(e,t,r){(function(t){"use strict";function n(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t["default"]=e,t}function i(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){var r=t||a.EXTENSIONS,n=V["default"].extname(e);return _["default"](r,n)}function s(e){return e?Array.isArray(e)?e:"string"==typeof e?e.split(","):[e]:[]}function o(e){if(!e)return new RegExp(/.^/);if(Array.isArray(e)&&(e=new RegExp(e.map(y["default"]).join("|"),"i")),B["default"](e)){e=J["default"](e),(v["default"](e,"./")||v["default"](e,"*/"))&&(e=e.slice(2)),v["default"](e,"**/")&&(e=e.slice(3));var t=w["default"].makeRe(e,{nocase:!0});return new RegExp(t.source.slice(1,-1),"i")}if(M["default"](e))return e;throw new TypeError("illegal type for regexify")}function u(e,t){return e?S["default"](e)?u([e],t):B["default"](e)?u(s(e),t):Array.isArray(e)?(t&&(e=e.map(t)),e):[e]:[]}function p(e){return"true"===e?!0:"false"===e?!1:e}function l(e,t,r){if(e=J["default"](e),r){for(var n=r,i=0;i<n.length;i++){var a=n[i];if(c(a,e))return!1}return!0}if(t.length)for(var s=t,o=0;o<s.length;o++){var a=s[o];if(c(a,e))return!0}return!1}function c(e,t){return"function"==typeof e?e(t):e.test(t)}function f(e,t,n){var i=r.templates[e];if(!i)throw new ReferenceError("unknown template "+e);if(t===!0&&(n=!0,t=null),i=E["default"](i),j["default"](t)||k["default"](i,Q,null,t),i.body.length>1)return i.body;var a=i.body[0];return!n&&X.isExpressionStatement(a)?a.expression:a}function d(e,t){var r=N["default"](t,{filename:e,looseModules:!0}).program;return r=k["default"].removeProperties(r)}function h(){var e={},r=V["default"].join(t,"transformation/templates");if(!K["default"].sync(r))throw new ReferenceError(D.get("missingTemplatesDirectory"));for(var n=H["default"].readdirSync(r),i=0;i<n.length;i++){var a=n[i];if("."===a[0])return;var s=V["default"].basename(a,V["default"].extname(a)),o=V["default"].join(r,a),u=H["default"].readFileSync(o,"utf8");e[s]=d(o,u)}return e}r.__esModule=!0,r.canCompile=a,r.list=s,r.regexify=o,r.arrayify=u,r.booleanify=p,r.shouldIgnore=l,r.template=f,r.parseTemplate=d;var m=e(518),y=i(m),g=e(519),v=i(g),b=e(495),E=i(b),x=e(498),S=i(x),A=e(43),D=n(A),C=e(522),w=i(C),I=e(410),_=i(I),F=e(148),k=i(F),P=e(506),B=i(P),T=e(505),M=i(T),O=e(499),j=i(O),L=e(42),N=i(L),R=e(9),V=i(R),U=e(512),q=i(U),G=e(1),H=i(G),W=e(179),X=n(W),Y=e(588),J=i(Y),z=e(526),K=i(z),$=e(13);r.inherits=$.inherits,r.inspect=$.inspect,a.EXTENSIONS=[".js",".jsx",".es6",".es"];var Q={noScope:!0,enter:function(e,t,r,n){X.isExpressionStatement(e)&&(e=e.expression),X.isIdentifier(e)&&q["default"](n,e.name)&&(this.skip(),this.replaceInline(n[e.name]))},exit:function(e){k["default"].clearNode(e)}};try{r.templates=e(604)}catch(Z){if("MODULE_NOT_FOUND"!==Z.code)throw Z;r.templates=h()}}).call(this,"/lib")},{1:1,13:13,148:148,179:179,410:410,42:42,43:43,495:495,498:498,499:499,505:505,506:506,512:512,518:518,519:519,522:522,526:526,588:588,604:604,9:9}],183:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("constant-folding",{metadata:{group:"builtin-prepass",experimental:!0},visitor:{AssignmentExpression:function(){var e=this.get("left");if(e.isIdentifier()){var t=this.scope.getBinding(e.node.name);if(t&&!t.hasDeoptValue){var r=this.get("right").evaluate();r.confident?t.setValue(r.value):t.deoptValue()}}},IfStatement:function(){var e=this.get("test").evaluate();return e.confident?void(e.value?this.skipKey("alternate"):this.skipKey("consequent")):this.skip()},Scopable:{enter:function(){var e=this.scope.getFunctionParent();for(var t in this.scope.bindings){var r=this.scope.bindings[t],n=!1,i=!0,a=!1,s=void 0;try{for(var o,u=r.constantViolations[Symbol.iterator]();!(i=(o=u.next()).done);i=!0){var p=o.value,l=p.scope.getFunctionParent();if(l!==e){n=!0;break}}}catch(c){a=!0,s=c}finally{try{!i&&u["return"]&&u["return"]()}finally{if(a)throw s}}n&&r.deoptValue()}},exit:function(){for(var e in this.scope.bindings){var t=this.scope.bindings[e];t.clearValue()}}},Expression:{exit:function(){var e=this.evaluate();return e.confident?r.valueToNode(e.value):void 0}}}})},t.exports=r["default"]},{}],184:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){function t(e){if(n.isBlockStatement(e)){for(var t=!1,r=0;r<e.body.length;r++){var i=e.body[r];n.isBlockScoped(i)&&(t=!0)}if(!t)return e.body}return e}var r=e.Plugin,n=e.types,i={ReferencedIdentifier:function(e,t,r){var i=r.getBinding(e.name);if(i&&!(i.references>1)&&i.constant&&"param"!==i.kind&&"module"!==i.kind){var a=i.path.node;if(n.isVariableDeclarator(a)&&(a=a.init),a&&r.isPure(a,!0)&&(!n.isClass(a)&&!n.isFunction(a)||i.path.scope.parent===r)&&!this.findParent(function(e){return e.node===a}))return n.toExpression(a),r.removeBinding(e.name),i.path.dangerouslyRemove(),a}},"ClassDeclaration|FunctionDeclaration":function(e,t,r){var n=r.getBinding(e.id.name);n&&!n.referenced&&this.dangerouslyRemove()},VariableDeclarator:function(e,t,r){n.isIdentifier(e.id)&&r.isPure(e.init,!0)&&i["ClassDeclaration|FunctionDeclaration"].apply(this,arguments)},ConditionalExpression:function(e){var t=this.get("test").evaluateTruthy();return t===!0?e.consequent:t===!1?e.alternate:void 0},BlockStatement:function(){for(var e=this.get("body"),t=!1,r=0;r<e.length;r++){var n=e[r];t||!n.isCompletionStatement()?t&&!n.isFunctionDeclaration()&&n.dangerouslyRemove():t=!0}},IfStatement:{exit:function(e){var r=e.consequent,i=e.alternate,a=e.test,s=this.get("test").evaluateTruthy();return s===!0?t(r):s===!1?i?t(i):this.dangerouslyRemove():(n.isBlockStatement(i)&&!i.body.length&&(i=e.alternate=null),void(n.isBlockStatement(r)&&!r.body.length&&n.isBlockStatement(i)&&i.body.length&&(e.consequent=e.alternate,e.alternate=null,e.test=n.unaryExpression("!",a,!0))))}}};return new r("dead-code-elimination",{metadata:{group:"builtin-pre",experimental:!0},visitor:i})},t.exports=r["default"]},{}],185:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.parse,n=e.traverse;return new t("eval",{metadata:{group:"builtin-pre"},visitor:{CallExpression:function(e){if(this.get("callee").isIdentifier({name:"eval"})&&1===e.arguments.length){var t=this.get("arguments")[0].evaluate();if(!t.confident)return;var i=t.value;if("string"!=typeof i)return;var a=r(i);return n.removeProperties(a),a.program}}}})},t.exports=r["default"]},{}],186:[function(e,t,r){(function(e){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(t){var r=t.Plugin,n=t.types;return new r("inline-environment-variables",{metadata:{group:"builtin-pre"},visitor:{MemberExpression:function(t){if(this.get("object").matchesPattern("process.env")){var r=this.toComputedKey();if(n.isLiteral(r))return n.valueToNode(e.env[r.value])}}}})},t.exports=r["default"]}).call(this,e(10))},{10:10}],187:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("jscript",{metadata:{group:"builtin-trailing"},visitor:{FunctionExpression:{exit:function(e){return e.id?(e._ignoreUserWhitespace=!0,r.callExpression(r.functionExpression(null,[],r.blockStatement([r.toStatement(e),r.returnStatement(e.id)])),[])):void 0}}}})},t.exports=r["default"]},{}],188:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("member-expression-literals",{metadata:{group:"builtin-trailing"},visitor:{MemberExpression:{exit:function(e){var t=e.property;e.computed&&r.isLiteral(t)&&r.isValidIdentifier(t.value)&&(e.property=r.identifier(t.value),e.computed=!1)}}}})},t.exports=r["default"]},{}],189:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("property-literals",{metadata:{group:"builtin-trailing"},visitor:{Property:{exit:function(e){var t=e.key;r.isLiteral(t)&&r.isValidIdentifier(t.value)&&(e.key=r.identifier(t.value),e.computed=!1)}}}})},t.exports=r["default"]},{}],190:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e(408),a=n(i);r["default"]=function(e){function t(e){return s.isLiteral(s.toComputedKey(e,e.key),{value:"__proto__"})}function r(e){var t=e.left;return s.isMemberExpression(t)&&s.isLiteral(s.toComputedKey(t,t.property),{value:"__proto__"})}function n(e,t,r){return s.expressionStatement(s.callExpression(r.addHelper("defaults"),[t,e.right]))}var i=e.Plugin,s=e.types;return new i("proto-to-assign",{metadata:{secondPass:!0},visitor:{AssignmentExpression:function(e,t,i,a){if(r(e)){var o=[],u=e.left.object,p=i.maybeGenerateMemoised(u);return p&&o.push(s.expressionStatement(s.assignmentExpression("=",p,u))),o.push(n(e,p||u,a)),p&&o.push(p),o}},ExpressionStatement:function(e,t,i,a){var o=e.expression;if(s.isAssignmentExpression(o,{operator:"="}))return r(o)?n(o,o.left.object,a):void 0},ObjectExpression:function(e,r,n,i){for(var o,u=0;u<e.properties.length;u++){var p=e.properties[u];t(p)&&(o=p.value,a["default"](e.properties,p))}if(o){var l=[s.objectExpression([]),o];return e.properties.length&&l.push(e),s.callExpression(i.addHelper("extends"),l)}}}})},t.exports=r["default"]},{408:408}],191:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r={enter:function(e,t,r,n){var i=this,a=function(){n.isImmutable=!1,i.stop()};return this.isJSXClosingElement()?void this.skip():this.isJSXIdentifier({name:"ref"})&&this.parentPath.isJSXAttribute({name:e})?a():void(this.isJSXIdentifier()||this.isIdentifier()||this.isJSXMemberExpression()||this.isImmutable()||a())}};return new t("react-constant-elements",{metadata:{group:"builtin-basic"},visitor:{JSXElement:function(e){if(!e._hoisted){var t={isImmutable:!0};this.traverse(r,t),t.isImmutable?this.hoist():e._hoisted=!0}}}})},t.exports=r["default"]},{}],192:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){function t(e,t){for(var r=t.arguments[0].properties,n=!0,a=0;a<r.length;a++){var s=r[a],o=i.toComputedKey(s);if(i.isLiteral(o,{value:"displayName"})){n=!1;break}}n&&r.unshift(i.property("init",i.identifier("displayName"),i.literal(e)))}function r(e){if(!e||!i.isCallExpression(e))return!1;if(!a(e.callee))return!1;var t=e.arguments;if(1!==t.length)return!1;var r=t[0];return i.isObjectExpression(r)?!0:!1}var n=e.Plugin,i=e.types,a=i.buildMatchMemberExpression("React.createClass");return new n("react-display-name",{metadata:{group:"builtin-pre"},visitor:{ExportDefaultDeclaration:function(e,n,i,a){r(e.declaration)&&t(a.opts.basename,e.declaration)},"AssignmentExpression|Property|VariableDeclarator":function(e){var n,a;i.isAssignmentExpression(e)?(n=e.left,a=e.right):i.isProperty(e)?(n=e.key,a=e.value):i.isVariableDeclarator(e)&&(n=e.id,a=e.init),i.isMemberExpression(n)&&(n=n.property),i.isIdentifier(n)&&r(a)&&t(n.name,a)}}})},t.exports=r["default"]},{}],193:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin;e.types;return new t("remove-console",{metadata:{group:"builtin-pre"},visitor:{CallExpression:function(){this.get("callee").matchesPattern("console",!0)&&this.dangerouslyRemove()}}})},t.exports=r["default"]},{}],194:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin;e.types;return new t("remove-debugger",{metadata:{group:"builtin-pre"},visitor:{DebuggerStatement:function(){this.dangerouslyRemove()}}})},t.exports=r["default"]},{}],195:[function(e,t,r){t.exports={builtins:{Symbol:"symbol",Promise:"promise",Map:"map",WeakMap:"weak-map",Set:"set",WeakSet:"weak-set"},methods:{Array:{concat:"array/concat",copyWithin:"array/copy-within",entries:"array/entries",every:"array/every",fill:"array/fill",filter:"array/filter",findIndex:"array/find-index",find:"array/find",forEach:"array/for-each",from:"array/from",includes:"array/includes",indexOf:"array/index-of",join:"array/join",keys:"array/keys",lastIndexOf:"array/last-index-of",map:"array/map",of:"array/of",pop:"array/pop",push:"array/push",reduceRight:"array/reduce-right",reduce:"array/reduce",reverse:"array/reverse",shift:"array/shift",slice:"array/slice",some:"array/some",sort:"array/sort",splice:"array/splice",turn:"array/turn",unshift:"array/unshift",values:"array/values"},Object:{assign:"object/assign",classof:"object/classof",create:"object/create",define:"object/define",defineProperties:"object/define-properties",defineProperty:"object/define-property",entries:"object/entries",freeze:"object/freeze",getOwnPropertyDescriptor:"object/get-own-property-descriptor",getOwnPropertyDescriptors:"object/get-own-property-descriptors",getOwnPropertyNames:"object/get-own-property-names",getOwnPropertySymbols:"object/get-own-property-symbols",getPrototypePf:"object/get-prototype-of",index:"object/index",isExtensible:"object/is-extensible",isFrozen:"object/is-frozen",isObject:"object/is-object",isSealed:"object/is-sealed",is:"object/is",keys:"object/keys",make:"object/make",preventExtensions:"object/prevent-extensions",seal:"object/seal",setPrototypeOf:"object/set-prototype-of",values:"object/values"},RegExp:{escape:"regexp/escape"},Function:{only:"function/only",part:"function/part"},Math:{acosh:"math/acosh",asinh:"math/asinh",atanh:"math/atanh",cbrt:"math/cbrt",clz32:"math/clz32",cosh:"math/cosh",expm1:"math/expm1",fround:"math/fround",hypot:"math/hypot",pot:"math/pot",imul:"math/imul",log10:"math/log10",log1p:"math/log1p",log2:"math/log2",sign:"math/sign",sinh:"math/sinh",tanh:"math/tanh",trunc:"math/trunc"},Date:{addLocale:"date/add-locale",formatUTC:"date/format-utc",format:"date/format"},Symbol:{"for":"symbol/for",hasInstance:"symbol/has-instance","is-concat-spreadable":"symbol/is-concat-spreadable",iterator:"symbol/iterator",keyFor:"symbol/key-for",match:"symbol/match",replace:"symbol/replace",search:"symbol/search",species:"symbol/species",split:"symbol/split",toPrimitive:"symbol/to-primitive",toStringTag:"symbol/to-string-tag",unscopables:"symbol/unscopables"},String:{at:"string/at",codePointAt:"string/code-point-at",endsWith:"string/ends-with",escapeHTML:"string/escape-html",fromCodePoint:"string/from-code-point",includes:"string/includes",raw:"string/raw",repeat:"string/repeat",startsWith:"string/starts-with",unescapeHTML:"string/unescape-html"},Number:{EPSILON:"number/epsilon",isFinite:"number/is-finite",isInteger:"number/is-integer",isNaN:"number/is-nan",isSafeInteger:"number/is-safe-integer",MAX_SAFE_INTEGER:"number/max-safe-integer",MIN_SAFE_INTEGER:"number/min-safe-integer",parseFloat:"number/parse-float",parseInt:"number/parse-int",random:"number/random"},Reflect:{apply:"reflect/apply",construct:"reflect/construct",defineProperty:"reflect/define-property",deleteProperty:"reflect/delete-property",enumerate:"reflect/enumerate",getOwnPropertyDescriptor:"reflect/get-own-property-descriptor",getPrototypeOf:"reflect/get-prototype-of",get:"reflect/get",has:"reflect/has",isExtensible:"reflect/is-extensible",ownKeys:"reflect/own-keys",preventExtensions:"reflect/prevent-extensions",setPrototypeOf:"reflect/set-prototype-of",set:"reflect/set"}}}},{}],196:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e(195),a=n(i);r["default"]=function(e){function t(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var r=e.Plugin,n=e.types,i="babel-runtime";return new r("runtime",{metadata:{group:"builtin-post-modules"},pre:function(e){e.set("helperGenerator",function(t){return e.addImport(i+"/helpers/"+t,t,"absoluteDefault")}),e.setDynamic("regeneratorIdentifier",function(){return e.addImport(i+"/regenerator","regeneratorRuntime","absoluteDefault")})},visitor:{ReferencedIdentifier:function(e,r,s,o){if("regeneratorRuntime"===e.name)return o.get("regeneratorIdentifier");if(!n.isMemberExpression(r)&&t(a["default"].builtins,e.name)&&!s.getBindingIdentifier(e.name)){var u=a["default"].builtins[e.name];return o.addImport(i+"/core-js/"+u,e.name,"absoluteDefault")}},CallExpression:function(e,t,r,a){if(!e.arguments.length){var s=e.callee;if(n.isMemberExpression(s)&&s.computed&&this.get("callee.property").matchesPattern("Symbol.iterator"))return n.callExpression(a.addImport(i+"/core-js/get-iterator","getIterator","absoluteDefault"),[s.object])}},BinaryExpression:function(e,t,r,a){return"in"===e.operator&&this.get("left").matchesPattern("Symbol.iterator")?n.callExpression(a.addImport(i+"/core-js/is-iterable","isIterable","absoluteDefault"),[e.right]):void 0},MemberExpression:{enter:function(e,r,s,o){if(this.isReferenced()){var u=e.object,p=e.property;if(n.isReferenced(u,e)&&!e.computed&&t(a["default"].methods,u.name)){var l=a["default"].methods[u.name];if(t(l,p.name)&&!s.getBindingIdentifier(u.name)){if("Object"===u.name&&"defineProperty"===p.name&&this.parentPath.isCallExpression()){var c=this.parentPath.node;if(3===c.arguments.length&&n.isLiteral(c.arguments[1]))return}var f=l[p.name];return o.addImport(i+"/core-js/"+f,u.name+"$"+p.name,"absoluteDefault")}}}},exit:function(e,r,s,o){if(this.isReferenced()){var u=e.property,p=e.object;if(t(a["default"].builtins,p.name)&&!s.getBindingIdentifier(p.name)){var l=a["default"].builtins[p.name];return n.memberExpression(o.addImport(i+"/core-js/"+l,""+p.name,"absoluteDefault"),u,e.computed)}}}}}})},t.exports=r["default"]},{195:195}],197:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(r,"__esModule",{value:!0});var i=e(198),a=n(i);r["default"]=function(e){var t=e.Plugin,r=(e.types,e.messages);return new t("undeclared-variables-check",{metadata:{group:"builtin-pre"},visitor:{ReferencedIdentifier:function(e,t,n){var i=n.getBinding(e.name);if(i&&"type"===i.kind&&!this.parentPath.isFlow())throw this.errorWithNode(r.get("undeclaredVariableType",e.name),ReferenceError);if(!n.hasBinding(e.name)){var s,o=n.getAllBindings(),u=-1;for(var p in o){var l=a["default"](e.name,p);0>=l||l>3||u>=l||(s=p,u=l)}var c;throw c=s?r.get("undeclaredVariableSuggestion",e.name,s):r.get("undeclaredVariable",e.name),this.errorWithNode(c,ReferenceError)}}}})},t.exports=r["default"]},{198:198}],198:[function(e,t,r){"use strict";var n=[],i=[];t.exports=function(e,t){if(e===t)return 0;var r=e.length,a=t.length;if(0===r)return a;if(0===a)return r;for(var s,o,u,p,l=0,c=0;r>l;)i[l]=e.charCodeAt(l),n[l]=++l;for(;a>c;)for(s=t.charCodeAt(c),u=c++,o=c,l=0;r>l;l++)p=s===i[l]?u:u+1,u=n[l],o=n[l]=u>o?p>o?o+1:p:p>u?u+1:p;return o}},{}],199:[function(e,t,r){"use strict";Object.defineProperty(r,"__esModule",{value:!0}),r["default"]=function(e){var t=e.Plugin,r=e.types;return new t("undefined-to-void",{metadata:{group:"builtin-basic"},visitor:{ReferencedIdentifier:function(e,t){return"undefined"===e.name?r.unaryExpression("void",r.literal(0),!0):void 0}}})},t.exports=r["default"]},{}],200:[function(e,t,r){(function(r){"use strict";function n(e){this.enabled=e&&void 0!==e.enabled?e.enabled:c}function i(e){var t=function(){return a.apply(t,arguments)};return t._styles=e,t.enabled=this.enabled,t.__proto__=m,t}function a(){var e=arguments,t=e.length,r=0!==t&&String(arguments[0]);if(t>1)for(var n=1;t>n;n++)r+=" "+e[n];if(!this.enabled||!r)return r;var i=this._styles,a=i.length,s=u.dim.open;for(!d||-1===i.indexOf("gray")&&-1===i.indexOf("grey")||(u.dim.open="");a--;){var o=u[i[a]];r=o.open+r.replace(o.closeRe,o.open)+o.close}return u.dim.open=s,r}function s(){var e={};return Object.keys(h).forEach(function(t){e[t]={get:function(){return i.call(this,[t])}}}),e}var o=e(202),u=e(201),p=e(205),l=e(203),c=e(207),f=Object.defineProperties,d="win32"===r.platform&&!/^xterm/i.test(r.env.TERM);d&&(u.blue.open="[94m");var h=function(){var e={};return Object.keys(u).forEach(function(t){u[t].closeRe=new RegExp(o(u[t].close),"g"),e[t]={get:function(){return i.call(this,this._styles.concat(t))}}}),e}(),m=f(function(){},h);f(n.prototype,s()),t.exports=new n,t.exports.styles=u,t.exports.hasColor=l,t.exports.stripColor=p,t.exports.supportsColor=c}).call(this,e(10))},{10:10,201:201,202:202,203:203,205:205,207:207}],201:[function(e,t,r){"use strict";function n(){var e={modifiers:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},colors:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],gray:[90,39]},bgColors:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49]}};return e.colors.grey=e.colors.gray,Object.keys(e).forEach(function(t){var r=e[t];Object.keys(r).forEach(function(t){var n=r[t];e[t]=r[t]={open:"["+n[0]+"m",close:"["+n[1]+"m"}}),Object.defineProperty(e,t,{value:r,enumerable:!1})}),e}Object.defineProperty(t,"exports",{enumerable:!0,get:n})},{}],202:[function(e,t,r){"use strict";var n=/[|\\{}()[\]^$+*?.]/g;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");return e.replace(n,"\\$&")}},{}],203:[function(e,t,r){"use strict";var n=e(204),i=new RegExp(n().source);t.exports=i.test.bind(i)},{204:204}],204:[function(e,t,r){"use strict";t.exports=function(){return/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g}},{}],205:[function(e,t,r){"use strict";var n=e(206)();t.exports=function(e){return"string"==typeof e?e.replace(n,""):e}},{206:206}],206:[function(e,t,r){arguments[4][204][0].apply(r,arguments)},{204:204}],207:[function(e,t,r){(function(e){"use strict";var r=e.argv,n=r.indexOf("--"),i=function(e){e="--"+e;var t=r.indexOf(e);return-1!==t&&(-1!==n?n>t:!0)};t.exports=function(){return"FORCE_COLOR"in e.env?!0:i("no-color")||i("no-colors")||i("color=false")?!1:i("color")||i("colors")||i("color=true")||i("color=always")?!0:e.stdout&&!e.stdout.isTTY?!1:"win32"===e.platform?!0:"COLORTERM"in e.env?!0:"dumb"===e.env.TERM?!1:/^screen|^xterm|^vt100|color|ansi|cygwin|linux/i.test(e.env.TERM)?!0:!1}()}).call(this,e(10))},{10:10}],208:[function(e,t,r){(function(t){"use strict";function n(e){return new t(e,"base64").toString()}function i(e){return e.split(",").pop()}function a(e,t){var r=c.exec(e);c.lastIndex=0;var n=r[1]||r[2],i=p.join(t,n);try{return u.readFileSync(i,"utf8")}catch(a){throw new Error("An error occurred while trying to read the map file at "+i+"\n"+a)}}function s(e,t){t=t||{},t.isFileComment&&(e=a(e,t.commentFileDir)),t.hasComment&&(e=i(e)),t.isEncoded&&(e=n(e)),(t.isJSON||t.isEncoded)&&(e=JSON.parse(e)),this.sourcemap=e}function o(e){for(var t,n=e.split("\n"),i=n.length-1;i>0;i--)if(t=n[i],~t.indexOf("sourceMappingURL=data:"))return r.fromComment(t)}var u=e(1),p=e(9),l=/^\s*\/(?:\/|\*)[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+;)?base64,(.*)$/gm,c=/(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/gm;s.prototype.toJSON=function(e){return JSON.stringify(this.sourcemap,null,e)},s.prototype.toBase64=function(){var e=this.toJSON();return new t(e).toString("base64")},s.prototype.toComment=function(e){var t=this.toBase64(),r="sourceMappingURL=data:application/json;base64,"+t;return e&&e.multiline?"/*# "+r+" */":"//# "+r},s.prototype.toObject=function(){return JSON.parse(this.toJSON())},s.prototype.addProperty=function(e,t){if(this.sourcemap.hasOwnProperty(e))throw new Error("property %s already exists on the sourcemap, use set property instead");return this.setProperty(e,t)},s.prototype.setProperty=function(e,t){return this.sourcemap[e]=t,this},s.prototype.getProperty=function(e){return this.sourcemap[e]},r.fromObject=function(e){return new s(e)},r.fromJSON=function(e){return new s(e,{isJSON:!0})},r.fromBase64=function(e){return new s(e,{isEncoded:!0})},r.fromComment=function(e){return e=e.replace(/^\/\*/g,"//").replace(/\*\/$/g,""),new s(e,{isEncoded:!0,hasComment:!0})},r.fromMapFileComment=function(e,t){return new s(e,{commentFileDir:t,isFileComment:!0,isJSON:!0})},r.fromSource=function(e,t){if(t)return o(e);var n=e.match(l);return l.lastIndex=0,n?r.fromComment(n.pop()):null},r.fromMapFileSource=function(e,t){var n=e.match(c);return c.lastIndex=0,n?r.fromMapFileComment(n.pop(),t):null},r.removeComments=function(e){return l.lastIndex=0,e.replace(l,"")},r.removeMapFileComments=function(e){return c.lastIndex=0,e.replace(c,"")},Object.defineProperty(r,"commentRegex",{get:function(){return l.lastIndex=0,l}}),Object.defineProperty(r,"mapFileCommentRegex",{get:function(){return c.lastIndex=0,c}})}).call(this,e(3).Buffer)},{1:1,3:3,9:9}],209:[function(e,t,r){t.exports=function(e){if("function"!=typeof e)throw TypeError(e+" is not a function!");return e}},{}],210:[function(e,t,r){var n=e(240);t.exports=function(e){if(!n(e))throw TypeError(e+" is not an object!");return e}},{240:240}],211:[function(e,t,r){var n=e(277),i=e(278),a=e(275);t.exports=function(e){return function(t,r,s){var o,u=n(t),p=i(u.length),l=a(s,p);if(e&&r!=r){for(;p>l;)if(o=u[l++],o!=o)return!0}else for(;p>l;l++)if((e||l in u)&&u[l]===r)return e||l;return!e&&-1}}},{275:275,277:277,278:278}],212:[function(e,t,r){var n=e(221),i=e(237),a=e(279),s=e(278);t.exports=function(e){var t=1==e,r=2==e,o=3==e,u=4==e,p=6==e,l=5==e||p;return function(c,f,d){for(var h,m,y=a(c),g=i(y),v=n(f,d,3),b=s(g.length),E=0,x=t?Array(b):r?[]:void 0;b>E;E++)if((l||E in g)&&(h=g[E],m=v(h,E,y),e))if(t)x[E]=m;else if(m)switch(e){case 3:return!0;case 5:return h;case 6:return E;case 2:x.push(h)}else if(u)return!1;return p?-1:o||u?u:x}}},{221:221,237:237,278:278,279:279}],213:[function(e,t,r){var n=e(279),i=e(237),a=e(225);t.exports=e(227)(function(){return Symbol()in Object.assign({})})?function(e,t){for(var r=n(e),s=arguments.length,o=1;s>o;)for(var u,p=i(arguments[o++]),l=a(p),c=l.length,f=0;c>f;)r[u=l[f++]]=p[u];return r}:Object.assign},{225:225,227:227,237:237,279:279}],214:[function(e,t,r){var n=e(215),i=e(282)("toStringTag"),a="Arguments"==n(function(){return arguments}());t.exports=function(e){var t,r,s;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=(t=Object(e))[i])?r:a?n(t):"Object"==(s=n(t))&&"function"==typeof t.callee?"Arguments":s}},{215:215,282:282}],215:[function(e,t,r){var n={}.toString;t.exports=function(e){return n.call(e).slice(8,-1)}},{}],216:[function(e,t,r){"use strict";var n=e(247),i=e(234),a=e(221),s=e(265),o=e(266),u=e(223),p=e(230),l=e(245),c=e(280)("id"),f=e(233),d=e(240),h=Object.isExtensible||d,m=e(272),y=m?"_s":"size",g=0,v=function(e,t){if(!d(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!f(e,c)){if(!h(e))return"F";if(!t)return"E";i(e,c,++g)}return"O"+e[c]},b=function(e,t){var r,n=v(t);if("F"!==n)return e._i[n];for(r=e._f;r;r=r.n)if(r.k==t)return r};t.exports={getConstructor:function(t,r,i,s){var l=t(function(e,t){o(e,l,r),e._i=n.create(null),e._f=void 0,e._l=void 0,e[y]=0,void 0!=t&&p(t,i,e[s],e)});return e(252)(l.prototype,{clear:function(){for(var e=this,t=e._i,r=e._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete t[r.i];e._f=e._l=void 0,e[y]=0},"delete":function(e){var t=this,r=b(t,e);if(r){var n=r.n,i=r.p;delete t._i[r.i],r.r=!0,i&&(i.n=n),n&&(n.p=i),t._f==r&&(t._f=n),t._l==r&&(t._l=i),t[y]--}return!!r},forEach:function(e){for(var t,r=a(e,arguments[1],3);t=t?t.n:this._f;)for(r(t.v,t.k,this);t&&t.r;)t=t.p},has:function(e){return!!b(this,e)}}),m&&n.setDesc(l.prototype,"size",{get:function(){return u(this[y])}}),l},def:function(e,t,r){var n,i,a=b(e,t);return a?a.v=r:(e._l=a={i:i=v(t,!0),k:t,v:r,p:n=e._l,n:void 0,r:!1},e._f||(e._f=a),n&&(n.n=a),e[y]++,"F"!==i&&(e._i[i]=a)),e},getEntry:b,setStrong:function(t,r,n){e(243)(t,r,function(e,t){this._t=e,this._k=t,this._l=void 0},function(){for(var e=this,t=e._k,r=e._l;r&&r.r;)r=r.p;return e._t&&(e._l=r=r?r.n:e._t._f)?"keys"==t?l(0,r.k):"values"==t?l(0,r.v):l(0,[r.k,r.v]):(e._t=void 0,l(1))},n?"entries":"values",!n,!0),s(t),s(e(220)[r])}}},{220:220,221:221,223:223,230:230,233:233,234:234,240:240,243:243,245:245,247:247,252:252,265:265,266:266,272:272,280:280}],217:[function(e,t,r){var n=e(230),i=e(214);t.exports=function(e){return function(){if(i(this)!=e)throw TypeError(e+"#toJSON isn't generic");var t=[];return n(this,!1,t.push,t),t}}},{214:214,230:230}],218:[function(e,t,r){"use strict";var n=e(234),i=e(210),a=e(266),s=e(230),o=e(212),u=e(280)("weak"),p=e(240),l=e(233),c=Object.isExtensible||p,f=o(5),d=o(6),h=0,m=function(e){return e._l||(e._l=new y)},y=function(){this.a=[]},g=function(e,t){return f(e.a,function(e){return e[0]===t})};y.prototype={get:function(e){var t=g(this,e);return t?t[1]:void 0},has:function(e){return!!g(this,e)},set:function(e,t){var r=g(this,e);r?r[1]=t:this.a.push([e,t])},"delete":function(e){var t=d(this.a,function(t){return t[0]===e});return~t&&this.a.splice(t,1),!!~t}},t.exports={getConstructor:function(t,r,n,i){var o=t(function(e,t){a(e,o,r),e._i=h++,e._l=void 0,void 0!=t&&s(t,n,e[i],e)});return e(252)(o.prototype,{"delete":function(e){return p(e)?c(e)?l(e,u)&&l(e[u],this._i)&&delete e[u][this._i]:m(this)["delete"](e):!1},has:function(e){return p(e)?c(e)?l(e,u)&&l(e[u],this._i):m(this).has(e):!1}}),o},def:function(e,t,r){return c(i(t))?(l(t,u)||n(t,u,{}),t[u][e._i]=r):m(e).set(t,r),e},frozenStore:m,WEAK:u}},{210:210,212:212,230:230,233:233,234:234,240:240,252:252,266:266,280:280}],219:[function(e,t,r){"use strict";var n=e(232),i=e(222),a=e(230),s=e(266);t.exports=function(t,r,o,u,p,l){var c=n[t],f=c,d=p?"set":"add",h=f&&f.prototype,m={},y=function(t){var r=h[t];e(259)(h,t,"delete"==t?function(e){return r.call(this,0===e?0:e)}:"has"==t?function(e){return r.call(this,0===e?0:e)}:"get"==t?function(e){return r.call(this,0===e?0:e)}:"add"==t?function(e){return r.call(this,0===e?0:e),this}:function(e,t){return r.call(this,0===e?0:e,t),this})};if("function"==typeof f&&(l||h.forEach&&!e(227)(function(){(new f).entries().next()}))){var g,v=new f,b=v[d](l?{}:-0,1);e(244)(function(e){new f(e)})||(f=r(function(e,r){
s(e,f,t);var n=new c;return void 0!=r&&a(r,p,n[d],n),n}),f.prototype=h,h.constructor=f),l||v.forEach(function(e,t){g=1/t===-(1/0)}),g&&(y("delete"),y("has"),p&&y("get")),(g||b!==v)&&y(d),l&&h.clear&&delete h.clear}else f=u.getConstructor(r,t,p,d),e(252)(f.prototype,o);return e(273)(f,t),m[t]=f,i(i.G+i.W+i.F*(f!=c),m),l||u.setStrong(f,t,p),f}},{222:222,227:227,230:230,232:232,244:244,252:252,259:259,266:266,273:273}],220:[function(e,t,r){var n=t.exports={};"number"==typeof __e&&(__e=n)},{}],221:[function(e,t,r){var n=e(209);t.exports=function(e,t,r){if(n(e),void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 2:return function(r,n){return e.call(t,r,n)};case 3:return function(r,n,i){return e.call(t,r,n,i)}}return function(){return e.apply(t,arguments)}}},{209:209}],222:[function(e,t,r){var n=e(232),i=e(220),a=e(234),s=e(259),o="prototype",u=function(e,t){return function(){return e.apply(t,arguments)}},p=function(e,t,r){var l,c,f,d,h=e&p.G,m=e&p.P,y=h?n:e&p.S?n[t]||(n[t]={}):(n[t]||{})[o],g=h?i:i[t]||(i[t]={});h&&(r=t);for(l in r)c=!(e&p.F)&&y&&l in y,f=(c?y:r)[l],d=e&p.B&&c?u(f,n):m&&"function"==typeof f?u(Function.call,f):f,y&&!c&&s(y,l,f),g[l]!=f&&a(g,l,d),m&&((g[o]||(g[o]={}))[l]=f)};n.core=i,p.F=1,p.G=2,p.S=4,p.P=8,p.B=16,p.W=32,t.exports=p},{220:220,232:232,234:234,259:259}],223:[function(e,t,r){t.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},{}],224:[function(e,t,r){var n=e(240),i=e(232).document,a=n(i)&&n(i.createElement);t.exports=function(e){return a?i.createElement(e):{}}},{232:232,240:240}],225:[function(e,t,r){var n=e(247);t.exports=function(e){var t=n.getKeys(e),r=n.getSymbols;if(r)for(var i,a=r(e),s=n.isEnum,o=0;a.length>o;)s.call(e,i=a[o++])&&t.push(i);return t}},{247:247}],226:[function(e,t,r){t.exports=Math.expm1||function(e){return 0==(e=+e)?e:e>-1e-6&&1e-6>e?e+e*e/2:Math.exp(e)-1}},{}],227:[function(e,t,r){t.exports=function(e){try{return!!e()}catch(t){return!0}}},{}],228:[function(e,t,r){"use strict";t.exports=function(t,r,n){var i=e(223),a=e(282)(t),s=""[t];e(227)(function(){var e={};return e[a]=function(){return 7},7!=""[t](e)})&&(e(259)(String.prototype,t,n(i,a,s)),e(234)(RegExp.prototype,a,2==r?function(e,t){return s.call(e,this,t)}:function(e){return s.call(e,this)}))}},{223:223,227:227,234:234,259:259,282:282}],229:[function(e,t,r){"use strict";var n=e(210);t.exports=function(){var e=n(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},{210:210}],230:[function(e,t,r){var n=e(221),i=e(241),a=e(238),s=e(210),o=e(278),u=e(283);t.exports=function(e,t,r,p){var l,c,f,d=u(e),h=n(r,p,t?2:1),m=0;if("function"!=typeof d)throw TypeError(e+" is not iterable!");if(a(d))for(l=o(e.length);l>m;m++)t?h(s(c=e[m])[0],c[1]):h(e[m]);else for(f=d.call(e);!(c=f.next()).done;)i(f,h,c.value,t)}},{210:210,221:221,238:238,241:241,278:278,283:283}],231:[function(e,t,r){var n={}.toString,i=e(277),a=e(247).getNames,s="object"==typeof window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],o=function(e){try{return a(e)}catch(t){return s.slice()}};t.exports.get=function(e){return s&&"[object Window]"==n.call(e)?o(e):a(i(e))}},{247:247,277:277}],232:[function(e,t,r){var n="undefined",i=t.exports=typeof window!=n&&window.Math==Math?window:typeof self!=n&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=i)},{}],233:[function(e,t,r){var n={}.hasOwnProperty;t.exports=function(e,t){return n.call(e,t)}},{}],234:[function(e,t,r){var n=e(247),i=e(258);t.exports=e(272)?function(e,t,r){return n.setDesc(e,t,i(1,r))}:function(e,t,r){return e[t]=r,e}},{247:247,258:258,272:272}],235:[function(e,t,r){t.exports=e(232).document&&document.documentElement},{232:232}],236:[function(e,t,r){t.exports=function(e,t,r){var n=void 0===r;switch(t.length){case 0:return n?e():e.call(r);case 1:return n?e(t[0]):e.call(r,t[0]);case 2:return n?e(t[0],t[1]):e.call(r,t[0],t[1]);case 3:return n?e(t[0],t[1],t[2]):e.call(r,t[0],t[1],t[2]);case 4:return n?e(t[0],t[1],t[2],t[3]):e.call(r,t[0],t[1],t[2],t[3])}return e.apply(r,t)}},{}],237:[function(e,t,r){var n=e(215);t.exports=0 in Object("z")?Object:function(e){return"String"==n(e)?e.split(""):Object(e)}},{215:215}],238:[function(e,t,r){var n=e(246),i=e(282)("iterator");t.exports=function(e){return(n.Array||Array.prototype[i])===e}},{246:246,282:282}],239:[function(e,t,r){var n=e(240),i=Math.floor;t.exports=function(e){return!n(e)&&isFinite(e)&&i(e)===e}},{240:240}],240:[function(e,t,r){t.exports=function(e){return null!==e&&("object"==typeof e||"function"==typeof e)}},{}],241:[function(e,t,r){var n=e(210);t.exports=function(e,t,r,i){try{return i?t(n(r)[0],r[1]):t(r)}catch(a){var s=e["return"];throw void 0!==s&&n(s.call(e)),a}}},{210:210}],242:[function(e,t,r){"use strict";var n=e(247),i={};e(234)(i,e(282)("iterator"),function(){return this}),t.exports=function(t,r,a){t.prototype=n.create(i,{next:e(258)(1,a)}),e(273)(t,r+" Iterator")}},{234:234,247:247,258:258,273:273,282:282}],243:[function(e,t,r){"use strict";var n=e(249),i=e(222),a=e(259),s=e(234),o=e(233),u=e(282)("iterator"),p=e(246),l=!([].keys&&"next"in[].keys()),c="@@iterator",f="keys",d="values",h=function(){return this};t.exports=function(t,r,m,y,g,v,b){e(242)(m,r,y);var E,x,S=function(e){switch(e){case f:return function(){return new m(this,e)};case d:return function(){return new m(this,e)}}return function(){return new m(this,e)}},A=r+" Iterator",D=t.prototype,C=D[u]||D[c]||g&&D[g],w=C||S(g);if(C){var I=e(247).getProto(w.call(new t));e(273)(I,A,!0),!n&&o(D,c)&&s(I,u,h)}if((!n||b)&&s(D,u,w),p[r]=w,p[A]=h,g)if(E={keys:v?w:S(f),values:g==d?w:S(d),entries:g!=d?w:S("entries")},b)for(x in E)x in D||a(D,x,E[x]);else i(i.P+i.F*l,r,E)}},{222:222,233:233,234:234,242:242,246:246,247:247,249:249,259:259,273:273,282:282}],244:[function(e,t,r){var n=e(282)("iterator"),i=!1;try{var a=[7][n]();a["return"]=function(){i=!0},Array.from(a,function(){throw 2})}catch(s){}t.exports=function(e){if(!i)return!1;var t=!1;try{var r=[7],a=r[n]();a.next=function(){t=!0},r[n]=function(){return a},e(r)}catch(s){}return t}},{282:282}],245:[function(e,t,r){t.exports=function(e,t){return{value:t,done:!!e}}},{}],246:[function(e,t,r){t.exports={}},{}],247:[function(e,t,r){var n=Object;t.exports={create:n.create,getProto:n.getPrototypeOf,isEnum:{}.propertyIsEnumerable,getDesc:n.getOwnPropertyDescriptor,setDesc:n.defineProperty,setDescs:n.defineProperties,getKeys:n.keys,getNames:n.getOwnPropertyNames,getSymbols:n.getOwnPropertySymbols,each:[].forEach}},{}],248:[function(e,t,r){var n=e(247),i=e(277);t.exports=function(e,t){for(var r,a=i(e),s=n.getKeys(a),o=s.length,u=0;o>u;)if(a[r=s[u++]]===t)return r}},{247:247,277:277}],249:[function(e,t,r){t.exports=!1},{}],250:[function(e,t,r){t.exports=Math.log1p||function(e){return(e=+e)>-1e-8&&1e-8>e?e-e*e/2:Math.log(1+e)}},{}],251:[function(e,t,r){var n,i,a,s=e(232),o=e(274).set,u=s.MutationObserver||s.WebKitMutationObserver,p=s.process,l="process"==e(215)(p),c=function(){var e,t;for(l&&(e=p.domain)&&(p.domain=null,e.exit());n;)t=n.domain,t&&t.enter(),n.fn.call(),t&&t.exit(),n=n.next;i=void 0,e&&e.enter()};if(l)a=function(){p.nextTick(c)};else if(u){var f=1,d=document.createTextNode("");new u(c).observe(d,{characterData:!0}),a=function(){d.data=f=-f}}else a=function(){o.call(s,c)};t.exports=function(e){var t={fn:e,next:void 0,domain:l&&p.domain};i&&(i.next=t),n||(n=t,a()),i=t}},{215:215,232:232,274:274}],252:[function(e,t,r){var n=e(259);t.exports=function(e,t){for(var r in t)n(e,r,t[r]);return e}},{259:259}],253:[function(e,t,r){t.exports=function(t,r){var n=e(222),i=(e(220).Object||{})[t]||Object[t],a={};a[t]=r(i),n(n.S+n.F*e(227)(function(){i(1)}),"Object",a)}},{220:220,222:222,227:227}],254:[function(e,t,r){var n=e(247),i=e(277);t.exports=function(e){return function(t){var r,a=i(t),s=n.getKeys(a),o=s.length,u=0,p=Array(o);if(e)for(;o>u;)p[u]=[r=s[u++],a[r]];else for(;o>u;)p[u]=a[s[u++]];return p}}},{247:247,277:277}],255:[function(e,t,r){var n=e(247),i=e(210),a=e(232).Reflect;t.exports=a&&a.ownKeys||function(e){var t=n.getNames(i(e)),r=n.getSymbols;return r?t.concat(r(e)):t}},{210:210,232:232,247:247}],256:[function(e,t,r){"use strict";var n=e(257),i=e(236),a=e(209);t.exports=function(){for(var e=a(this),t=arguments.length,r=Array(t),s=0,o=n._,u=!1;t>s;)(r[s]=arguments[s++])===o&&(u=!0);return function(){var n,a=this,s=arguments.length,p=0,l=0;if(!u&&!s)return i(e,r,a);if(n=r.slice(),u)for(;t>p;p++)n[p]===o&&(n[p]=arguments[l++]);for(;s>l;)n.push(arguments[l++]);return i(e,n,a)}}},{209:209,236:236,257:257}],257:[function(e,t,r){t.exports=e(232)},{232:232}],258:[function(e,t,r){t.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},{}],259:[function(e,t,r){var n=e(232),i=e(234),a=e(280)("src"),s="toString",o=Function[s],u=(""+o).split(s);e(220).inspectSource=function(e){return o.call(e)},(t.exports=function(e,t,r,s){"function"==typeof r&&(i(r,a,e[t]?""+e[t]:u.join(String(t))),"name"in r||(r.name=t)),e===n?e[t]=r:(s||delete e[t],i(e,t,r))})(Function.prototype,s,function(){return"function"==typeof this&&this[a]||o.call(this)})},{220:220,232:232,234:234,280:280}],260:[function(e,t,r){t.exports=function(e,t){var r=t===Object(t)?function(e){return t[e]}:t;return function(t){return String(t).replace(e,r)}}},{}],261:[function(e,t,r){t.exports=Object.is||function(e,t){return e===t?0!==e||1/e===1/t:e!=e&&t!=t}},{}],262:[function(e,t,r){var n=e(247).getDesc,i=e(240),a=e(210),s=function(e,t){if(a(e),!i(t)&&null!==t)throw TypeError(t+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,r){try{r=e(221)(Function.call,n(Object.prototype,"__proto__").set,2),r({},[])}catch(i){t=!0}return function(e,n){return s(e,n),t?e.__proto__=n:r(e,n),e}}():void 0),check:s}},{210:210,221:221,240:240,247:247}],263:[function(e,t,r){var n=e(232),i="__core-js_shared__",a=n[i]||(n[i]={});t.exports=function(e){return a[e]||(a[e]={})}},{232:232}],264:[function(e,t,r){t.exports=Math.sign||function(e){return 0==(e=+e)||e!=e?e:0>e?-1:1}},{}],265:[function(e,t,r){"use strict";var n=e(247),i=e(282)("species");t.exports=function(t){!e(272)||i in t||n.setDesc(t,i,{configurable:!0,get:function(){return this}})}},{247:247,272:272,282:282}],266:[function(e,t,r){t.exports=function(e,t,r){if(!(e instanceof t))throw TypeError(r+": use the 'new' operator!");return e}},{}],267:[function(e,t,r){var n=e(276),i=e(223);t.exports=function(e){return function(t,r){var a,s,o=String(i(t)),u=n(r),p=o.length;return 0>u||u>=p?e?"":void 0:(a=o.charCodeAt(u),55296>a||a>56319||u+1===p||(s=o.charCodeAt(u+1))<56320||s>57343?e?o.charAt(u):a:e?o.slice(u,u+2):(a-55296<<10)+(s-56320)+65536)}}},{223:223,276:276}],268:[function(e,t,r){var n=e(223),i=e(215);t.exports=function(e,t,r){if("RegExp"==i(t))throw TypeError("String#"+r+" doesn't accept regex!");return String(n(e))}},{215:215,223:223}],269:[function(e,t,r){var n=e(278),i=e(270),a=e(223);t.exports=function(e,t,r,s){var o=String(a(e)),u=o.length,p=void 0===r?" ":String(r),l=n(t);if(u>=l)return o;""==p&&(p=" ");var c=l-u,f=i.call(p,Math.ceil(c/p.length));return f.length>c&&(f=s?f.slice(f.length-c):f.slice(0,c)),s?f+o:o+f}},{223:223,270:270,278:278}],270:[function(e,t,r){"use strict";var n=e(276),i=e(223);t.exports=function(e){var t=String(i(this)),r="",a=n(e);if(0>a||a==1/0)throw RangeError("Count can't be negative");for(;a>0;(a>>>=1)&&(t+=t))1&a&&(r+=t);return r}},{223:223,276:276}],271:[function(e,t,r){var n=function(e,t){return e=String(a(e)),1&t&&(e=e.replace(p,"")),2&t&&(e=e.replace(l,"")),e},i=e(222),a=e(223),s=" \n\f\r \u2028\u2029\ufeff",o="["+s+"]",u="
",p=RegExp("^"+o+o+"*"),l=RegExp(o+o+"*$");t.exports=function(t,r){var a={};a[t]=r(n),i(i.P+i.F*e(227)(function(){return!!s[t]()||u[t]()!=u}),"String",a)}},{222:222,223:223,227:227}],272:[function(e,t,r){t.exports=!e(227)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},{227:227}],273:[function(e,t,r){var n=e(233),i=e(234),a=e(282)("toStringTag");t.exports=function(e,t,r){e&&!n(e=r?e:e.prototype,a)&&i(e,a,t)}},{233:233,234:234,282:282}],274:[function(e,t,r){"use strict";var n,i,a,s=e(221),o=e(236),u=e(235),p=e(224),l=e(232),c=l.process,f=l.setImmediate,d=l.clearImmediate,h=l.MessageChannel,m=0,y={},g="onreadystatechange",v=function(){var e=+this;if(y.hasOwnProperty(e)){var t=y[e];delete y[e],t()}},b=function(e){v.call(e.data)};f&&d||(f=function(e){for(var t=[],r=1;arguments.length>r;)t.push(arguments[r++]);return y[++m]=function(){o("function"==typeof e?e:Function(e),t)},n(m),m},d=function(e){delete y[e]},"process"==e(215)(c)?n=function(e){c.nextTick(s(v,e,1))}:h?(i=new h,a=i.port2,i.port1.onmessage=b,n=s(a.postMessage,a,1)):l.addEventListener&&"function"==typeof postMessage&&!l.importScript?(n=function(e){l.postMessage(e+"","*")},l.addEventListener("message",b,!1)):n=g in p("script")?function(e){u.appendChild(p("script"))[g]=function(){u.removeChild(this),v.call(e)}}:function(e){setTimeout(s(v,e,1),0)}),t.exports={set:f,clear:d}},{215:215,221:221,224:224,232:232,235:235,236:236}],275:[function(e,t,r){var n=e(276),i=Math.max,a=Math.min;t.exports=function(e,t){return e=n(e),0>e?i(e+t,0):a(e,t)}},{276:276}],276:[function(e,t,r){var n=Math.ceil,i=Math.floor;t.exports=function(e){return isNaN(e=+e)?0:(e>0?i:n)(e)}},{}],277:[function(e,t,r){var n=e(237),i=e(223);t.exports=function(e){return n(i(e))}},{223:223,237:237}],278:[function(e,t,r){var n=e(276),i=Math.min;t.exports=function(e){return e>0?i(n(e),9007199254740991):0}},{276:276}],279:[function(e,t,r){var n=e(223);t.exports=function(e){return Object(n(e))}},{223:223}],280:[function(e,t,r){var n=0,i=Math.random();t.exports=function(e){return"Symbol(".concat(void 0===e?"":e,")_",(++n+i).toString(36))}},{}],281:[function(e,t,r){var n=e(282)("unscopables");n in[]||e(234)(Array.prototype,n,{}),t.exports=function(e){[][n][e]=!0}},{234:234,282:282}],282:[function(e,t,r){var n=e(263)("wks"),i=e(232).Symbol;t.exports=function(t){return n[t]||(n[t]=i&&i[t]||(i||e(280))("Symbol."+t))}},{232:232,263:263,280:280}],283:[function(e,t,r){var n=e(214),i=e(282)("iterator"),a=e(246);t.exports=e(220).getIteratorMethod=function(e){return void 0!=e?e[i]||e["@@iterator"]||a[n(e)]:void 0}},{214:214,220:220,246:246,282:282}],284:[function(e,t,r){"use strict";var n,i=e(247),a=e(272),s=e(258),o=e(235),u=e(224),p=e(233),l=e(215),c=e(222),f=e(236),d=e(212),h=e(280)("__proto__"),m=e(240),y=e(210),g=e(209),v=e(279),b=e(277),E=e(276),x=e(275),S=e(278),A=e(237),D=e(227),C=Object.prototype,w=[],I=w.slice,_=w.join,F=i.setDesc,k=i.getDesc,P=i.setDescs,B=e(211)(!1),T={};a||(n=!D(function(){return 7!=F(u("div"),"a",{get:function(){return 7}}).a}),i.setDesc=function(e,t,r){if(n)try{return F(e,t,r)}catch(i){}if("get"in r||"set"in r)throw TypeError("Accessors not supported!");return"value"in r&&(y(e)[t]=r.value),e},i.getDesc=function(e,t){if(n)try{return k(e,t)}catch(r){}return p(e,t)?s(!C.propertyIsEnumerable.call(e,t),e[t]):void 0},i.setDescs=P=function(e,t){y(e);for(var r,n=i.getKeys(t),a=n.length,s=0;a>s;)i.setDesc(e,r=n[s++],t[r]);return e}),c(c.S+c.F*!a,"Object",{getOwnPropertyDescriptor:i.getDesc,defineProperty:i.setDesc,defineProperties:P});var M="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),O=M.concat("length","prototype"),j=M.length,L=function(){var e,t=u("iframe"),r=j,n=">";for(t.style.display="none",o.appendChild(t),t.src="javascript:",e=t.contentWindow.document,e.open(),e.write("<script>document.F=Object</script"+n),e.close(),L=e.F;r--;)delete L.prototype[M[r]];return L()},N=function(e,t){return function(r){var n,i=b(r),a=0,s=[];for(n in i)n!=h&&p(i,n)&&s.push(n);for(;t>a;)p(i,n=e[a++])&&(~B(s,n)||s.push(n));return s}},R=function(){};c(c.S,"Object",{getPrototypeOf:i.getProto=i.getProto||function(e){return e=v(e),p(e,h)?e[h]:"function"==typeof e.constructor&&e instanceof e.constructor?e.constructor.prototype:e instanceof Object?C:null},getOwnPropertyNames:i.getNames=i.getNames||N(O,O.length,!0),create:i.create=i.create||function(e,t){var r;return null!==e?(R.prototype=y(e),r=new R,R.prototype=null,r[h]=e):r=L(),void 0===t?r:P(r,t)},keys:i.getKeys=i.getKeys||N(M,j,!1)});var V=function(e,t,r){if(!(t in T)){for(var n=[],i=0;t>i;i++)n[i]="a["+i+"]";T[t]=Function("F,a","return new F("+n.join(",")+")")}return T[t](e,r)};c(c.P,"Function",{bind:function(e){var t=g(this),r=I.call(arguments,1),n=function(){var i=r.concat(I.call(arguments));return this instanceof n?V(t,i.length,i):f(t,i,e)};return m(t.prototype)&&(n.prototype=t.prototype),n}});var U=D(function(){o&&I.call(o)});c(c.P+c.F*U,"Array",{slice:function(e,t){var r=S(this.length),n=l(this);if(t=void 0===t?r:t,"Array"==n)return I.call(this,e,t);for(var i=x(e,r),a=x(t,r),s=S(a-i),o=Array(s),u=0;s>u;u++)o[u]="String"==n?this.charAt(i+u):this[i+u];return o}}),c(c.P+c.F*(A!=Object),"Array",{join:function(){return _.apply(A(this),arguments)}}),c(c.S,"Array",{isArray:function(e){return"Array"==l(e)}});var q=function(e){return function(t,r){g(t);var n=A(this),i=S(n.length),a=e?i-1:0,s=e?-1:1;if(arguments.length<2)for(;;){if(a in n){r=n[a],a+=s;break}if(a+=s,e?0>a:a>=i)throw TypeError("Reduce of empty array with no initial value")}for(;e?a>=0:i>a;a+=s)a in n&&(r=t(r,n[a],a,this));return r}},G=function(e){return function(t){return e(this,t,arguments[1])}};c(c.P,"Array",{forEach:i.each=i.each||G(d(0)),map:G(d(1)),filter:G(d(2)),some:G(d(3)),every:G(d(4)),reduce:q(!1),reduceRight:q(!0),indexOf:G(B),lastIndexOf:function(e,t){var r=b(this),n=S(r.length),i=n-1;for(arguments.length>1&&(i=Math.min(i,E(t))),0>i&&(i=S(n+i));i>=0;i--)if(i in r&&r[i]===e)return i;return-1}}),c(c.S,"Date",{now:function(){return+new Date}});var H=function(e){return e>9?e:"0"+e},W=new Date(-5e13-1),X=!(W.toISOString&&"0385-07-25T07:06:39.999Z"==W.toISOString()&&D(function(){new Date(NaN).toISOString()}));c(c.P+c.F*X,"Date",{toISOString:function(){if(!isFinite(this))throw RangeError("Invalid time value");var e=this,t=e.getUTCFullYear(),r=e.getUTCMilliseconds(),n=0>t?"-":t>9999?"+":"";return n+("00000"+Math.abs(t)).slice(n?-6:-4)+"-"+H(e.getUTCMonth()+1)+"-"+H(e.getUTCDate())+"T"+H(e.getUTCHours())+":"+H(e.getUTCMinutes())+":"+H(e.getUTCSeconds())+"."+(r>99?r:"0"+H(r))+"Z"}})},{209:209,210:210,211:211,212:212,215:215,222:222,224:224,227:227,233:233,235:235,236:236,237:237,240:240,247:247,258:258,272:272,275:275,276:276,277:277,278:278,279:279,280:280}],285:[function(e,t,r){"use strict";var n=e(222),i=e(279),a=e(275),s=e(278);n(n.P,"Array",{copyWithin:function(e,t){var r=i(this),n=s(r.length),o=a(e,n),u=a(t,n),p=arguments[2],l=void 0===p?n:a(p,n),c=Math.min(l-u,n-o),f=1;for(o>u&&u+c>o&&(f=-1,u=u+c-1,o=o+c-1);c-->0;)u in r?r[o]=r[u]:delete r[o],o+=f,u+=f;return r}}),e(281)("copyWithin")},{222:222,275:275,278:278,279:279,281:281}],286:[function(e,t,r){"use strict";var n=e(222),i=e(279),a=e(275),s=e(278);n(n.P,"Array",{fill:function(e){for(var t=i(this,!0),r=s(t.length),n=a(arguments[1],r),o=arguments[2],u=void 0===o?r:a(o,r);u>n;)t[n++]=e;return t}}),e(281)("fill")},{222:222,275:275,278:278,279:279,281:281}],287:[function(e,t,r){"use strict";var n="findIndex",i=e(222),a=!0,s=e(212)(6);n in[]&&Array(1)[n](function(){a=!1}),i(i.P+i.F*a,"Array",{findIndex:function(e){return s(this,e,arguments[1])}}),e(281)(n)},{212:212,222:222,281:281}],288:[function(e,t,r){"use strict";var n="find",i=e(222),a=!0,s=e(212)(5);n in[]&&Array(1)[n](function(){a=!1}),i(i.P+i.F*a,"Array",{find:function(e){return s(this,e,arguments[1])}}),e(281)(n)},{212:212,222:222,281:281}],289:[function(e,t,r){"use strict";var n=e(221),i=e(222),a=e(279),s=e(241),o=e(238),u=e(278),p=e(283);i(i.S+i.F*!e(244)(function(e){Array.from(e)}),"Array",{from:function(e){var t,r,i,l,c=a(e),f="function"==typeof this?this:Array,d=arguments[1],h=void 0!==d,m=0,y=p(c);if(h&&(d=n(d,arguments[2],2)),void 0==y||f==Array&&o(y))for(r=new f(t=u(c.length));t>m;m++)r[m]=h?d(c[m],m):c[m];else for(l=y.call(c),r=new f;!(i=l.next()).done;m++)r[m]=h?s(l,d,[i.value,m],!0):i.value;return r.length=m,r}})},{221:221,222:222,238:238,241:241,244:244,278:278,279:279,283:283}],290:[function(e,t,r){"use strict";var n=e(281),i=e(245),a=e(246),s=e(277);e(243)(Array,"Array",function(e,t){this._t=s(e),this._i=0,this._k=t},function(){var e=this._t,t=this._k,r=this._i++;return!e||r>=e.length?(this._t=void 0,i(1)):"keys"==t?i(0,r):"values"==t?i(0,e[r]):i(0,[r,e[r]])},"values"),a.Arguments=a.Array,n("keys"),n("values"),n("entries")},{243:243,245:245,246:246,277:277,281:281}],291:[function(e,t,r){"use strict";var n=e(222);n(n.S+n.F*e(227)(function(){function e(){}return!(Array.of.call(e)instanceof e)}),"Array",{of:function(){for(var e=0,t=arguments.length,r=new("function"==typeof this?this:Array)(t);t>e;)r[e]=arguments[e++];return r.length=t,r}})},{222:222,227:227}],292:[function(e,t,r){e(265)(Array)},{265:265}],293:[function(e,t,r){"use strict";var n=e(247),i=e(240),a=e(282)("hasInstance"),s=Function.prototype;a in s||n.setDesc(s,a,{value:function(e){if("function"!=typeof this||!i(e))return!1;if(!i(this.prototype))return e instanceof this;for(;e=n.getProto(e);)if(this.prototype===e)return!0;return!1}})},{240:240,247:247,282:282}],294:[function(e,t,r){var n=e(247).setDesc,i=e(258),a=e(233),s=Function.prototype,o=/^\s*function ([^ (]*)/,u="name";u in s||e(272)&&n(s,u,{configurable:!0,get:function(){var e=(""+this).match(o),t=e?e[1]:"";return a(this,u)||n(this,u,i(5,t)),t}})},{233:233,247:247,258:258,272:272}],295:[function(e,t,r){"use strict";var n=e(216);e(219)("Map",function(e){return function(){return e(this,arguments[0])}},{get:function(e){var t=n.getEntry(this,e);return t&&t.v},set:function(e,t){return n.def(this,0===e?0:e,t)}},n,!0)},{216:216,219:219}],296:[function(e,t,r){var n=e(222),i=e(250),a=Math.sqrt,s=Math.acosh;n(n.S+n.F*!(s&&710==Math.floor(s(Number.MAX_VALUE))),"Math",{acosh:function(e){return(e=+e)<1?NaN:e>94906265.62425156?Math.log(e)+Math.LN2:i(e-1+a(e-1)*a(e+1))}})},{222:222,250:250}],297:[function(e,t,r){function n(e){return isFinite(e=+e)&&0!=e?0>e?-n(-e):Math.log(e+Math.sqrt(e*e+1)):e}var i=e(222);i(i.S,"Math",{asinh:n})},{222:222}],298:[function(e,t,r){var n=e(222);n(n.S,"Math",{atanh:function(e){return 0==(e=+e)?e:Math.log((1+e)/(1-e))/2}})},{222:222}],299:[function(e,t,r){var n=e(222),i=e(264);n(n.S,"Math",{cbrt:function(e){return i(e=+e)*Math.pow(Math.abs(e),1/3)}})},{222:222,264:264}],300:[function(e,t,r){var n=e(222);n(n.S,"Math",{clz32:function(e){return(e>>>=0)?31-Math.floor(Math.log(e+.5)*Math.LOG2E):32}})},{222:222}],301:[function(e,t,r){var n=e(222),i=Math.exp;n(n.S,"Math",{cosh:function(e){return(i(e=+e)+i(-e))/2}})},{222:222}],302:[function(e,t,r){var n=e(222);n(n.S,"Math",{expm1:e(226)})},{222:222,226:226}],303:[function(e,t,r){var n=e(222),i=e(264),a=Math.pow,s=a(2,-52),o=a(2,-23),u=a(2,127)*(2-o),p=a(2,-126),l=function(e){return e+1/s-1/s};n(n.S,"Math",{fround:function(e){var t,r,n=Math.abs(e),a=i(e);return p>n?a*l(n/p/o)*p*o:(t=(1+o/s)*n,r=t-(t-n),r>u||r!=r?a*(1/0):a*r)}})},{222:222,264:264}],304:[function(e,t,r){var n=e(222),i=Math.abs;n(n.S,"Math",{hypot:function(e,t){for(var r,n,a=0,s=0,o=arguments.length,u=0;o>s;)r=i(arguments[s++]),r>u?(n=u/r,a=a*n*n+1,u=r):r>0?(n=r/u,a+=n*n):a+=r;return u===1/0?1/0:u*Math.sqrt(a)}})},{222:222}],305:[function(e,t,r){var n=e(222);n(n.S+n.F*e(227)(function(){return-5!=Math.imul(4294967295,5)}),"Math",{imul:function(e,t){var r=65535,n=+e,i=+t,a=r&n,s=r&i;return 0|a*s+((r&n>>>16)*s+a*(r&i>>>16)<<16>>>0)}})},{222:222,227:227}],306:[function(e,t,r){var n=e(222);n(n.S,"Math",{log10:function(e){return Math.log(e)/Math.LN10}})},{222:222}],307:[function(e,t,r){var n=e(222);n(n.S,"Math",{log1p:e(250)})},{222:222,250:250}],308:[function(e,t,r){var n=e(222);n(n.S,"Math",{log2:function(e){return Math.log(e)/Math.LN2}})},{222:222}],309:[function(e,t,r){var n=e(222);n(n.S,"Math",{sign:e(264)})},{222:222,264:264}],310:[function(e,t,r){var n=e(222),i=e(226),a=Math.exp;n(n.S,"Math",{sinh:function(e){return Math.abs(e=+e)<1?(i(e)-i(-e))/2:(a(e-1)-a(-e-1))*(Math.E/2)}})},{222:222,226:226}],311:[function(e,t,r){var n=e(222),i=e(226),a=Math.exp;n(n.S,"Math",{tanh:function(e){var t=i(e=+e),r=i(-e);return t==1/0?1:r==1/0?-1:(t-r)/(a(e)+a(-e))}})},{222:222,226:226}],312:[function(e,t,r){var n=e(222);n(n.S,"Math",{trunc:function(e){return(e>0?Math.floor:Math.ceil)(e)}})},{222:222}],313:[function(e,t,r){"use strict";var n=e(247),i=e(232),a=e(233),s=e(215),o=e(240),u=e(227),p="Number",l=i[p],c=l,f=l.prototype,d=s(n.create(f))==p,h=function(e){var t,r;if("function"==typeof(t=e.valueOf)&&!o(r=t.call(e)))return r;if("function"==typeof(t=e.toString)&&!o(r=t.call(e)))return r;throw TypeError("Can't convert object to number")},m=function(e){if(o(e)&&(e=h(e)),"string"==typeof e&&e.length>2&&48==e.charCodeAt(0)){var t=!1;switch(e.charCodeAt(1)){case 66:case 98:t=!0;case 79:case 111:return parseInt(e.slice(2),t?2:8)}}return+e};l("0o1")&&l("0b1")||(l=function(e){var t=this;return t instanceof l&&(d?u(function(){f.valueOf.call(t)}):s(t)!=p)?new c(m(e)):m(e)},n.each.call(e(272)?n.getNames(c):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),function(e){a(c,e)&&!a(l,e)&&n.setDesc(l,e,n.getDesc(c,e))}),l.prototype=f,f.constructor=l,e(259)(i,p,l))},{215:215,227:227,232:232,233:233,240:240,247:247,259:259,272:272}],314:[function(e,t,r){var n=e(222);n(n.S,"Number",{EPSILON:Math.pow(2,-52)})},{222:222}],315:[function(e,t,r){var n=e(222),i=e(232).isFinite;n(n.S,"Number",{isFinite:function(e){return"number"==typeof e&&i(e)}})},{222:222,232:232}],316:[function(e,t,r){var n=e(222);n(n.S,"Number",{isInteger:e(239)})},{222:222,239:239}],317:[function(e,t,r){var n=e(222);n(n.S,"Number",{isNaN:function(e){return e!=e}})},{222:222}],318:[function(e,t,r){var n=e(222),i=e(239),a=Math.abs;n(n.S,"Number",{isSafeInteger:function(e){return i(e)&&a(e)<=9007199254740991}})},{222:222,239:239}],319:[function(e,t,r){var n=e(222);n(n.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},{222:222}],320:[function(e,t,r){var n=e(222);n(n.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},{222:222}],321:[function(e,t,r){var n=e(222);n(n.S,"Number",{parseFloat:parseFloat})},{222:222}],322:[function(e,t,r){var n=e(222);n(n.S,"Number",{parseInt:parseInt})},{222:222}],323:[function(e,t,r){var n=e(222);n(n.S+n.F,"Object",{assign:e(213)})},{213:213,222:222}],324:[function(e,t,r){var n=e(240);e(253)("freeze",function(e){return function(t){return e&&n(t)?e(t):t}})},{240:240,253:253}],325:[function(e,t,r){var n=e(277);e(253)("getOwnPropertyDescriptor",function(e){return function(t,r){return e(n(t),r)}})},{253:253,277:277}],326:[function(e,t,r){e(253)("getOwnPropertyNames",function(){return e(231).get})},{231:231,253:253}],327:[function(e,t,r){var n=e(279);e(253)("getPrototypeOf",function(e){return function(t){return e(n(t))}})},{253:253,279:279}],328:[function(e,t,r){var n=e(240);e(253)("isExtensible",function(e){return function(t){return n(t)?e?e(t):!0:!1}})},{240:240,253:253}],329:[function(e,t,r){var n=e(240);e(253)("isFrozen",function(e){return function(t){return n(t)?e?e(t):!1:!0}})},{240:240,253:253}],330:[function(e,t,r){var n=e(240);e(253)("isSealed",function(e){return function(t){return n(t)?e?e(t):!1:!0}})},{240:240,253:253}],331:[function(e,t,r){var n=e(222);n(n.S,"Object",{is:e(261)})},{222:222,261:261}],332:[function(e,t,r){var n=e(279);e(253)("keys",function(e){return function(t){return e(n(t))}})},{253:253,279:279}],333:[function(e,t,r){var n=e(240);e(253)("preventExtensions",function(e){return function(t){return e&&n(t)?e(t):t}})},{240:240,253:253}],334:[function(e,t,r){var n=e(240);e(253)("seal",function(e){return function(t){return e&&n(t)?e(t):t}})},{240:240,253:253}],335:[function(e,t,r){var n=e(222);n(n.S,"Object",{setPrototypeOf:e(262).set})},{222:222,262:262}],336:[function(e,t,r){"use strict";var n=e(214),i={};i[e(282)("toStringTag")]="z",i+""!="[object z]"&&e(259)(Object.prototype,"toString",function(){return"[object "+n(this)+"]"},!0)},{214:214,259:259,282:282}],337:[function(e,t,r){"use strict";var n,i=e(247),a=e(249),s=e(232),o=e(221),u=e(214),p=e(222),l=e(240),c=e(210),f=e(209),d=e(266),h=e(230),m=e(262).set,y=e(261),g=e(265),v=e(282)("species"),b=e(280)("record"),E=e(251),x="Promise",S=s.process,A="process"==u(S),D=s[x],C=function(e){var t=new D(function(){});return e&&(t.constructor=Object),D.resolve(t)===t},w=function(){function t(e){var r=new D(e);return m(r,t.prototype),r}var r=!1;try{if(r=D&&D.resolve&&C(),m(t,D),t.prototype=i.create(D.prototype,{constructor:{value:t}}),t.resolve(5).then(function(){})instanceof t||(r=!1),r&&e(272)){var n=!1;D.resolve(i.setDesc({},"then",{get:function(){n=!0}})),r=n}}catch(a){r=!1}return r}(),I=function(e){return l(e)&&(w?"Promise"==u(e):b in e)},_=function(e,t){return a&&e===D&&t===n?!0:y(e,t)},F=function(e){var t=c(e)[v];return void 0!=t?t:e},k=function(e){var t;return l(e)&&"function"==typeof(t=e.then)?t:!1},P=function(e,t){if(!e.n){e.n=!0;var r=e.c;E(function(){for(var n=e.v,i=1==e.s,a=0,o=function(t){var r,a,s=i?t.ok:t.fail;try{s?(i||(e.h=!0),r=s===!0?n:s(n),r===t.P?t.rej(TypeError("Promise-chain cycle")):(a=k(r))?a.call(r,t.res,t.rej):t.res(r)):t.rej(n)}catch(o){t.rej(o)}};r.length>a;)o(r[a++]);r.length=0,e.n=!1,t&&setTimeout(function(){B(e.p)&&(A?S.emit("unhandledRejection",n,e.p):s.console&&console.error&&console.error("Unhandled promise rejection",n)),e.a=void 0},1)})}},B=function(e){var t,r=e[b],n=r.a||r.c,i=0;if(r.h)return!1;for(;n.length>i;)if(t=n[i++],t.fail||!B(t.P))return!1;return!0},T=function(e){var t=this;t.d||(t.d=!0,t=t.r||t,t.v=e,t.s=2,t.a=t.c.slice(),P(t,!0))},M=function(e){var t,r=this;if(!r.d){r.d=!0,r=r.r||r;try{(t=k(e))?E(function(){var n={r:r,d:!1};try{t.call(e,o(M,n,1),o(T,n,1))}catch(i){T.call(n,i)}}):(r.v=e,r.s=1,P(r,!1))}catch(n){T.call({r:r,d:!1},n)}}};w||(D=function(e){f(e);var t={p:d(this,D,x),c:[],a:void 0,s:0,d:!1,v:void 0,h:!1,n:!1};this[b]=t;try{e(o(M,t,1),o(T,t,1))}catch(r){T.call(t,r)}},e(252)(D.prototype,{then:function(e,t){var r=c(c(this).constructor)[v],n={ok:"function"==typeof e?e:!0,fail:"function"==typeof t?t:!1},i=n.P=new(void 0!=r?r:D)(function(e,t){n.res=f(e),n.rej=f(t)}),a=this[b];return a.c.push(n),a.a&&a.a.push(n),a.s&&P(a,!1),i},"catch":function(e){return this.then(void 0,e)}})),p(p.G+p.W+p.F*!w,{Promise:D}),e(273)(D,x),g(D),g(n=e(220)[x]),p(p.S+p.F*!w,x,{reject:function(e){return new this(function(t,r){r(e)})}}),p(p.S+p.F*(!w||C(!0)),x,{resolve:function(e){return I(e)&&_(e.constructor,this)?e:new this(function(t){t(e)})}}),p(p.S+p.F*!(w&&e(244)(function(e){D.all(e)["catch"](function(){})})),x,{all:function(e){var t=F(this),r=[];return new t(function(n,a){h(e,!1,r.push,r);var s=r.length,o=Array(s);s?i.each.call(r,function(e,r){t.resolve(e).then(function(e){o[r]=e,--s||n(o)},a)}):n(o)})},race:function(e){var t=F(this);return new t(function(r,n){h(e,!1,function(e){t.resolve(e).then(r,n)})})}})},{209:209,210:210,214:214,220:220,221:221,222:222,230:230,232:232,240:240,244:244,247:247,249:249,251:251,252:252,261:261,262:262,265:265,266:266,272:272,273:273,280:280,282:282}],338:[function(e,t,r){var n=e(222),i=Function.apply;n(n.S,"Reflect",{apply:function(e,t,r){return i.call(e,t,r)}})},{222:222}],339:[function(e,t,r){var n=e(247),i=e(222),a=e(209),s=e(210),o=e(240),u=Function.bind||e(220).Function.prototype.bind;i(i.S+i.F*e(227)(function(){function e(){}return!(Reflect.construct(function(){},[],e)instanceof e)}),"Reflect",{construct:function(e,t){a(e);var r=arguments.length<3?e:a(arguments[2]);if(e==r){if(void 0!=t)switch(s(t).length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var i=[null];return i.push.apply(i,t),new(u.apply(e,i))}var p=r.prototype,l=n.create(o(p)?p:Object.prototype),c=Function.apply.call(e,l,t);return o(c)?c:l;
}})},{209:209,210:210,220:220,222:222,227:227,240:240,247:247}],340:[function(e,t,r){var n=e(247),i=e(222),a=e(210);i(i.S+i.F*e(227)(function(){Reflect.defineProperty(n.setDesc({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(e,t,r){a(e);try{return n.setDesc(e,t,r),!0}catch(i){return!1}}})},{210:210,222:222,227:227,247:247}],341:[function(e,t,r){var n=e(222),i=e(247).getDesc,a=e(210);n(n.S,"Reflect",{deleteProperty:function(e,t){var r=i(a(e),t);return r&&!r.configurable?!1:delete e[t]}})},{210:210,222:222,247:247}],342:[function(e,t,r){"use strict";var n=e(222),i=e(210),a=function(e){this._t=i(e),this._i=0;var t,r=this._k=[];for(t in e)r.push(t)};e(242)(a,"Object",function(){var e,t=this,r=t._k;do if(t._i>=r.length)return{value:void 0,done:!0};while(!((e=r[t._i++])in t._t));return{value:e,done:!1}}),n(n.S,"Reflect",{enumerate:function(e){return new a(e)}})},{210:210,222:222,242:242}],343:[function(e,t,r){var n=e(247),i=e(222),a=e(210);i(i.S,"Reflect",{getOwnPropertyDescriptor:function(e,t){return n.getDesc(a(e),t)}})},{210:210,222:222,247:247}],344:[function(e,t,r){var n=e(222),i=e(247).getProto,a=e(210);n(n.S,"Reflect",{getPrototypeOf:function(e){return i(a(e))}})},{210:210,222:222,247:247}],345:[function(e,t,r){function n(e,t){var r,s,p=arguments.length<3?e:arguments[2];return u(e)===p?e[t]:(r=i.getDesc(e,t))?a(r,"value")?r.value:void 0!==r.get?r.get.call(p):void 0:o(s=i.getProto(e))?n(s,t,p):void 0}var i=e(247),a=e(233),s=e(222),o=e(240),u=e(210);s(s.S,"Reflect",{get:n})},{210:210,222:222,233:233,240:240,247:247}],346:[function(e,t,r){var n=e(222);n(n.S,"Reflect",{has:function(e,t){return t in e}})},{222:222}],347:[function(e,t,r){var n=e(222),i=e(210),a=Object.isExtensible;n(n.S,"Reflect",{isExtensible:function(e){return i(e),a?a(e):!0}})},{210:210,222:222}],348:[function(e,t,r){var n=e(222);n(n.S,"Reflect",{ownKeys:e(255)})},{222:222,255:255}],349:[function(e,t,r){var n=e(222),i=e(210),a=Object.preventExtensions;n(n.S,"Reflect",{preventExtensions:function(e){i(e);try{return a&&a(e),!0}catch(t){return!1}}})},{210:210,222:222}],350:[function(e,t,r){var n=e(222),i=e(262);i&&n(n.S,"Reflect",{setPrototypeOf:function(e,t){i.check(e,t);try{return i.set(e,t),!0}catch(r){return!1}}})},{222:222,262:262}],351:[function(e,t,r){function n(e,t,r){var s,l,c=arguments.length<4?e:arguments[3],f=i.getDesc(u(e),t);if(!f){if(p(l=i.getProto(e)))return n(l,t,r,c);f=o(0)}return a(f,"value")?f.writable!==!1&&p(c)?(s=i.getDesc(c,t)||o(0),s.value=r,i.setDesc(c,t,s),!0):!1:void 0===f.set?!1:(f.set.call(c,r),!0)}var i=e(247),a=e(233),s=e(222),o=e(258),u=e(210),p=e(240);s(s.S,"Reflect",{set:n})},{210:210,222:222,233:233,240:240,247:247,258:258}],352:[function(e,t,r){var n=e(247),i=e(232),a=e(215),s=e(229),o=i.RegExp,u=o,p=o.prototype,l=/a/g,c=new o(l)!==l,f=function(){try{return"/a/i"==o(l,"i")}catch(e){}}();e(272)&&(c&&f||(o=function(e,t){var r="RegExp"==a(e),n=void 0===t;return this instanceof o||!r||!n?c?new u(r&&!n?e.source:e,t):new u(r?e.source:e,r&&n?s.call(e):t):e},n.each.call(n.getNames(u),function(e){e in o||n.setDesc(o,e,{configurable:!0,get:function(){return u[e]},set:function(t){u[e]=t}})}),p.constructor=o,o.prototype=p,e(259)(i,"RegExp",o))),e(265)(o)},{215:215,229:229,232:232,247:247,259:259,265:265,272:272}],353:[function(e,t,r){var n=e(247);e(272)&&"g"!=/./g.flags&&n.setDesc(RegExp.prototype,"flags",{configurable:!0,get:e(229)})},{229:229,247:247,272:272}],354:[function(e,t,r){e(228)("match",1,function(e,t){return function(r){"use strict";var n=e(this),i=void 0==r?void 0:r[t];return void 0!==i?i.call(r,n):new RegExp(r)[t](String(n))}})},{228:228}],355:[function(e,t,r){e(228)("replace",2,function(e,t,r){return function(n,i){"use strict";var a=e(this),s=void 0==n?void 0:n[t];return void 0!==s?s.call(n,a,i):r.call(String(a),n,i)}})},{228:228}],356:[function(e,t,r){e(228)("search",1,function(e,t){return function(r){"use strict";var n=e(this),i=void 0==r?void 0:r[t];return void 0!==i?i.call(r,n):new RegExp(r)[t](String(n))}})},{228:228}],357:[function(e,t,r){e(228)("split",2,function(e,t,r){return function(n,i){"use strict";var a=e(this),s=void 0==n?void 0:n[t];return void 0!==s?s.call(n,a,i):r.call(String(a),n,i)}})},{228:228}],358:[function(e,t,r){"use strict";var n=e(216);e(219)("Set",function(e){return function(){return e(this,arguments[0])}},{add:function(e){return n.def(this,e=0===e?0:e,e)}},n)},{216:216,219:219}],359:[function(e,t,r){"use strict";var n=e(222),i=e(267)(!1);n(n.P,"String",{codePointAt:function(e){return i(this,e)}})},{222:222,267:267}],360:[function(e,t,r){"use strict";var n=e(222),i=e(278),a=e(268);n(n.P+n.F*!e(227)(function(){"q".endsWith(/./)}),"String",{endsWith:function(e){var t=a(this,e,"endsWith"),r=arguments[1],n=i(t.length),s=void 0===r?n:Math.min(i(r),n),o=String(e);return t.slice(s-o.length,s)===o}})},{222:222,227:227,268:268,278:278}],361:[function(e,t,r){var n=e(222),i=e(275),a=String.fromCharCode,s=String.fromCodePoint;n(n.S+n.F*(!!s&&1!=s.length),"String",{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,s=0;n>s;){if(t=+arguments[s++],i(t,1114111)!==t)throw RangeError(t+" is not a valid code point");r.push(65536>t?a(t):a(((t-=65536)>>10)+55296,t%1024+56320))}return r.join("")}})},{222:222,275:275}],362:[function(e,t,r){"use strict";var n=e(222),i=e(268);n(n.P,"String",{includes:function(e){return!!~i(this,e,"includes").indexOf(e,arguments[1])}})},{222:222,268:268}],363:[function(e,t,r){"use strict";var n=e(267)(!0);e(243)(String,"String",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,r=this._i;return r>=t.length?{value:void 0,done:!0}:(e=n(t,r),this._i+=e.length,{value:e,done:!1})})},{243:243,267:267}],364:[function(e,t,r){var n=e(222),i=e(277),a=e(278);n(n.S,"String",{raw:function(e){for(var t=i(e.raw),r=a(t.length),n=arguments.length,s=[],o=0;r>o;)s.push(String(t[o++])),n>o&&s.push(String(arguments[o]));return s.join("")}})},{222:222,277:277,278:278}],365:[function(e,t,r){var n=e(222);n(n.P,"String",{repeat:e(270)})},{222:222,270:270}],366:[function(e,t,r){"use strict";var n=e(222),i=e(278),a=e(268);n(n.P+n.F*!e(227)(function(){"q".startsWith(/./)}),"String",{startsWith:function(e){var t=a(this,e,"startsWith"),r=i(Math.min(arguments[1],t.length)),n=String(e);return t.slice(r,r+n.length)===n}})},{222:222,227:227,268:268,278:278}],367:[function(e,t,r){"use strict";e(271)("trim",function(e){return function(){return e(this,3)}})},{271:271}],368:[function(e,t,r){"use strict";var n=e(247),i=e(232),a=e(233),s=e(272),o=e(222),u=e(259),p=e(263),l=e(273),c=e(280),f=e(282),d=e(248),h=e(231),m=e(225),y=e(240),g=e(210),v=e(277),b=e(258),E=n.getDesc,x=n.setDesc,S=n.create,A=h.get,D=i.Symbol,C=!1,w=f("_hidden"),I=n.isEnum,_=p("symbol-registry"),F=p("symbols"),k="function"==typeof D,P=Object.prototype,B=s?function(){try{return S(x({},w,{get:function(){return x(this,w,{value:!1})[w]}}))[w]||x}catch(e){return function(e,t,r){var n=E(P,t);n&&delete P[t],x(e,t,r),n&&e!==P&&x(P,t,n)}}}():x,T=function(e){var t=F[e]=S(D.prototype);return t._k=e,s&&C&&B(P,e,{configurable:!0,set:function(t){a(this,w)&&a(this[w],e)&&(this[w][e]=!1),B(this,e,b(1,t))}}),t},M=function(e,t,r){return r&&a(F,t)?(r.enumerable?(a(e,w)&&e[w][t]&&(e[w][t]=!1),r=S(r,{enumerable:b(0,!1)})):(a(e,w)||x(e,w,b(1,{})),e[w][t]=!0),B(e,t,r)):x(e,t,r)},O=function(e,t){g(e);for(var r,n=m(t=v(t)),i=0,a=n.length;a>i;)M(e,r=n[i++],t[r]);return e},j=function(e,t){return void 0===t?S(e):O(S(e),t)},L=function(e){var t=I.call(this,e);return t||!a(this,e)||!a(F,e)||a(this,w)&&this[w][e]?t:!0},N=function(e,t){var r=E(e=v(e),t);return!r||!a(F,t)||a(e,w)&&e[w][t]||(r.enumerable=!0),r},R=function(e){for(var t,r=A(v(e)),n=[],i=0;r.length>i;)a(F,t=r[i++])||t==w||n.push(t);return n},V=function(e){for(var t,r=A(v(e)),n=[],i=0;r.length>i;)a(F,t=r[i++])&&n.push(F[t]);return n};k||(D=function(){if(this instanceof D)throw TypeError("Symbol is not a constructor");return T(c(arguments[0]))},u(D.prototype,"toString",function(){return this._k}),n.create=j,n.isEnum=L,n.getDesc=N,n.setDesc=M,n.setDescs=O,n.getNames=h.get=R,n.getSymbols=V,s&&!e(249)&&u(P,"propertyIsEnumerable",L,!0)),(!k||e(227)(function(){return"[{},[null]]"!=JSON.stringify([{a:D()},[D()]])}))&&u(D.prototype,"toJSON",function(){return k&&y(this)?this:void 0});var U={"for":function(e){return a(_,e+="")?_[e]:_[e]=D(e)},keyFor:function(e){return d(_,e)},useSetter:function(){C=!0},useSimple:function(){C=!1}};n.each.call("hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),function(e){var t=f(e);U[e]=k?t:T(t)}),C=!0,o(o.G+o.W,{Symbol:D}),o(o.S,"Symbol",U),o(o.S+o.F*!k,"Object",{create:j,defineProperty:M,defineProperties:O,getOwnPropertyDescriptor:N,getOwnPropertyNames:R,getOwnPropertySymbols:V}),l(D,"Symbol"),l(Math,"Math",!0),l(i.JSON,"JSON",!0)},{210:210,222:222,225:225,227:227,231:231,232:232,233:233,240:240,247:247,248:248,249:249,258:258,259:259,263:263,272:272,273:273,277:277,280:280,282:282}],369:[function(e,t,r){"use strict";var n=e(247),i=e(218),a=e(240),s=e(233),o=i.frozenStore,u=i.WEAK,p=Object.isExtensible||a,l={},c=e(219)("WeakMap",function(e){return function(){return e(this,arguments[0])}},{get:function(e){if(a(e)){if(!p(e))return o(this).get(e);if(s(e,u))return e[u][this._i]}},set:function(e,t){return i.def(this,e,t)}},i,!0,!0);7!=(new c).set((Object.freeze||Object)(l),7).get(l)&&n.each.call(["delete","has","get","set"],function(t){var r=c.prototype,n=r[t];e(259)(r,t,function(e,r){if(a(e)&&!p(e)){var i=o(this)[t](e,r);return"set"==t?this:i}return n.call(this,e,r)})})},{218:218,219:219,233:233,240:240,247:247,259:259}],370:[function(e,t,r){"use strict";var n=e(218);e(219)("WeakSet",function(e){return function(){return e(this,arguments[0])}},{add:function(e){return n.def(this,e,!0)}},n,!1,!0)},{218:218,219:219}],371:[function(e,t,r){"use strict";var n=e(222),i=e(211)(!0);n(n.P,"Array",{includes:function(e){return i(this,e,arguments[1])}}),e(281)("includes")},{211:211,222:222,281:281}],372:[function(e,t,r){var n=e(222);n(n.P,"Map",{toJSON:e(217)("Map")})},{217:217,222:222}],373:[function(e,t,r){var n=e(222),i=e(254)(!0);n(n.S,"Object",{entries:function(e){return i(e)}})},{222:222,254:254}],374:[function(e,t,r){var n=e(247),i=e(222),a=e(255),s=e(277),o=e(258);i(i.S,"Object",{getOwnPropertyDescriptors:function(e){for(var t,r,i=s(e),u=n.setDesc,p=n.getDesc,l=a(i),c={},f=0;l.length>f;)r=p(i,t=l[f++]),t in c?u(c,t,o(0,r)):c[t]=r;return c}})},{222:222,247:247,255:255,258:258,277:277}],375:[function(e,t,r){var n=e(222),i=e(254)(!1);n(n.S,"Object",{values:function(e){return i(e)}})},{222:222,254:254}],376:[function(e,t,r){var n=e(222),i=e(260)(/[\\^$*+?.()|[\]{}]/g,"\\$&");n(n.S,"RegExp",{escape:function(e){return i(e)}})},{222:222,260:260}],377:[function(e,t,r){var n=e(222);n(n.P,"Set",{toJSON:e(217)("Set")})},{217:217,222:222}],378:[function(e,t,r){"use strict";var n=e(222),i=e(267)(!0);n(n.P,"String",{at:function(e){return i(this,e)}})},{222:222,267:267}],379:[function(e,t,r){"use strict";var n=e(222),i=e(269);n(n.P,"String",{padLeft:function(e){return i(this,e,arguments[1],!0)}})},{222:222,269:269}],380:[function(e,t,r){"use strict";var n=e(222),i=e(269);n(n.P,"String",{padRight:function(e){return i(this,e,arguments[1],!1)}})},{222:222,269:269}],381:[function(e,t,r){"use strict";e(271)("trimLeft",function(e){return function(){return e(this,1)}})},{271:271}],382:[function(e,t,r){"use strict";e(271)("trimRight",function(e){return function(){return e(this,2)}})},{271:271}],383:[function(e,t,r){var n=e(247),i=e(222),a=e(220).Array||Array,s={},o=function(t,r){n.each.call(t.split(","),function(t){void 0==r&&t in a?s[t]=a[t]:t in[]&&(s[t]=e(221)(Function.call,[][t],r))})};o("pop,reverse,shift,keys,values,entries",1),o("indexOf,every,some,forEach,map,filter,find,findIndex,includes",3),o("join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill"),i(i.S,"Array",s)},{220:220,221:221,222:222,247:247}],384:[function(e,t,r){e(290);var n=e(232),i=e(234),a=e(246),s=e(282)("iterator"),o=n.NodeList,u=n.HTMLCollection,p=o&&o.prototype,l=u&&u.prototype,c=a.NodeList=a.HTMLCollection=a.Array;!o||s in p||i(p,s,c),!u||s in l||i(l,s,c)},{232:232,234:234,246:246,282:282,290:290}],385:[function(e,t,r){var n=e(222),i=e(274);n(n.G+n.B,{setImmediate:i.set,clearImmediate:i.clear})},{222:222,274:274}],386:[function(e,t,r){var n=e(232),i=e(222),a=e(236),s=e(256),o=n.navigator,u=!!o&&/MSIE .\./.test(o.userAgent),p=function(e){return u?function(t,r){return e(a(s,[].slice.call(arguments,2),"function"==typeof t?t:Function(t)),r)}:e};i(i.G+i.B+i.F*u,{setTimeout:p(n.setTimeout),setInterval:p(n.setInterval)})},{222:222,232:232,236:236,256:256}],387:[function(e,t,r){e(284),e(368),e(323),e(331),e(335),e(336),e(324),e(334),e(333),e(329),e(330),e(328),e(325),e(327),e(332),e(326),e(294),e(293),e(313),e(314),e(315),e(316),e(317),e(318),e(319),e(320),e(321),e(322),e(296),e(297),e(298),e(299),e(300),e(301),e(302),e(303),e(304),e(305),e(306),e(307),e(308),e(309),e(310),e(311),e(312),e(361),e(364),e(367),e(363),e(359),e(360),e(362),e(365),e(366),e(289),e(291),e(290),e(292),e(285),e(286),e(288),e(287),e(352),e(353),e(354),e(355),e(356),e(357),e(337),e(295),e(358),e(369),e(370),e(338),e(339),e(340),e(341),e(342),e(345),e(343),e(344),e(346),e(347),e(348),e(349),e(351),e(350),e(371),e(378),e(379),e(380),e(381),e(382),e(376),e(374),e(375),e(373),e(372),e(377),e(383),e(386),e(385),e(384),t.exports=e(220)},{220:220,284:284,285:285,286:286,287:287,288:288,289:289,290:290,291:291,292:292,293:293,294:294,295:295,296:296,297:297,298:298,299:299,300:300,301:301,302:302,303:303,304:304,305:305,306:306,307:307,308:308,309:309,310:310,311:311,312:312,313:313,314:314,315:315,316:316,317:317,318:318,319:319,320:320,321:321,322:322,323:323,324:324,325:325,326:326,327:327,328:328,329:329,330:330,331:331,332:332,333:333,334:334,335:335,336:336,337:337,338:338,339:339,340:340,341:341,342:342,343:343,344:344,345:345,346:346,347:347,348:348,349:349,350:350,351:351,352:352,353:353,354:354,355:355,356:356,357:357,358:358,359:359,360:360,361:361,362:362,363:363,364:364,365:365,366:366,367:367,368:368,369:369,370:370,371:371,372:372,373:373,374:374,375:375,376:376,377:377,378:378,379:379,380:380,381:381,382:382,383:383,384:384,385:385,386:386}],388:[function(e,t,r){function n(){return r.colors[l++%r.colors.length]}function i(e){function t(){}function i(){var e=i,t=+new Date,a=t-(p||t);e.diff=a,e.prev=p,e.curr=t,p=t,null==e.useColors&&(e.useColors=r.useColors()),null==e.color&&e.useColors&&(e.color=n());var s=Array.prototype.slice.call(arguments);s[0]=r.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var o=0;s[0]=s[0].replace(/%([a-z%])/g,function(t,n){if("%%"===t)return t;o++;var i=r.formatters[n];if("function"==typeof i){var a=s[o];t=i.call(e,a),s.splice(o,1),o--}return t}),"function"==typeof r.formatArgs&&(s=r.formatArgs.apply(e,s));var u=i.log||r.log||console.log.bind(console);u.apply(e,s)}t.enabled=!1,i.enabled=!0;var a=r.enabled(e)?i:t;return a.namespace=e,a}function a(e){r.save(e);for(var t=(e||"").split(/[\s,]+/),n=t.length,i=0;n>i;i++)t[i]&&(e=t[i].replace(/\*/g,".*?"),"-"===e[0]?r.skips.push(new RegExp("^"+e.substr(1)+"$")):r.names.push(new RegExp("^"+e+"$")))}function s(){r.enable("")}function o(e){var t,n;for(t=0,n=r.skips.length;n>t;t++)if(r.skips[t].test(e))return!1;for(t=0,n=r.names.length;n>t;t++)if(r.names[t].test(e))return!0;return!1}function u(e){return e instanceof Error?e.stack||e.message:e}r=t.exports=i,r.coerce=u,r.disable=s,r.enable=a,r.enabled=o,r.humanize=e(390),r.names=[],r.skips=[],r.formatters={};var p,l=0},{390:390}],389:[function(e,t,r){(function(n){function i(){var e=(n.env.DEBUG_COLORS||"").trim().toLowerCase();return 0===e.length?l.isatty(f):"0"!==e&&"no"!==e&&"false"!==e&&"disabled"!==e}function a(){var e=arguments,t=this.useColors,n=this.namespace;if(t){var i=this.color;e[0]=" [3"+i+";1m"+n+" [0m"+e[0]+"[3"+i+"m +"+r.humanize(this.diff)+"[0m"}else e[0]=(new Date).toUTCString()+" "+n+" "+e[0];return e}function s(){return d.write(c.format.apply(this,arguments)+"\n")}function o(e){null==e?delete n.env.DEBUG:n.env.DEBUG=e}function u(){return n.env.DEBUG}function p(t){var r,i=n.binding("tty_wrap");switch(i.guessHandleType(t)){case"TTY":r=new l.WriteStream(t),r._type="tty",r._handle&&r._handle.unref&&r._handle.unref();break;case"FILE":var a=e(1);r=new a.SyncWriteStream(t,{autoClose:!1}),r._type="fs";break;case"PIPE":case"TCP":var s=e(1);r=new s.Socket({fd:t,readable:!1,writable:!0}),r.readable=!1,r.read=null,r._type="pipe",r._handle&&r._handle.unref&&r._handle.unref();break;default:throw new Error("Implement me. Unknown stream file type!")}return r.fd=t,r._isStdio=!0,r}var l=e(11),c=e(13);r=t.exports=e(388),r.log=s,r.formatArgs=a,r.save=o,r.load=u,r.useColors=i,r.colors=[6,2,3,4,5,1];var f=parseInt(n.env.DEBUG_FD,10)||2,d=1===f?n.stdout:2===f?n.stderr:p(f),h=4===c.inspect.length?function(e,t){return c.inspect(e,void 0,void 0,t)}:function(e,t){return c.inspect(e,{colors:t})};r.formatters.o=function(e){return h(e,this.useColors).replace(/\s*\n\s*/g," ")},r.enable(u())}).call(this,e(10))},{1:1,10:10,11:11,13:13,388:388}],390:[function(e,t,r){function n(e){if(e=""+e,!(e.length>1e4)){var t=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(e);if(t){var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*c;case"days":case"day":case"d":return r*l;case"hours":case"hour":case"hrs":case"hr":case"h":return r*p;case"minutes":case"minute":case"mins":case"min":case"m":return r*u;case"seconds":case"second":case"secs":case"sec":case"s":return r*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r}}}}function i(e){return e>=l?Math.round(e/l)+"d":e>=p?Math.round(e/p)+"h":e>=u?Math.round(e/u)+"m":e>=o?Math.round(e/o)+"s":e+"ms"}function a(e){return s(e,l,"day")||s(e,p,"hour")||s(e,u,"minute")||s(e,o,"second")||e+" ms"}function s(e,t,r){return t>e?void 0:1.5*t>e?Math.floor(e/t)+" "+r:Math.ceil(e/t)+" "+r+"s"}var o=1e3,u=60*o,p=60*u,l=24*p,c=365.25*l;t.exports=function(e,t){return t=t||{},"string"==typeof e?n(e):t["long"]?a(e):i(e)}},{}],391:[function(e,t,r){"use strict";function n(e){var t=0,r=0,n=0;for(var i in e){var a=e[i],s=a[0],o=a[1];(s>r||s===r&&o>n)&&(r=s,n=o,t=+i)}return t}var i=e(584),a=/^(?:( )+|\t+)/;t.exports=function(e){if("string"!=typeof e)throw new TypeError("Expected a string");var t,r,s=0,o=0,u=0,p={};e.split(/\n/g).forEach(function(e){if(e){var n,i=e.match(a);i?(n=i[0].length,i[1]?o++:s++):n=0;var l=n-u;u=n,l?(r=l>0,t=p[r?l:-l],t?t[0]++:t=p[l]=[1,0]):t&&(t[1]+=+r)}});var l,c,f=n(p);return f?o>=s?(l="space",c=i(" ",f)):(l="tab",c=i(" ",f)):(l=null,c=""),{amount:f,type:l,indent:c}}},{584:584}],392:[function(e,t,r){!function(){"use strict";function e(e){if(null==e)return!1;switch(e.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return!0}return!1}function r(e){if(null==e)return!1;switch(e.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return!0}return!1}function n(e){if(null==e)return!1;switch(e.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return!0}return!1}function i(e){return n(e)||null!=e&&"FunctionDeclaration"===e.type}function a(e){switch(e.type){case"IfStatement":return null!=e.alternate?e.alternate:e.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return e.body}return null}function s(e){var t;if("IfStatement"!==e.type)return!1;if(null==e.alternate)return!1;t=e.consequent;do{if("IfStatement"===t.type&&null==t.alternate)return!0;t=a(t)}while(t);return!1}t.exports={isExpression:e,isStatement:n,isIterationStatement:r,isSourceElement:i,isProblematicIfStatement:s,trailingStatement:a}}()},{}],393:[function(e,t,r){!function(){"use strict";function e(e){return e>=48&&57>=e}function r(e){return e>=48&&57>=e||e>=97&&102>=e||e>=65&&70>=e}function n(e){return e>=48&&55>=e}function i(e){return 32===e||9===e||11===e||12===e||160===e||e>=5760&&d.indexOf(e)>=0}function a(e){return 10===e||13===e||8232===e||8233===e}function s(e){if(65535>=e)return String.fromCharCode(e);var t=String.fromCharCode(Math.floor((e-65536)/1024)+55296),r=String.fromCharCode((e-65536)%1024+56320);return t+r}function o(e){return 128>e?h[e]:f.NonAsciiIdentifierStart.test(s(e))}function u(e){return 128>e?m[e]:f.NonAsciiIdentifierPart.test(s(e))}function p(e){return 128>e?h[e]:c.NonAsciiIdentifierStart.test(s(e))}function l(e){return 128>e?m[e]:c.NonAsciiIdentifierPart.test(s(e))}var c,f,d,h,m,y;for(f={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,NonAsciiIdentifierPart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/},c={NonAsciiIdentifierStart:/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B2\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDE00-\uDE11\uDE13-\uDE2B\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDE00-\uDE2F\uDE44\uDE80-\uDEAA]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]/,
NonAsciiIdentifierPart:/[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B2\u08E4-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58\u0C59\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D60-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA69D\uA69F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA7AD\uA7B0\uA7B1\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB5F\uAB64\uAB65\uABC0-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2D\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDD0-\uDDDA\uDE00-\uDE11\uDE13-\uDE37\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF01-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF98]|\uD809[\uDC00-\uDC6E]|[\uD80C\uD840-\uD868\uD86A-\uD86C][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/},d=[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279],h=new Array(128),y=0;128>y;++y)h[y]=y>=97&&122>=y||y>=65&&90>=y||36===y||95===y;for(m=new Array(128),y=0;128>y;++y)m[y]=y>=97&&122>=y||y>=65&&90>=y||y>=48&&57>=y||36===y||95===y;t.exports={isDecimalDigit:e,isHexDigit:r,isOctalDigit:n,isWhiteSpace:i,isLineTerminator:a,isIdentifierStartES5:o,isIdentifierPartES5:u,isIdentifierStartES6:p,isIdentifierPartES6:l}}()},{}],394:[function(e,t,r){!function(){"use strict";function r(e){switch(e){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return!0;default:return!1}}function n(e,t){return t||"yield"!==e?i(e,t):!1}function i(e,t){if(t&&r(e))return!0;switch(e.length){case 2:return"if"===e||"in"===e||"do"===e;case 3:return"var"===e||"for"===e||"new"===e||"try"===e;case 4:return"this"===e||"else"===e||"case"===e||"void"===e||"with"===e||"enum"===e;case 5:return"while"===e||"break"===e||"catch"===e||"throw"===e||"const"===e||"yield"===e||"class"===e||"super"===e;case 6:return"return"===e||"typeof"===e||"delete"===e||"switch"===e||"export"===e||"import"===e;case 7:return"default"===e||"finally"===e||"extends"===e;case 8:return"function"===e||"continue"===e||"debugger"===e;case 10:return"instanceof"===e;default:return!1}}function a(e,t){return"null"===e||"true"===e||"false"===e||n(e,t)}function s(e,t){return"null"===e||"true"===e||"false"===e||i(e,t)}function o(e){return"eval"===e||"arguments"===e}function u(e){var t,r,n;if(0===e.length)return!1;if(n=e.charCodeAt(0),!d.isIdentifierStartES5(n))return!1;for(t=1,r=e.length;r>t;++t)if(n=e.charCodeAt(t),!d.isIdentifierPartES5(n))return!1;return!0}function p(e,t){return 1024*(e-55296)+(t-56320)+65536}function l(e){var t,r,n,i,a;if(0===e.length)return!1;for(a=d.isIdentifierStartES6,t=0,r=e.length;r>t;++t){if(n=e.charCodeAt(t),n>=55296&&56319>=n){if(++t,t>=r)return!1;if(i=e.charCodeAt(t),!(i>=56320&&57343>=i))return!1;n=p(n,i)}if(!a(n))return!1;a=d.isIdentifierPartES6}return!0}function c(e,t){return u(e)&&!a(e,t)}function f(e,t){return l(e)&&!s(e,t)}var d=e(393);t.exports={isKeywordES5:n,isKeywordES6:i,isReservedWordES5:a,isReservedWordES6:s,isRestrictedWord:o,isIdentifierNameES5:u,isIdentifierNameES6:l,isIdentifierES5:c,isIdentifierES6:f}}()},{393:393}],395:[function(e,t,r){!function(){"use strict";r.ast=e(392),r.code=e(393),r.keyword=e(394)}()},{392:392,393:393,394:394}],396:[function(e,t,r){t.exports={builtin:{Array:!1,ArrayBuffer:!1,Boolean:!1,constructor:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Float32Array:!1,Float64Array:!1,Function:!1,hasOwnProperty:!1,Infinity:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,isFinite:!1,isNaN:!1,isPrototypeOf:!1,JSON:!1,Map:!1,Math:!1,NaN:!1,Number:!1,Object:!1,parseFloat:!1,parseInt:!1,Promise:!1,propertyIsEnumerable:!1,Proxy:!1,RangeError:!1,ReferenceError:!1,Reflect:!1,RegExp:!1,Set:!1,String:!1,Symbol:!1,SyntaxError:!1,System:!1,toLocaleString:!1,toString:!1,TypeError:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,undefined:!1,URIError:!1,valueOf:!1,WeakMap:!1,WeakSet:!1},nonstandard:{escape:!1,unescape:!1},browser:{addEventListener:!1,alert:!1,applicationCache:!1,atob:!1,Audio:!1,AudioProcessingEvent:!1,BeforeUnloadEvent:!1,Blob:!1,blur:!1,btoa:!1,cancelAnimationFrame:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,CloseEvent:!1,Comment:!1,CompositionEvent:!1,confirm:!1,console:!1,crypto:!1,CSS:!1,CustomEvent:!1,DataView:!1,Debug:!1,defaultStatus:!1,devicePixelRatio:!1,dispatchEvent:!1,document:!1,Document:!1,DocumentFragment:!1,DOMParser:!1,DragEvent:!1,Element:!1,ElementTimeControl:!1,ErrorEvent:!1,event:!1,Event:!1,FileReader:!1,fetch:!1,find:!1,focus:!1,FocusEvent:!1,FormData:!1,frameElement:!1,frames:!1,GamepadEvent:!1,getComputedStyle:!1,getSelection:!1,HashChangeEvent:!1,Headers:!1,history:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,IDBCursor:!1,IDBCursorWithValue:!1,IDBDatabase:!1,IDBEnvironment:!1,IDBFactory:!1,IDBIndex:!1,IDBKeyRange:!1,IDBObjectStore:!1,IDBOpenDBRequest:!1,IDBRequest:!1,IDBTransaction:!1,IDBVersionChangeEvent:!1,Image:!1,indexedDB:!1,innerHeight:!1,innerWidth:!1,InputEvent:!1,Intl:!1,KeyboardEvent:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,navigator:!1,Node:!1,NodeFilter:!1,NodeList:!1,Notification:!1,OfflineAudioCompletionEvent:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,opera:!1,Option:!1,outerHeight:!1,outerWidth:!1,PageTransitionEvent:!1,pageXOffset:!1,pageYOffset:!1,parent:!1,PopStateEvent:!1,postMessage:!1,print:!1,ProgressEvent:!1,prompt:!1,Range:!1,Request:!1,Response:!1,removeEventListener:!1,requestAnimationFrame:!1,resizeBy:!1,resizeTo:!1,screen:!1,screenX:!1,screenY:!1,scroll:!1,scrollbars:!1,scrollBy:!1,scrollTo:!1,scrollX:!1,scrollY:!1,self:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,showModalDialog:!1,status:!1,stop:!1,StorageEvent:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimationElement:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCSSRule:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGEvent:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLinearGradientElement:!1,SVGLineElement:!1,SVGLocatable:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGMPathElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSVGElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformable:!1,SVGTransformList:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGUnitTypes:!1,SVGURIReference:!1,SVGUseElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGVKernElement:!1,SVGZoomAndPan:!1,Text:!1,TextDecoder:!1,TextEncoder:!1,TimeEvent:!1,top:!1,TouchEvent:!1,UIEvent:!1,URL:!1,WebGLActiveInfo:!1,WebGLBuffer:!1,WebGLContextEvent:!1,WebGLFramebuffer:!1,WebGLProgram:!1,WebGLRenderbuffer:!1,WebGLRenderingContext:!1,WebGLShader:!1,WebGLShaderPrecisionFormat:!1,WebGLTexture:!1,WebGLUniformLocation:!1,WebSocket:!1,WheelEvent:!1,window:!1,Window:!1,Worker:!1,XDomainRequest:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},worker:{importScripts:!0,postMessage:!0,self:!0},node:{__dirname:!1,__filename:!1,arguments:!1,Buffer:!1,clearImmediate:!1,clearInterval:!1,clearTimeout:!1,console:!1,DataView:!1,exports:!0,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,setImmediate:!1,setInterval:!1,setTimeout:!1},amd:{define:!1,require:!1},mocha:{after:!1,afterEach:!1,before:!1,beforeEach:!1,context:!1,describe:!1,it:!1,setup:!1,specify:!1,suite:!1,suiteSetup:!1,suiteTeardown:!1,teardown:!1,test:!1,xcontext:!1,xdescribe:!1,xit:!1,xspecify:!1},jasmine:{afterAll:!1,afterEach:!1,beforeAll:!1,beforeEach:!1,describe:!1,expect:!1,fail:!1,fdescribe:!1,fit:!1,it:!1,jasmine:!1,pending:!1,runs:!1,spyOn:!1,waits:!1,waitsFor:!1,xdescribe:!1,xit:!1},qunit:{asyncTest:!1,deepEqual:!1,equal:!1,expect:!1,module:!1,notDeepEqual:!1,notEqual:!1,notPropEqual:!1,notStrictEqual:!1,ok:!1,propEqual:!1,QUnit:!1,raises:!1,start:!1,stop:!1,strictEqual:!1,test:!1,"throws":!1},phantomjs:{console:!0,exports:!0,phantom:!0,require:!0,WebPage:!0},couch:{emit:!1,exports:!1,getRow:!1,log:!1,module:!1,provides:!1,require:!1,respond:!1,send:!1,start:!1,sum:!1},rhino:{defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},wsh:{ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WScript:!0,WSH:!0,XDomainRequest:!0},jquery:{$:!1,jQuery:!1},yui:{Y:!1,YUI:!1,YUI_config:!1},shelljs:{cat:!1,cd:!1,chmod:!1,config:!1,cp:!1,dirs:!1,echo:!1,env:!1,error:!1,exec:!1,exit:!1,find:!1,grep:!1,ls:!1,mkdir:!1,mv:!1,popd:!1,pushd:!1,pwd:!1,rm:!1,sed:!1,target:!1,tempdir:!1,test:!1,which:!1},prototypejs:{$:!1,$$:!1,$A:!1,$break:!1,$continue:!1,$F:!1,$H:!1,$R:!1,$w:!1,Abstract:!1,Ajax:!1,Autocompleter:!1,Builder:!1,Class:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Element:!1,Enumerable:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Scriptaculous:!1,Selector:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Template:!1,Toggle:!1,Try:!1},meteor:{$:!1,_:!1,Accounts:!1,App:!1,Assets:!1,Blaze:!1,check:!1,Cordova:!1,DDP:!1,DDPServer:!1,Deps:!1,EJSON:!1,Email:!1,HTTP:!1,Log:!1,Match:!1,Meteor:!1,Mongo:!1,MongoInternals:!1,Npm:!1,Package:!1,Plugin:!1,process:!1,Random:!1,ReactiveDict:!1,ReactiveVar:!1,Router:!1,Session:!1,share:!1,Spacebars:!1,Template:!1,Tinytest:!1,Tracker:!1,UI:!1,Utils:!1,WebApp:!1,WebAppInternals:!1},mongo:{_isWindows:!1,_rand:!1,BulkWriteResult:!1,cat:!1,cd:!1,connect:!1,db:!1,getHostName:!1,getMemInfo:!1,hostname:!1,listFiles:!1,load:!1,ls:!1,md5sumFile:!1,mkdir:!1,Mongo:!1,ObjectId:!1,PlanCache:!1,pwd:!1,quit:!1,removeFile:!1,rs:!1,sh:!1,UUID:!1,version:!1,WriteResult:!1},applescript:{$:!1,Application:!1,Automation:!1,console:!1,delay:!1,Library:!1,ObjC:!1,ObjectSpecifier:!1,Path:!1,Progress:!1,Ref:!1}}},{}],397:[function(e,t,r){t.exports=e(396)},{396:396}],398:[function(e,t,r){var n=e(399);t.exports=Number.isInteger||function(e){return"number"==typeof e&&n(e)&&Math.floor(e)===e}},{399:399}],399:[function(e,t,r){"use strict";var n=e(400);t.exports=Number.isFinite||function(e){return!("number"!=typeof e||n(e)||e===1/0||e===-(1/0))}},{400:400}],400:[function(e,t,r){"use strict";t.exports=Number.isNaN||function(e){return e!==e}},{}],401:[function(e,t,r){t.exports=/((['"])(?:(?!\2|\\).|\\(?:\r\n|[\s\S]))*(\2)?|`(?:[^`\\$]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{[^}]*\}?)*\}?)*(`)?)|(\/\/.*)|(\/\*(?:[^*]|\*(?!\/))*(\*\/)?)|(\/(?!\*)(?:\[(?:(?![\]\\]).|\\.)*\]|(?![\/\]\\]).|\\.)+\/(?:(?!\s*(?:\b|[\u0080-\uFFFF$\\'"~({]|[+\-!](?!=)|\.?\d))|[gmiyu]{1,5}\b(?![\u0080-\uFFFF$\\]|\s*(?:[+\-*%&|^<>!=?({]|\/(?![\/*])))))|((?:0[xX][\da-fA-F]+|0[oO][0-7]+|0[bB][01]+|(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?))|((?!\d)(?:(?!\s)[$\w\u0080-\uFFFF]|\\u[\da-fA-F]{4}|\\u\{[\da-fA-F]{1,6}\})+)|(--|\+\+|&&|\|\||=>|\.{3}|(?:[+\-*\/%&|^]|<{1,2}|>{1,3}|!=?|={1,2})=?|[?:~]|[;,.[\](){}])|(\s+)|(^$|[\s\S])/g,t.exports.matchToToken=function(e){var t={type:"invalid",value:e[0]};return e[1]?(t.type="string",t.closed=!(!e[3]&&!e[4])):e[5]?t.type="comment":e[6]?(t.type="comment",t.closed=!!e[7]):e[8]?t.type="regex":e[9]?t.type="number":e[10]?t.type="name":e[11]?t.type="punctuator":e[12]&&(t.type="whitespace"),t}},{}],402:[function(e,t,r){var n="object"==typeof r?r:{};n.parse=function(){"use strict";var e,t,r,n,i={"'":"'",'"':'"',"\\":"\\","/":"/","\n":"",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},a=[" "," ","\r","\n","","\f"," ","\ufeff"],s=function(t){var n=new SyntaxError;throw n.message=t,n.at=e,n.text=r,n},o=function(n){return n&&n!==t&&s("Expected '"+n+"' instead of '"+t+"'"),t=r.charAt(e),e+=1,t},u=function(){return r.charAt(e)},p=function(){var e=t;for("_"!==t&&"$"!==t&&("a">t||t>"z")&&("A">t||t>"Z")&&s("Bad identifier");o()&&("_"===t||"$"===t||t>="a"&&"z">=t||t>="A"&&"Z">=t||t>="0"&&"9">=t);)e+=t;return e},l=function(){var e,r="",n="",i=10;if(("-"===t||"+"===t)&&(r=t,o(t)),"I"===t)return e=y(),("number"!=typeof e||isNaN(e))&&s("Unexpected word for number"),"-"===r?-e:e;if("N"===t)return e=y(),isNaN(e)||s("expected word to be NaN"),e;switch("0"===t&&(n+=t,o(),"x"===t||"X"===t?(n+=t,o(),i=16):t>="0"&&"9">=t&&s("Octal literal")),i){case 10:for(;t>="0"&&"9">=t;)n+=t,o();if("."===t)for(n+=".";o()&&t>="0"&&"9">=t;)n+=t;if("e"===t||"E"===t)for(n+=t,o(),("-"===t||"+"===t)&&(n+=t,o());t>="0"&&"9">=t;)n+=t,o();break;case 16:for(;t>="0"&&"9">=t||t>="A"&&"F">=t||t>="a"&&"f">=t;)n+=t,o()}return e="-"===r?-n:+n,isFinite(e)?e:void s("Bad number")},c=function(){var e,r,n,a,p="";if('"'===t||"'"===t)for(n=t;o();){if(t===n)return o(),p;if("\\"===t)if(o(),"u"===t){for(a=0,r=0;4>r&&(e=parseInt(o(),16),isFinite(e));r+=1)a=16*a+e;p+=String.fromCharCode(a)}else if("\r"===t)"\n"===u()&&o();else{if("string"!=typeof i[t])break;p+=i[t]}else{if("\n"===t)break;p+=t}}s("Bad string")},f=function(){"/"!==t&&s("Not an inline comment");do if(o(),"\n"===t||"\r"===t)return void o();while(t)},d=function(){"*"!==t&&s("Not a block comment");do for(o();"*"===t;)if(o("*"),"/"===t)return void o("/");while(t);s("Unterminated block comment")},h=function(){"/"!==t&&s("Not a comment"),o("/"),"/"===t?f():"*"===t?d():s("Unrecognized comment")},m=function(){for(;t;)if("/"===t)h();else{if(!(a.indexOf(t)>=0))return;o()}},y=function(){switch(t){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null;case"I":return o("I"),o("n"),o("f"),o("i"),o("n"),o("i"),o("t"),o("y"),1/0;case"N":return o("N"),o("a"),o("N"),NaN}s("Unexpected '"+t+"'")},g=function(){var e=[];if("["===t)for(o("["),m();t;){if("]"===t)return o("]"),e;if(","===t?s("Missing array element"):e.push(n()),m(),","!==t)return o("]"),e;o(","),m()}s("Bad array")},v=function(){var e,r={};if("{"===t)for(o("{"),m();t;){if("}"===t)return o("}"),r;if(e='"'===t||"'"===t?c():p(),m(),o(":"),r[e]=n(),m(),","!==t)return o("}"),r;o(","),m()}s("Bad object")};return n=function(){switch(m(),t){case"{":return v();case"[":return g();case'"':case"'":return c();case"-":case"+":case".":return l();default:return t>="0"&&"9">=t?l():y()}},function(i,a){var o;return r=String(i),e=0,t=" ",o=n(),m(),t&&s("Syntax error"),"function"==typeof a?function u(e,t){var r,n,i=e[t];if(i&&"object"==typeof i)for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n=u(i,r),void 0!==n?i[r]=n:delete i[r]);return a.call(e,t,i)}({"":o},""):o}}(),n.stringify=function(e,t,r){function i(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||e>="0"&&"9">=e||"_"===e||"$"===e}function a(e){return e>="a"&&"z">=e||e>="A"&&"Z">=e||"_"===e||"$"===e}function s(e){if("string"!=typeof e)return!1;if(!a(e[0]))return!1;for(var t=1,r=e.length;r>t;){if(!i(e[t]))return!1;t++}return!0}function o(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function u(e){return"[object Date]"===Object.prototype.toString.call(e)}function p(e){for(var t=0;t<m.length;t++)if(m[t]===e)throw new TypeError("Converting circular structure to JSON")}function l(e,t,r){if(!e)return"";e.length>10&&(e=e.substring(0,10));for(var n=r?"":"\n",i=0;t>i;i++)n+=e;return n}function c(e){return y.lastIndex=0,y.test(e)?'"'+e.replace(y,function(e){var t=g[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function f(e,t,r){var n,i,a=d(e,t,r);switch(a&&!u(a)&&(a=a.valueOf()),typeof a){case"boolean":return a.toString();case"number":return isNaN(a)||!isFinite(a)?"null":a.toString();case"string":return c(a.toString());case"object":if(null===a)return"null";if(o(a)){p(a),n="[",m.push(a);for(var y=0;y<a.length;y++)i=f(a,y,!1),n+=l(h,m.length),n+=null===i||"undefined"==typeof i?"null":i,y<a.length-1?n+=",":h&&(n+="\n");m.pop(),n+=l(h,m.length,!0)+"]"}else{p(a),n="{";var g=!1;m.push(a);for(var v in a)if(a.hasOwnProperty(v)){var b=f(a,v,!1);if(r=!1,"undefined"!=typeof b&&null!==b){n+=l(h,m.length),g=!0;var t=s(v)?v:c(v);n+=t+":"+(h?" ":"")+b+","}}m.pop(),n=g?n.substring(0,n.length-1)+l(h,m.length)+"}":"{}"}return n;default:return void 0}}if(t&&"function"!=typeof t&&!o(t))throw new Error("Replacer must be a function or an array");var d=function(e,r,n){var i=e[r];return i&&i.toJSON&&"function"==typeof i.toJSON&&(i=i.toJSON()),"function"==typeof t?t.call(e,r,i):t?n||o(e)||t.indexOf(r)>=0?i:void 0:i};n.isWord=s,isNaN=isNaN||function(e){return"number"==typeof e&&e!==e};var h,m=[];r&&("string"==typeof r?h=r:"number"==typeof r&&r>=0&&(h=l(" ",r,!0)));var y=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,g={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},v={"":e};return void 0===e?d(v,"",!0):f(v,"",!0)}},{}],403:[function(e,t,r){function n(e,t,r){return t in e?e[t]:r}function i(e,t){var r=n.bind(null,t||{}),i=r("transform",Function.prototype),s=r("padding"," "),o=r("before"," "),u=r("after"," | "),p=r("start",1),l=Array.isArray(e),c=l?e:e.split("\n"),f=p+c.length-1,d=String(f).length,h=c.map(function(e,t){var r=p+t,n={before:o,number:r,width:d,after:u,line:e};return i(n),n.before+a(n.number,d,s)+n.after+n.line});return l?h:h.join("\n")}var a=e(404);t.exports=i},{404:404}],404:[function(e,t,r){function n(e,t,r){e=String(e);var n=-1;for(r||(r=" "),t-=e.length;++n<t;)e=r+e;return e}t.exports=n},{}],405:[function(e,t,r){function n(e){for(var t=-1,r=e?e.length:0,n=-1,i=[];++t<r;){var a=e[t];a&&(i[++n]=a)}return i}t.exports=n},{}],406:[function(e,t,r){function n(e,t,r){var n=e?e.length:0;return r&&a(e,t,r)&&(t=!1),n?i(e,t):[]}var i=e(435),a=e(485);t.exports=n},{435:435,485:485}],407:[function(e,t,r){function n(e){var t=e?e.length:0;return t?e[t-1]:void 0}t.exports=n},{}],408:[function(e,t,r){function n(){var e=arguments,t=e[0];if(!t||!t.length)return t;for(var r=0,n=i,a=e.length;++r<a;)for(var o=0,u=e[r];(o=n(t,u,o))>-1;)s.call(t,o,1);return t}var i=e(442),a=Array.prototype,s=a.splice;t.exports=n},{442:442}],409:[function(e,t,r){function n(e,t,r,n){var u=e?e.length:0;return u?(null!=t&&"boolean"!=typeof t&&(n=r,r=s(e,t,n)?void 0:t,t=!1),r=null==r?r:i(r,n,3),t?o(e,r):a(e,r)):[]}var i=e(429),a=e(458),s=e(485),o=e(491);t.exports=n},{429:429,458:458,485:485,491:491}],410:[function(e,t,r){t.exports=e(413)},{413:413}],411:[function(e,t,r){t.exports=e(412)},{412:412}],412:[function(e,t,r){var n=e(421),i=e(433),a=e(470),s=a(n,i);t.exports=s},{421:421,433:433,470:470}],413:[function(e,t,r){function n(e,t,r,n){var f=e?a(e):0;return u(f)||(e=l(e),f=e.length),r="number"!=typeof r||n&&o(t,r,n)?0:0>r?c(f+r,0):r||0,"string"==typeof e||!s(e)&&p(e)?f>=r&&e.indexOf(t,r)>-1:!!f&&i(e,t,r)>-1}var i=e(442),a=e(476),s=e(497),o=e(485),u=e(487),p=e(506),l=e(517),c=Math.max;t.exports=n},{442:442,476:476,485:485,487:487,497:497,506:506,517:517}],414:[function(e,t,r){function n(e,t,r){var n=o(e)?i:s;return t=a(t,r,3),n(e,t)}var i=e(422),a=e(429),s=e(446),o=e(497);t.exports=n},{422:422,429:429,446:446,497:497}],415:[function(e,t,r){var n=e(424),i=e(434),a=e(471),s=a(n,i);t.exports=s},{424:424,434:434,471:471}],416:[function(e,t,r){function n(e,t,r){var n=o(e)?i:s;return r&&u(e,t,r)&&(t=void 0),("function"!=typeof t||void 0!==r)&&(t=a(t,r,3)),n(e,t)}var i=e(425),a=e(429),s=e(455),o=e(497),u=e(485);t.exports=n},{425:425,429:429,455:455,485:485,497:497}],417:[function(e,t,r){function n(e,t,r){if(null==e)return[];r&&u(e,t,r)&&(t=void 0);var n=-1;t=i(t,r,3);var p=a(e,function(e,r,i){return{criteria:t(e,r,i),index:++n,value:e}});return s(p,o)}var i=e(429),a=e(446),s=e(456),o=e(464),u=e(485);t.exports=n},{429:429,446:446,456:456,464:464,485:485}],418:[function(e,t,r){function n(e,t){if("function"!=typeof e)throw new TypeError(i);return t=a(void 0===t?e.length-1:+t||0,0),function(){for(var r=arguments,n=-1,i=a(r.length-t,0),s=Array(i);++n<i;)s[n]=r[t+n];switch(t){case 0:return e.call(this,s);case 1:return e.call(this,r[0],s);case 2:return e.call(this,r[0],r[1],s)}var o=Array(t+1);for(n=-1;++n<t;)o[n]=r[n];return o[t]=s,e.apply(this,o)}}var i="Expected a function",a=Math.max;t.exports=n},{}],419:[function(e,t,r){(function(r){function n(e){var t=e?e.length:0;for(this.data={hash:o(null),set:new s};t--;)this.push(e[t])}var i=e(463),a=e(478),s=a(r,"Set"),o=a(Object,"create");n.prototype.push=i,t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{463:463,478:478}],420:[function(e,t,r){function n(e,t){var r=-1,n=e.length;for(t||(t=Array(n));++r<n;)t[r]=e[r];return t}t.exports=n},{}],421:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length;++r<n&&t(e[r],r,e)!==!1;);return e}t.exports=n},{}],422:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}t.exports=n},{}],423:[function(e,t,r){function n(e,t){for(var r=-1,n=t.length,i=e.length;++r<n;)e[i+r]=t[r];return e}t.exports=n},{}],424:[function(e,t,r){function n(e,t,r,n){
var i=e.length;for(n&&i&&(r=e[--i]);i--;)r=t(r,e[i],i,e);return r}t.exports=n},{}],425:[function(e,t,r){function n(e,t){for(var r=-1,n=e.length;++r<n;)if(t(e[r],r,e))return!0;return!1}t.exports=n},{}],426:[function(e,t,r){function n(e,t){return void 0===e?t:e}t.exports=n},{}],427:[function(e,t,r){function n(e,t,r){for(var n=-1,a=i(t),s=a.length;++n<s;){var o=a[n],u=e[o],p=r(u,t[o],o,e,t);(p===p?p===u:u!==u)&&(void 0!==u||o in e)||(e[o]=p)}return e}var i=e(513);t.exports=n},{513:513}],428:[function(e,t,r){function n(e,t){return null==t?e:i(t,a(t),e)}var i=e(432),a=e(513);t.exports=n},{432:432,513:513}],429:[function(e,t,r){function n(e,t,r){var n=typeof e;return"function"==n?void 0===t?e:s(e,t,r):null==e?o:"object"==n?i(e):void 0===t?u(e):a(e,t)}var i=e(447),a=e(448),s=e(460),o=e(520),u=e(521);t.exports=n},{447:447,448:448,460:460,520:520,521:521}],430:[function(e,t,r){function n(e,t,r,h,m,y,g){var b;if(r&&(b=m?r(e,h,m):r(e)),void 0!==b)return b;if(!f(e))return e;var E=c(e);if(E){if(b=u(e),!t)return i(e,b)}else{var S=N.call(e),A=S==v;if(S!=x&&S!=d&&(!A||m))return j[S]?p(e,S,t):m?e:{};if(b=l(A?{}:e),!t)return s(b,e)}y||(y=[]),g||(g=[]);for(var D=y.length;D--;)if(y[D]==e)return g[D];return y.push(e),g.push(b),(E?a:o)(e,function(i,a){b[a]=n(i,t,r,a,e,y,g)}),b}var i=e(420),a=e(421),s=e(428),o=e(438),u=e(480),p=e(481),l=e(482),c=e(497),f=e(503),d="[object Arguments]",h="[object Array]",m="[object Boolean]",y="[object Date]",g="[object Error]",v="[object Function]",b="[object Map]",E="[object Number]",x="[object Object]",S="[object RegExp]",A="[object Set]",D="[object String]",C="[object WeakMap]",w="[object ArrayBuffer]",I="[object Float32Array]",_="[object Float64Array]",F="[object Int8Array]",k="[object Int16Array]",P="[object Int32Array]",B="[object Uint8Array]",T="[object Uint8ClampedArray]",M="[object Uint16Array]",O="[object Uint32Array]",j={};j[d]=j[h]=j[w]=j[m]=j[y]=j[I]=j[_]=j[F]=j[k]=j[P]=j[E]=j[x]=j[S]=j[D]=j[B]=j[T]=j[M]=j[O]=!0,j[g]=j[v]=j[b]=j[A]=j[C]=!1;var L=Object.prototype,N=L.toString;t.exports=n},{420:420,421:421,428:428,438:438,480:480,481:481,482:482,497:497,503:503}],431:[function(e,t,r){function n(e,t){if(e!==t){var r=null===e,n=void 0===e,i=e===e,a=null===t,s=void 0===t,o=t===t;if(e>t&&!a||!i||r&&!s&&o||n&&o)return 1;if(t>e&&!r||!o||a&&!n&&i||s&&i)return-1}return 0}t.exports=n},{}],432:[function(e,t,r){function n(e,t,r){r||(r={});for(var n=-1,i=t.length;++n<i;){var a=t[n];r[a]=e[a]}return r}t.exports=n},{}],433:[function(e,t,r){var n=e(438),i=e(466),a=i(n);t.exports=a},{438:438,466:466}],434:[function(e,t,r){var n=e(439),i=e(466),a=i(n,!0);t.exports=a},{439:439,466:466}],435:[function(e,t,r){function n(e,t,r,p){p||(p=[]);for(var l=-1,c=e.length;++l<c;){var f=e[l];u(f)&&o(f)&&(r||s(f)||a(f))?t?n(f,t,r,p):i(p,f):r||(p[p.length]=f)}return p}var i=e(423),a=e(496),s=e(497),o=e(483),u=e(488);t.exports=n},{423:423,483:483,488:488,496:496,497:497}],436:[function(e,t,r){var n=e(467),i=n();t.exports=i},{467:467}],437:[function(e,t,r){function n(e,t){return i(e,t,a)}var i=e(436),a=e(514);t.exports=n},{436:436,514:514}],438:[function(e,t,r){function n(e,t){return i(e,t,a)}var i=e(436),a=e(513);t.exports=n},{436:436,513:513}],439:[function(e,t,r){function n(e,t){return i(e,t,a)}var i=e(440),a=e(513);t.exports=n},{440:440,513:513}],440:[function(e,t,r){var n=e(467),i=n(!0);t.exports=i},{467:467}],441:[function(e,t,r){function n(e,t,r){if(null!=e){void 0!==r&&r in i(e)&&(t=[r]);for(var n=0,a=t.length;null!=e&&a>n;)e=e[t[n++]];return n&&n==a?e:void 0}}var i=e(492);t.exports=n},{492:492}],442:[function(e,t,r){function n(e,t,r){if(t!==t)return i(e,r);for(var n=r-1,a=e.length;++n<a;)if(e[n]===t)return n;return-1}var i=e(479);t.exports=n},{479:479}],443:[function(e,t,r){function n(e,t,r,o,u,p){return e===t?!0:null==e||null==t||!a(e)&&!s(t)?e!==e&&t!==t:i(e,t,n,r,o,u,p)}var i=e(444),a=e(503),s=e(488);t.exports=n},{444:444,488:488,503:503}],444:[function(e,t,r){function n(e,t,r,n,f,m,y){var g=o(e),v=o(t),b=l,E=l;g||(b=h.call(e),b==p?b=c:b!=c&&(g=u(e))),v||(E=h.call(t),E==p?E=c:E!=c&&(v=u(t)));var x=b==c,S=E==c,A=b==E;if(A&&!g&&!x)return a(e,t,b);if(!f){var D=x&&d.call(e,"__wrapped__"),C=S&&d.call(t,"__wrapped__");if(D||C)return r(D?e.value():e,C?t.value():t,n,f,m,y)}if(!A)return!1;m||(m=[]),y||(y=[]);for(var w=m.length;w--;)if(m[w]==e)return y[w]==t;m.push(e),y.push(t);var I=(g?i:s)(e,t,r,n,f,m,y);return m.pop(),y.pop(),I}var i=e(472),a=e(473),s=e(474),o=e(497),u=e(507),p="[object Arguments]",l="[object Array]",c="[object Object]",f=Object.prototype,d=f.hasOwnProperty,h=f.toString;t.exports=n},{472:472,473:473,474:474,497:497,507:507}],445:[function(e,t,r){function n(e,t,r){var n=t.length,s=n,o=!r;if(null==e)return!s;for(e=a(e);n--;){var u=t[n];if(o&&u[2]?u[1]!==e[u[0]]:!(u[0]in e))return!1}for(;++n<s;){u=t[n];var p=u[0],l=e[p],c=u[1];if(o&&u[2]){if(void 0===l&&!(p in e))return!1}else{var f=r?r(l,c,p):void 0;if(!(void 0===f?i(c,l,r,!0):f))return!1}}return!0}var i=e(443),a=e(492);t.exports=n},{443:443,492:492}],446:[function(e,t,r){function n(e,t){var r=-1,n=a(e)?Array(e.length):[];return i(e,function(e,i,a){n[++r]=t(e,i,a)}),n}var i=e(433),a=e(483);t.exports=n},{433:433,483:483}],447:[function(e,t,r){function n(e){var t=a(e);if(1==t.length&&t[0][2]){var r=t[0][0],n=t[0][1];return function(e){return null==e?!1:e[r]===n&&(void 0!==n||r in s(e))}}return function(e){return i(e,t)}}var i=e(445),a=e(477),s=e(492);t.exports=n},{445:445,477:477,492:492}],448:[function(e,t,r){function n(e,t){var r=o(e),n=u(e)&&p(t),d=e+"";return e=f(e),function(o){if(null==o)return!1;var u=d;if(o=c(o),(r||!n)&&!(u in o)){if(o=1==e.length?o:i(o,s(e,0,-1)),null==o)return!1;u=l(e),o=c(o)}return o[u]===t?void 0!==t||u in o:a(t,o[u],void 0,!0)}}var i=e(441),a=e(443),s=e(454),o=e(497),u=e(486),p=e(489),l=e(407),c=e(492),f=e(493);t.exports=n},{407:407,441:441,443:443,454:454,486:486,489:489,492:492,493:493,497:497}],449:[function(e,t,r){function n(e,t,r,f,d){if(!u(e))return e;var h=o(t)&&(s(t)||l(t)),m=h?void 0:c(t);return i(m||t,function(i,s){if(m&&(s=i,i=t[s]),p(i))f||(f=[]),d||(d=[]),a(e,t,s,n,r,f,d);else{var o=e[s],u=r?r(o,i,s,e,t):void 0,l=void 0===u;l&&(u=i),void 0===u&&(!h||s in e)||!l&&(u===u?u===o:o!==o)||(e[s]=u)}}),e}var i=e(421),a=e(450),s=e(497),o=e(483),u=e(503),p=e(488),l=e(507),c=e(513);t.exports=n},{421:421,450:450,483:483,488:488,497:497,503:503,507:507,513:513}],450:[function(e,t,r){function n(e,t,r,n,c,f,d){for(var h=f.length,m=t[r];h--;)if(f[h]==m)return void(e[r]=d[h]);var y=e[r],g=c?c(y,m,r,e,t):void 0,v=void 0===g;v&&(g=m,o(m)&&(s(m)||p(m))?g=s(y)?y:o(y)?i(y):[]:u(m)||a(m)?g=a(y)?l(y):u(y)?y:{}:v=!1),f.push(m),d.push(g),v?e[r]=n(g,m,c,f,d):(g===g?g!==y:y===y)&&(e[r]=g)}var i=e(420),a=e(496),s=e(497),o=e(483),u=e(504),p=e(507),l=e(508);t.exports=n},{420:420,483:483,496:496,497:497,504:504,507:507,508:508}],451:[function(e,t,r){function n(e){return function(t){return null==t?void 0:t[e]}}t.exports=n},{}],452:[function(e,t,r){function n(e){var t=e+"";return e=a(e),function(r){return i(r,e,t)}}var i=e(441),a=e(493);t.exports=n},{441:441,493:493}],453:[function(e,t,r){function n(e,t,r,n,i){return i(e,function(e,i,a){r=n?(n=!1,e):t(r,e,i,a)}),r}t.exports=n},{}],454:[function(e,t,r){function n(e,t,r){var n=-1,i=e.length;t=null==t?0:+t||0,0>t&&(t=-t>i?0:i+t),r=void 0===r||r>i?i:+r||0,0>r&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=Array(i);++n<i;)a[n]=e[n+t];return a}t.exports=n},{}],455:[function(e,t,r){function n(e,t){var r;return i(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}var i=e(433);t.exports=n},{433:433}],456:[function(e,t,r){function n(e,t){var r=e.length;for(e.sort(t);r--;)e[r]=e[r].value;return e}t.exports=n},{}],457:[function(e,t,r){function n(e){return null==e?"":e+""}t.exports=n},{}],458:[function(e,t,r){function n(e,t){var r=-1,n=i,u=e.length,p=!0,l=p&&u>=o,c=l?s():null,f=[];c?(n=a,p=!1):(l=!1,c=t?[]:f);e:for(;++r<u;){var d=e[r],h=t?t(d,r,e):d;if(p&&d===d){for(var m=c.length;m--;)if(c[m]===h)continue e;t&&c.push(h),f.push(d)}else n(c,h,0)<0&&((t||l)&&c.push(h),f.push(d))}return f}var i=e(442),a=e(462),s=e(468),o=200;t.exports=n},{442:442,462:462,468:468}],459:[function(e,t,r){function n(e,t){for(var r=-1,n=t.length,i=Array(n);++r<n;)i[r]=e[t[r]];return i}t.exports=n},{}],460:[function(e,t,r){function n(e,t,r){if("function"!=typeof e)return i;if(void 0===t)return e;switch(r){case 1:return function(r){return e.call(t,r)};case 3:return function(r,n,i){return e.call(t,r,n,i)};case 4:return function(r,n,i,a){return e.call(t,r,n,i,a)};case 5:return function(r,n,i,a,s){return e.call(t,r,n,i,a,s)}}return function(){return e.apply(t,arguments)}}var i=e(520);t.exports=n},{520:520}],461:[function(e,t,r){(function(e){function r(e){var t=new n(e.byteLength),r=new i(t);return r.set(new i(e)),t}var n=e.ArrayBuffer,i=e.Uint8Array;t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],462:[function(e,t,r){function n(e,t){var r=e.data,n="string"==typeof t||i(t)?r.set.has(t):r.hash[t];return n?0:-1}var i=e(503);t.exports=n},{503:503}],463:[function(e,t,r){function n(e){var t=this.data;"string"==typeof e||i(e)?t.set.add(e):t.hash[e]=!0}var i=e(503);t.exports=n},{503:503}],464:[function(e,t,r){function n(e,t){return i(e.criteria,t.criteria)||e.index-t.index}var i=e(431);t.exports=n},{431:431}],465:[function(e,t,r){function n(e){return s(function(t,r){var n=-1,s=null==t?0:r.length,o=s>2?r[s-2]:void 0,u=s>2?r[2]:void 0,p=s>1?r[s-1]:void 0;for("function"==typeof o?(o=i(o,p,5),s-=2):(o="function"==typeof p?p:void 0,s-=o?1:0),u&&a(r[0],r[1],u)&&(o=3>s?void 0:o,s=1);++n<s;){var l=r[n];l&&e(t,l,o)}return t})}var i=e(460),a=e(485),s=e(418);t.exports=n},{418:418,460:460,485:485}],466:[function(e,t,r){function n(e,t){return function(r,n){var o=r?i(r):0;if(!a(o))return e(r,n);for(var u=t?o:-1,p=s(r);(t?u--:++u<o)&&n(p[u],u,p)!==!1;);return r}}var i=e(476),a=e(487),s=e(492);t.exports=n},{476:476,487:487,492:492}],467:[function(e,t,r){function n(e){return function(t,r,n){for(var a=i(t),s=n(t),o=s.length,u=e?o:-1;e?u--:++u<o;){var p=s[u];if(r(a[p],p,a)===!1)break}return t}}var i=e(492);t.exports=n},{492:492}],468:[function(e,t,r){(function(r){function n(e){return o&&s?new i(e):null}var i=e(419),a=e(478),s=a(r,"Set"),o=a(Object,"create");t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{419:419,478:478}],469:[function(e,t,r){function n(e,t){return i(function(r){var n=r[0];return null==n?n:(r.push(t),e.apply(void 0,r))})}var i=e(418);t.exports=n},{418:418}],470:[function(e,t,r){function n(e,t){return function(r,n,s){return"function"==typeof n&&void 0===s&&a(r)?e(r,n):t(r,i(n,s,3))}}var i=e(460),a=e(497);t.exports=n},{460:460,497:497}],471:[function(e,t,r){function n(e,t){return function(r,n,o,u){var p=arguments.length<3;return"function"==typeof n&&void 0===u&&s(r)?e(r,n,o,p):a(r,i(n,u,4),o,p,t)}}var i=e(429),a=e(453),s=e(497);t.exports=n},{429:429,453:453,497:497}],472:[function(e,t,r){function n(e,t,r,n,a,s,o){var u=-1,p=e.length,l=t.length;if(p!=l&&!(a&&l>p))return!1;for(;++u<p;){var c=e[u],f=t[u],d=n?n(a?f:c,a?c:f,u):void 0;if(void 0!==d){if(d)continue;return!1}if(a){if(!i(t,function(e){return c===e||r(c,e,n,a,s,o)}))return!1}else if(c!==f&&!r(c,f,n,a,s,o))return!1}return!0}var i=e(425);t.exports=n},{425:425}],473:[function(e,t,r){function n(e,t,r){switch(r){case i:case a:return+e==+t;case s:return e.name==t.name&&e.message==t.message;case o:return e!=+e?t!=+t:e==+t;case u:case p:return e==t+""}return!1}var i="[object Boolean]",a="[object Date]",s="[object Error]",o="[object Number]",u="[object RegExp]",p="[object String]";t.exports=n},{}],474:[function(e,t,r){function n(e,t,r,n,a,o,u){var p=i(e),l=p.length,c=i(t),f=c.length;if(l!=f&&!a)return!1;for(var d=l;d--;){var h=p[d];if(!(a?h in t:s.call(t,h)))return!1}for(var m=a;++d<l;){h=p[d];var y=e[h],g=t[h],v=n?n(a?g:y,a?y:g,h):void 0;if(!(void 0===v?r(y,g,n,a,o,u):v))return!1;m||(m="constructor"==h)}if(!m){var b=e.constructor,E=t.constructor;if(b!=E&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof E&&E instanceof E))return!1}return!0}var i=e(513),a=Object.prototype,s=a.hasOwnProperty;t.exports=n},{513:513}],475:[function(e,t,r){function n(e,t,r){return t?e=i[e]:r&&(e=a[e]),"\\"+e}var i={0:"x30",1:"x31",2:"x32",3:"x33",4:"x34",5:"x35",6:"x36",7:"x37",8:"x38",9:"x39",A:"x41",B:"x42",C:"x43",D:"x44",E:"x45",F:"x46",a:"x61",b:"x62",c:"x63",d:"x64",e:"x65",f:"x66",n:"x6e",r:"x72",t:"x74",u:"x75",v:"x76",x:"x78"},a={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"};t.exports=n},{}],476:[function(e,t,r){var n=e(451),i=n("length");t.exports=i},{451:451}],477:[function(e,t,r){function n(e){for(var t=a(e),r=t.length;r--;)t[r][2]=i(t[r][1]);return t}var i=e(489),a=e(516);t.exports=n},{489:489,516:516}],478:[function(e,t,r){function n(e,t){var r=null==e?void 0:e[t];return i(r)?r:void 0}var i=e(501);t.exports=n},{501:501}],479:[function(e,t,r){function n(e,t,r){for(var n=e.length,i=t+(r?0:-1);r?i--:++i<n;){var a=e[i];if(a!==a)return i}return-1}t.exports=n},{}],480:[function(e,t,r){function n(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&a.call(e,"index")&&(r.index=e.index,r.input=e.input),r}var i=Object.prototype,a=i.hasOwnProperty;t.exports=n},{}],481:[function(e,t,r){function n(e,t,r){var n=e.constructor;switch(t){case l:return i(e);case a:case s:return new n(+e);case c:case f:case d:case h:case m:case y:case g:case v:case b:var x=e.buffer;return new n(r?i(x):x,e.byteOffset,e.length);case o:case p:return new n(e);case u:var S=new n(e.source,E.exec(e));S.lastIndex=e.lastIndex}return S}var i=e(461),a="[object Boolean]",s="[object Date]",o="[object Number]",u="[object RegExp]",p="[object String]",l="[object ArrayBuffer]",c="[object Float32Array]",f="[object Float64Array]",d="[object Int8Array]",h="[object Int16Array]",m="[object Int32Array]",y="[object Uint8Array]",g="[object Uint8ClampedArray]",v="[object Uint16Array]",b="[object Uint32Array]",E=/\w*$/;t.exports=n},{461:461}],482:[function(e,t,r){function n(e){var t=e.constructor;return"function"==typeof t&&t instanceof t||(t=Object),new t}t.exports=n},{}],483:[function(e,t,r){function n(e){return null!=e&&a(i(e))}var i=e(476),a=e(487);t.exports=n},{476:476,487:487}],484:[function(e,t,r){function n(e,t){return e="number"==typeof e||i.test(e)?+e:-1,t=null==t?a:t,e>-1&&e%1==0&&t>e}var i=/^\d+$/,a=9007199254740991;t.exports=n},{}],485:[function(e,t,r){function n(e,t,r){if(!s(r))return!1;var n=typeof t;if("number"==n?i(r)&&a(t,r.length):"string"==n&&t in r){var o=r[t];return e===e?e===o:o!==o}return!1}var i=e(483),a=e(484),s=e(503);t.exports=n},{483:483,484:484,503:503}],486:[function(e,t,r){function n(e,t){var r=typeof e;if("string"==r&&o.test(e)||"number"==r)return!0;if(i(e))return!1;var n=!s.test(e);return n||null!=t&&e in a(t)}var i=e(497),a=e(492),s=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\n\\]|\\.)*?\1)\]/,o=/^\w*$/;t.exports=n},{492:492,497:497}],487:[function(e,t,r){function n(e){return"number"==typeof e&&e>-1&&e%1==0&&i>=e}var i=9007199254740991;t.exports=n},{}],488:[function(e,t,r){function n(e){return!!e&&"object"==typeof e}t.exports=n},{}],489:[function(e,t,r){function n(e){return e===e&&!i(e)}var i=e(503);t.exports=n},{503:503}],490:[function(e,t,r){function n(e){for(var t=u(e),r=t.length,n=r&&e.length,p=!!n&&o(n)&&(a(e)||i(e)),c=-1,f=[];++c<r;){var d=t[c];(p&&s(d,n)||l.call(e,d))&&f.push(d)}return f}var i=e(496),a=e(497),s=e(484),o=e(487),u=e(514),p=Object.prototype,l=p.hasOwnProperty;t.exports=n},{484:484,487:487,496:496,497:497,514:514}],491:[function(e,t,r){function n(e,t){for(var r,n=-1,i=e.length,a=-1,s=[];++n<i;){var o=e[n],u=t?t(o,n,e):o;n&&r===u||(r=u,s[++a]=o)}return s}t.exports=n},{}],492:[function(e,t,r){function n(e){return i(e)?e:Object(e)}var i=e(503);t.exports=n},{503:503}],493:[function(e,t,r){function n(e){if(a(e))return e;var t=[];return i(e).replace(s,function(e,r,n,i){t.push(n?i.replace(o,"$1"):r||e)}),t}var i=e(457),a=e(497),s=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\n\\]|\\.)*?)\2)\]/g,o=/\\(\\)?/g;t.exports=n},{457:457,497:497}],494:[function(e,t,r){function n(e,t,r,n){return t&&"boolean"!=typeof t&&s(e,t,r)?t=!1:"function"==typeof t&&(n=r,r=t,t=!1),"function"==typeof r?i(e,t,a(r,n,3)):i(e,t)}var i=e(430),a=e(460),s=e(485);t.exports=n},{430:430,460:460,485:485}],495:[function(e,t,r){function n(e,t,r){return"function"==typeof t?i(e,!0,a(t,r,3)):i(e,!0)}var i=e(430),a=e(460);t.exports=n},{430:430,460:460}],496:[function(e,t,r){function n(e){return a(e)&&i(e)&&o.call(e,"callee")&&!u.call(e,"callee")}var i=e(483),a=e(488),s=Object.prototype,o=s.hasOwnProperty,u=s.propertyIsEnumerable;t.exports=n},{483:483,488:488}],497:[function(e,t,r){var n=e(478),i=e(487),a=e(488),s="[object Array]",o=Object.prototype,u=o.toString,p=n(Array,"isArray"),l=p||function(e){return a(e)&&i(e.length)&&u.call(e)==s};t.exports=l},{478:478,487:487,488:488}],498:[function(e,t,r){function n(e){return e===!0||e===!1||i(e)&&o.call(e)==a}var i=e(488),a="[object Boolean]",s=Object.prototype,o=s.toString;t.exports=n},{488:488}],499:[function(e,t,r){function n(e){return null==e?!0:s(e)&&(a(e)||p(e)||i(e)||u(e)&&o(e.splice))?!e.length:!l(e).length}var i=e(496),a=e(497),s=e(483),o=e(500),u=e(488),p=e(506),l=e(513);t.exports=n},{483:483,488:488,496:496,497:497,500:500,506:506,513:513}],500:[function(e,t,r){function n(e){return i(e)&&o.call(e)==a}var i=e(503),a="[object Function]",s=Object.prototype,o=s.toString;t.exports=n},{503:503}],501:[function(e,t,r){function n(e){return null==e?!1:i(e)?l.test(u.call(e)):a(e)&&s.test(e)}var i=e(500),a=e(488),s=/^\[object .+?Constructor\]$/,o=Object.prototype,u=Function.prototype.toString,p=o.hasOwnProperty,l=RegExp("^"+u.call(p).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");t.exports=n},{488:488,500:500}],502:[function(e,t,r){function n(e){return"number"==typeof e||i(e)&&o.call(e)==a}var i=e(488),a="[object Number]",s=Object.prototype,o=s.toString;t.exports=n},{488:488}],503:[function(e,t,r){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}t.exports=n},{}],504:[function(e,t,r){function n(e){var t;if(!s(e)||l.call(e)!=o||a(e)||!p.call(e,"constructor")&&(t=e.constructor,"function"==typeof t&&!(t instanceof t)))return!1;var r;return i(e,function(e,t){r=t}),void 0===r||p.call(e,r)}var i=e(437),a=e(496),s=e(488),o="[object Object]",u=Object.prototype,p=u.hasOwnProperty,l=u.toString;t.exports=n},{437:437,488:488,496:496}],505:[function(e,t,r){function n(e){return i(e)&&o.call(e)==a}var i=e(503),a="[object RegExp]",s=Object.prototype,o=s.toString;t.exports=n},{503:503}],506:[function(e,t,r){function n(e){return"string"==typeof e||i(e)&&o.call(e)==a}var i=e(488),a="[object String]",s=Object.prototype,o=s.toString;t.exports=n},{488:488}],507:[function(e,t,r){function n(e){return a(e)&&i(e.length)&&!!F[P.call(e)]}var i=e(487),a=e(488),s="[object Arguments]",o="[object Array]",u="[object Boolean]",p="[object Date]",l="[object Error]",c="[object Function]",f="[object Map]",d="[object Number]",h="[object Object]",m="[object RegExp]",y="[object Set]",g="[object String]",v="[object WeakMap]",b="[object ArrayBuffer]",E="[object Float32Array]",x="[object Float64Array]",S="[object Int8Array]",A="[object Int16Array]",D="[object Int32Array]",C="[object Uint8Array]",w="[object Uint8ClampedArray]",I="[object Uint16Array]",_="[object Uint32Array]",F={};F[E]=F[x]=F[S]=F[A]=F[D]=F[C]=F[w]=F[I]=F[_]=!0,F[s]=F[o]=F[b]=F[u]=F[p]=F[l]=F[c]=F[f]=F[d]=F[h]=F[m]=F[y]=F[g]=F[v]=!1;var k=Object.prototype,P=k.toString;t.exports=n},{487:487,488:488}],508:[function(e,t,r){function n(e){return i(e,a(e))}var i=e(432),a=e(514);t.exports=n},{432:432,514:514}],509:[function(e,t,r){var n=e(427),i=e(428),a=e(465),s=a(function(e,t,r){return r?n(e,t,r):i(e,t)});t.exports=s},{427:427,428:428,465:465}],510:[function(e,t,r){var n=e(509),i=e(426),a=e(469),s=a(n,i);t.exports=s},{426:426,469:469,509:509}],511:[function(e,t,r){t.exports=e(509)},{509:509}],512:[function(e,t,r){function n(e,t){if(null==e)return!1;var r=h.call(e,t);if(!r&&!p(t)){if(t=f(t),e=1==t.length?e:i(e,a(t,0,-1)),null==e)return!1;t=c(t),r=h.call(e,t)}return r||l(e.length)&&u(t,e.length)&&(o(e)||s(e))}var i=e(441),a=e(454),s=e(496),o=e(497),u=e(484),p=e(486),l=e(487),c=e(407),f=e(493),d=Object.prototype,h=d.hasOwnProperty;t.exports=n},{407:407,441:441,454:454,484:484,486:486,487:487,493:493,496:496,497:497}],513:[function(e,t,r){var n=e(478),i=e(483),a=e(503),s=e(490),o=n(Object,"keys"),u=o?function(e){var t=null==e?void 0:e.constructor;return"function"==typeof t&&t.prototype===e||"function"!=typeof e&&i(e)?s(e):a(e)?o(e):[]}:s;t.exports=u},{478:478,483:483,490:490,503:503}],514:[function(e,t,r){function n(e){if(null==e)return[];u(e)||(e=Object(e));var t=e.length;t=t&&o(t)&&(a(e)||i(e))&&t||0;for(var r=e.constructor,n=-1,p="function"==typeof r&&r.prototype===e,c=Array(t),f=t>0;++n<t;)c[n]=n+"";for(var d in e)f&&s(d,t)||"constructor"==d&&(p||!l.call(e,d))||c.push(d);return c}var i=e(496),a=e(497),s=e(484),o=e(487),u=e(503),p=Object.prototype,l=p.hasOwnProperty;t.exports=n},{484:484,487:487,496:496,497:497,503:503}],515:[function(e,t,r){var n=e(449),i=e(465),a=i(n);t.exports=a},{449:449,465:465}],516:[function(e,t,r){function n(e){e=a(e);for(var t=-1,r=i(e),n=r.length,s=Array(n);++t<n;){var o=r[t];s[t]=[o,e[o]]}return s}var i=e(513),a=e(492);t.exports=n},{492:492,513:513}],517:[function(e,t,r){function n(e){return i(e,a(e))}var i=e(459),a=e(513);t.exports=n},{459:459,513:513}],518:[function(e,t,r){function n(e){return e=i(e),e&&o.test(e)?e.replace(s,a):e||"(?:)"}var i=e(457),a=e(475),s=/^[:!,]|[\\^$.*+?()[\]{}|\/]|(^[0-9a-fA-Fnrtuvx])|([\n\r\u2028\u2029])/g,o=RegExp(s.source);t.exports=n},{457:457,475:475}],519:[function(e,t,r){function n(e,t,r){return e=i(e),r=null==r?0:a(0>r?0:+r||0,e.length),e.lastIndexOf(t,r)==r}var i=e(457),a=Math.min;t.exports=n},{457:457}],520:[function(e,t,r){function n(e){return e}t.exports=n},{}],521:[function(e,t,r){function n(e){return s(e)?i(e):a(e)}var i=e(451),a=e(452),s=e(486);t.exports=n},{451:451,452:452,486:486}],522:[function(e,t,r){function n(e){return e.split("").reduce(function(e,t){return e[t]=!0,e},{})}function i(e,t){return t=t||{},function(r,n,i){return s(r,e,t)}}function a(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(e){r[e]=t[e]}),Object.keys(e).forEach(function(t){r[t]=e[t]}),r}function s(e,t,r){if("string"!=typeof t)throw new TypeError("glob pattern string required");return r||(r={}),r.nocomment||"#"!==t.charAt(0)?""===t.trim()?""===e:new o(t,r).match(e):!1}function o(e,t){if(!(this instanceof o))return new o(e,t);if("string"!=typeof e)throw new TypeError("glob pattern string required");t||(t={}),e=e.trim(),"/"!==y.sep&&(e=e.split(y.sep).join("/")),this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}function u(){if(!this._made){var e=this.pattern,t=this.options;if(!t.nocomment&&"#"===e.charAt(0))return void(this.comment=!0);if(!e)return void(this.empty=!0);this.parseNegate();var r=this.globSet=this.braceExpand();t.debug&&(this.debug=console.error),this.debug(this.pattern,r),r=this.globParts=r.map(function(e){return e.split(C)}),this.debug(this.pattern,r),r=r.map(function(e,t,r){return e.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(e){return-1===e.indexOf(!1)}),this.debug(this.pattern,r),this.set=r}}function p(){var e=this.pattern,t=!1,r=this.options,n=0;if(!r.nonegate){for(var i=0,a=e.length;a>i&&"!"===e.charAt(i);i++)t=!t,n++;n&&(this.pattern=e.substr(n)),this.negate=t}}function l(e,t){if(t||(t=this instanceof o?this.options:{}),e="undefined"==typeof e?this.pattern:e,"undefined"==typeof e)throw new Error("undefined pattern");return t.nobrace||!e.match(/\{.*\}/)?[e]:b(e)}function c(e,t){function r(){if(a){switch(a){case"*":o+=x,u=!0;break;case"?":o+=E,u=!0;break;default:o+="\\"+a}g.debug("clearStateChar %j %j",a,o),a=!1}}var n=this.options;if(!n.noglobstar&&"**"===e)return v;if(""===e)return"";for(var i,a,s,o="",u=!!n.nocase,p=!1,l=[],c=[],f=!1,d=-1,m=-1,y="."===e.charAt(0)?"":n.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",g=this,b=0,S=e.length;S>b&&(s=e.charAt(b));b++)if(this.debug("%s %s %s %j",e,b,o,s),p&&D[s])o+="\\"+s,p=!1;else switch(s){case"/":return!1;case"\\":r(),p=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s %s %s %j <-- stateChar",e,b,o,s),f){this.debug(" in class"),"!"===s&&b===m+1&&(s="^"),o+=s;continue}g.debug("call clearStateChar %j",a),r(),a=s,n.noext&&r();continue;case"(":if(f){o+="(";continue}if(!a){o+="\\(";continue}i=a,l.push({type:i,start:b-1,reStart:o.length}),o+="!"===a?"(?:(?!(?:":"(?:",this.debug("plType %j %j",a,o),a=!1;continue;case")":if(f||!l.length){o+="\\)";continue}r(),u=!0,o+=")";var A=l.pop();switch(i=A.type){case"!":c.push(A),o+=")[^/]*?)",A.reEnd=o.length;break;case"?":case"+":case"*":o+=i;break;case"@":}continue;case"|":if(f||!l.length||p){o+="\\|",p=!1;continue}r(),o+="|";continue;case"[":if(r(),f){o+="\\"+s;continue}f=!0,m=b,d=o.length,o+=s;continue;case"]":if(b===m+1||!f){o+="\\"+s,p=!1;continue}if(f){var C=e.substring(m+1,b);try{RegExp("["+C+"]")}catch(I){var _=this.parse(C,w);o=o.substr(0,d)+"\\["+_[0]+"\\]",u=u||_[1],f=!1;continue}}u=!0,f=!1,o+=s;continue;default:r(),p?p=!1:!D[s]||"^"===s&&f||(o+="\\"),o+=s}for(f&&(C=e.substr(m+1),_=this.parse(C,w),o=o.substr(0,d)+"\\["+_[0],u=u||_[1]),A=l.pop();A;A=l.pop()){var F=o.slice(A.reStart+3);F=F.replace(/((?:\\{2})*)(\\?)\|/g,function(e,t,r){return r||(r="\\"),t+t+r+"|"}),this.debug("tail=%j\n %s",F,F);var k="*"===A.type?x:"?"===A.type?E:"\\"+A.type;u=!0,o=o.slice(0,A.reStart)+k+"\\("+F}r(),p&&(o+="\\\\");var P=!1;switch(o.charAt(0)){case".":case"[":case"(":P=!0}for(var B=c.length-1;B>-1;B--){var T=c[B],M=o.slice(0,T.reStart),O=o.slice(T.reStart,T.reEnd-8),j=o.slice(T.reEnd-8,T.reEnd),L=o.slice(T.reEnd);j+=L;var N=M.split("(").length-1,R=L;for(b=0;N>b;b++)R=R.replace(/\)[+*?]?/,"");L=R;var V="";""===L&&t!==w&&(V="$");var U=M+O+L+V+j;o=U}if(""!==o&&u&&(o="(?=.)"+o),P&&(o=y+o),t===w)return[o,u];if(!u)return h(e);var q=n.nocase?"i":"",G=new RegExp("^"+o+"$",q);return G._glob=e,G._src=o,G}function f(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?x:t.dot?S:A,n=t.nocase?"i":"",i=e.map(function(e){return e.map(function(e){return e===v?r:"string"==typeof e?m(e):e._src}).join("\\/")}).join("|");i="^(?:"+i+")$",this.negate&&(i="^(?!"+i+").*$");try{this.regexp=new RegExp(i,n)}catch(a){this.regexp=!1}return this.regexp}function d(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return""===e;if("/"===e&&t)return!0;var r=this.options;"/"!==y.sep&&(e=e.split(y.sep).join("/")),e=e.split(C),this.debug(this.pattern,"split",e);var n=this.set;this.debug(this.pattern,"set",n);var i,a;for(a=e.length-1;a>=0&&!(i=e[a]);a--);for(a=0;a<n.length;a++){var s=n[a],o=e;r.matchBase&&1===s.length&&(o=[i]);var u=this.matchOne(o,s,t);if(u)return r.flipNegate?!0:!this.negate}return r.flipNegate?!1:this.negate}function h(e){return e.replace(/\\(.)/g,"$1")}function m(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}t.exports=s,s.Minimatch=o;var y={sep:"/"};try{y=e(9)}catch(g){}var v=s.GLOBSTAR=o.GLOBSTAR={},b=e(523),E="[^/]",x=E+"*?",S="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",A="(?:(?!(?:\\/|^)\\.).)*?",D=n("().*{}+?[]^$\\!"),C=/\/+/;s.filter=i,s.defaults=function(e){if(!e||!Object.keys(e).length)return s;var t=s,r=function(r,n,i){return t.minimatch(r,n,a(e,i))};return r.Minimatch=function(r,n){return new t.Minimatch(r,a(e,n))},r},o.defaults=function(e){return e&&Object.keys(e).length?s.defaults(e).Minimatch:o},o.prototype.debug=function(){},o.prototype.make=u,o.prototype.parseNegate=p,s.braceExpand=function(e,t){return l(e,t)},o.prototype.braceExpand=l,o.prototype.parse=c;var w={};s.makeRe=function(e,t){return new o(e,t||{}).makeRe()},o.prototype.makeRe=f,s.match=function(e,t,r){r=r||{};var n=new o(t,r);return e=e.filter(function(e){return n.match(e)}),n.options.nonull&&!e.length&&e.push(t),e},o.prototype.match=d,o.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{"this":this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var i=0,a=0,s=e.length,o=t.length;s>i&&o>a;i++,a++){this.debug("matchOne loop");var u=t[a],p=e[i];if(this.debug(t,u,p),u===!1)return!1;if(u===v){this.debug("GLOBSTAR",[t,u,p]);var l=i,c=a+1;if(c===o){for(this.debug("** at the end");s>i;i++)if("."===e[i]||".."===e[i]||!n.dot&&"."===e[i].charAt(0))return!1;return!0}for(;s>l;){var f=e[l];if(this.debug("\nglobstar while",e,l,t,c,f),this.matchOne(e.slice(l),t.slice(c),r))return this.debug("globstar found match!",l,s,f),!0;if("."===f||".."===f||!n.dot&&"."===f.charAt(0)){this.debug("dot detected!",e,l,t,c);break}this.debug("globstar swallow a segment, and continue"),l++}return r&&(this.debug("\n>>> no match, partial?",e,l,t,c),l===s)?!0:!1}var d;if("string"==typeof u?(d=n.nocase?p.toLowerCase()===u.toLowerCase():p===u,this.debug("string match",u,p,d)):(d=p.match(u),this.debug("pattern match",u,p,d)),!d)return!1}if(i===s&&a===o)return!0;if(i===s)return r;if(a===o){var h=i===s-1&&""===e[i];return h}throw new Error("wtf?")}},{523:523,9:9}],523:[function(e,t,r){function n(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function i(e){return e.split("\\\\").join(m).split("\\{").join(y).split("\\}").join(g).split("\\,").join(v).split("\\.").join(b)}function a(e){return e.split(m).join("\\").split(y).join("{").split(g).join("}").split(v).join(",").split(b).join(".")}function s(e){if(!e)return[""];var t=[],r=h("{","}",e);if(!r)return e.split(",");var n=r.pre,i=r.body,a=r.post,o=n.split(",");o[o.length-1]+="{"+i+"}";var u=s(a);return a.length&&(o[o.length-1]+=u.shift(),o.push.apply(o,u)),t.push.apply(t,o),t}function o(e){return e?f(i(e),!0).map(a):[]}function u(e){return"{"+e+"}"}function p(e){return/^-?0\d/.test(e)}function l(e,t){return t>=e}function c(e,t){return e>=t}function f(e,t){var r=[],i=h("{","}",e);if(!i||/\$$/.test(i.pre))return[e];var a=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(i.body),o=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(i.body),m=a||o,y=/^(.*,)+(.+)?$/.test(i.body);if(!m&&!y)return i.post.match(/,.*}/)?(e=i.pre+"{"+i.body+g+i.post,f(e)):[e];var v;if(m)v=i.body.split(/\.\./);else if(v=s(i.body),1===v.length&&(v=f(v[0],!1).map(u),1===v.length)){var b=i.post.length?f(i.post,!1):[""];return b.map(function(e){return i.pre+v[0]+e})}var E,x=i.pre,b=i.post.length?f(i.post,!1):[""];if(m){var S=n(v[0]),A=n(v[1]),D=Math.max(v[0].length,v[1].length),C=3==v.length?Math.abs(n(v[2])):1,w=l,I=S>A;I&&(C*=-1,w=c);var _=v.some(p);E=[];for(var F=S;w(F,A);F+=C){var k;if(o)k=String.fromCharCode(F),"\\"===k&&(k="");else if(k=String(F),_){var P=D-k.length;if(P>0){var B=new Array(P+1).join("0");k=0>F?"-"+B+k.slice(1):B+k}}E.push(k)}}else E=d(v,function(e){return f(e,!1)});for(var T=0;T<E.length;T++)for(var M=0;M<b.length;M++){var O=x+E[T]+b[M];(!t||m||O)&&r.push(O)}return r}var d=e(525),h=e(524);t.exports=o;var m="\x00SLASH"+Math.random()+"\x00",y="\x00OPEN"+Math.random()+"\x00",g="\x00CLOSE"+Math.random()+"\x00",v="\x00COMMA"+Math.random()+"\x00",b="\x00PERIOD"+Math.random()+"\x00"},{524:524,525:525}],524:[function(e,t,r){function n(e,t,r){for(var i=0,a={},s=!1,o=0;o<r.length;o++)if(e==r.substr(o,e.length))"start"in a||(a.start=o),i++;else if(t==r.substr(o,t.length)&&"start"in a&&(s=!0,i--,!i))return a.end=o,a.pre=r.substr(0,a.start),a.body=a.end-a.start>1?r.substring(a.start+e.length,a.end):"",a.post=r.slice(a.end+t.length),a;if(i&&s){var u=a.start+e.length;return a=n(e,t,r.substr(u)),a&&(a.start+=u,a.end+=u,a.pre=r.slice(0,u)+a.pre),a}}t.exports=n},{}],525:[function(e,t,r){t.exports=function(e,t){for(var r=[],i=0;i<e.length;i++){var a=t(e[i],i);n(a)?r.push.apply(r,a):r.push(a);
}return r};var n=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)}},{}],526:[function(e,t,r){"use strict";var n=e(1);t.exports=function(e,t){var r="function"==typeof n.access?n.access:n.stat;r(e,function(e){t(null,!e)})},t.exports.sync=function(e){var t="function"==typeof n.accessSync?n.accessSync:n.statSync;try{return t(e),!0}catch(r){return!1}}},{1:1}],527:[function(e,t,r){(function(e){"use strict";function r(e){return"/"===e.charAt(0)}function n(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,r=t.exec(e),n=r[1]||"",i=!!n&&":"!==n.charAt(1);return!!r[2]||i}t.exports="win32"===e.platform?n:r,t.exports.posix=r,t.exports.win32=n}).call(this,e(10))},{10:10}],528:[function(e,t,r){"use strict";function n(e,t,r){if(c)try{c.call(l,e,t,{value:r})}catch(n){e[t]=r}else e[t]=r}function i(e){return e&&(n(e,"call",e.call),n(e,"apply",e.apply)),e}function a(e){return f?f.call(l,e):(y.prototype=e||null,new y)}function s(){do var e=o(m.call(h.call(g(),36),2));while(d.call(v,e));return v[e]=e}function o(e){var t={};return t[e]=!0,Object.keys(t)[0]}function u(e){return a(null)}function p(e){function t(t){function r(r,n){return r===o?n?a=null:a||(a=e(t)):void 0}var a;n(t,i,r)}function r(e){return d.call(e,i)||t(e),e[i](o)}var i=s(),o=a(null);return e=e||u,r.forget=function(e){d.call(e,i)&&e[i](o,!0)},r}var l=Object,c=Object.defineProperty,f=Object.create;i(c),i(f);var d=i(Object.prototype.hasOwnProperty),h=i(Number.prototype.toString),m=i(String.prototype.slice),y=function(){},g=Math.random,v=a(null);n(r,"makeUniqueKey",s);var b=Object.getOwnPropertyNames;Object.getOwnPropertyNames=function(e){for(var t=b(e),r=0,n=0,i=t.length;i>r;++r)d.call(v,t[r])||(r>n&&(t[n]=t[r]),++n);return t.length=n,t},n(r,"makeAccessor",p)},{}],529:[function(e,t,r){function n(e){u.ok(this instanceof n),c.Identifier.assert(e),this.nextTempId=0,Object.defineProperties(this,{contextId:{value:e},listing:{value:[]},marked:{value:[!0]},finalLoc:{value:i()},tryEntries:{value:[]}}),Object.defineProperties(this,{leapManager:{value:new f.LeapManager(this)}})}function i(){return l.literal(-1)}function a(e){return c.BreakStatement.check(e)||c.ContinueStatement.check(e)||c.ReturnStatement.check(e)||c.ThrowStatement.check(e)}function s(e){return new Error("all declarations should have been transformed into assignments before the Exploder began its work: "+JSON.stringify(e))}function o(e){var t=e.type;return"normal"===t?!y.call(e,"target"):"break"===t||"continue"===t?!y.call(e,"value")&&c.Literal.check(e.target):"return"===t||"throw"===t?y.call(e,"value")&&!y.call(e,"target"):!1}var u=e(2),p=e(560).types,l=(p.builtInTypes.array,p.builders),c=p.namedTypes,f=e(531),d=e(532),h=e(533),m=h.runtimeProperty,y=Object.prototype.hasOwnProperty,g=n.prototype;r.Emitter=n,g.mark=function(e){c.Literal.assert(e);var t=this.listing.length;return-1===e.value?e.value=t:u.strictEqual(e.value,t),this.marked[t]=!0,e},g.emit=function(e){c.Expression.check(e)&&(e=l.expressionStatement(e)),c.Statement.assert(e),this.listing.push(e)},g.emitAssign=function(e,t){return this.emit(this.assign(e,t)),e},g.assign=function(e,t){return l.expressionStatement(l.assignmentExpression("=",e,t))},g.contextProperty=function(e,t){return l.memberExpression(this.contextId,t?l.literal(e):l.identifier(e),!!t)},g.stop=function(e){e&&this.setReturnValue(e),this.jump(this.finalLoc)},g.setReturnValue=function(e){c.Expression.assert(e.value),this.emitAssign(this.contextProperty("rval"),this.explodeExpression(e))},g.clearPendingException=function(e,t){c.Literal.assert(e);var r=l.callExpression(this.contextProperty("catch",!0),[e]);t?this.emitAssign(t,r):this.emit(r)},g.jump=function(e){this.emitAssign(this.contextProperty("next"),e),this.emit(l.breakStatement())},g.jumpIf=function(e,t){c.Expression.assert(e),c.Literal.assert(t),this.emit(l.ifStatement(e,l.blockStatement([this.assign(this.contextProperty("next"),t),l.breakStatement()])))},g.jumpIfNot=function(e,t){c.Expression.assert(e),c.Literal.assert(t);var r;r=c.UnaryExpression.check(e)&&"!"===e.operator?e.argument:l.unaryExpression("!",e),this.emit(l.ifStatement(r,l.blockStatement([this.assign(this.contextProperty("next"),t),l.breakStatement()])))},g.makeTempVar=function(){return this.contextProperty("t"+this.nextTempId++)},g.getContextFunction=function(e){return l.functionExpression(e||null,[this.contextId],l.blockStatement([this.getDispatchLoop()]),!1,!1)},g.getDispatchLoop=function(){var e,t=this,r=[],n=!1;return t.listing.forEach(function(i,s){t.marked.hasOwnProperty(s)&&(r.push(l.switchCase(l.literal(s),e=[])),n=!1),n||(e.push(i),a(i)&&(n=!0))}),this.finalLoc.value=this.listing.length,r.push(l.switchCase(this.finalLoc,[]),l.switchCase(l.literal("end"),[l.returnStatement(l.callExpression(this.contextProperty("stop"),[]))])),l.whileStatement(l.literal(1),l.switchStatement(l.assignmentExpression("=",this.contextProperty("prev"),this.contextProperty("next")),r))},g.getTryLocsList=function(){if(0===this.tryEntries.length)return null;var e=0;return l.arrayExpression(this.tryEntries.map(function(t){var r=t.firstLoc.value;u.ok(r>=e,"try entries out of order"),e=r;var n=t.catchEntry,i=t.finallyEntry,a=[t.firstLoc,n?n.firstLoc:null];return i&&(a[2]=i.firstLoc,a[3]=i.afterLoc),l.arrayExpression(a)}))},g.explode=function(e,t){u.ok(e instanceof p.NodePath);var r=e.value,n=this;if(c.Node.assert(r),c.Statement.check(r))return n.explodeStatement(e);if(c.Expression.check(r))return n.explodeExpression(e,t);if(c.Declaration.check(r))throw s(r);switch(r.type){case"Program":return e.get("body").map(n.explodeStatement,n);case"VariableDeclarator":throw s(r);case"Property":case"SwitchCase":case"CatchClause":throw new Error(r.type+" nodes should be handled by their parents");default:throw new Error("unknown Node of type "+JSON.stringify(r.type))}},g.explodeStatement=function(e,t){u.ok(e instanceof p.NodePath);var r=e.value,n=this;if(c.Statement.assert(r),t?c.Identifier.assert(t):t=null,c.BlockStatement.check(r))return e.get("body").each(n.explodeStatement,n);if(!d.containsLeap(r))return void n.emit(r);switch(r.type){case"ExpressionStatement":n.explodeExpression(e.get("expression"),!0);break;case"LabeledStatement":var a=i();n.leapManager.withEntry(new f.LabeledEntry(a,r.label),function(){n.explodeStatement(e.get("body"),r.label)}),n.mark(a);break;case"WhileStatement":var s=i(),a=i();n.mark(s),n.jumpIfNot(n.explodeExpression(e.get("test")),a),n.leapManager.withEntry(new f.LoopEntry(a,s,t),function(){n.explodeStatement(e.get("body"))}),n.jump(s),n.mark(a);break;case"DoWhileStatement":var o=i(),y=i(),a=i();n.mark(o),n.leapManager.withEntry(new f.LoopEntry(a,y,t),function(){n.explode(e.get("body"))}),n.mark(y),n.jumpIf(n.explodeExpression(e.get("test")),o),n.mark(a);break;case"ForStatement":var g=i(),v=i(),a=i();r.init&&n.explode(e.get("init"),!0),n.mark(g),r.test&&n.jumpIfNot(n.explodeExpression(e.get("test")),a),n.leapManager.withEntry(new f.LoopEntry(a,v,t),function(){n.explodeStatement(e.get("body"))}),n.mark(v),r.update&&n.explode(e.get("update"),!0),n.jump(g),n.mark(a);break;case"ForInStatement":var g=i(),a=i(),b=n.makeTempVar();n.emitAssign(b,l.callExpression(m("keys"),[n.explodeExpression(e.get("right"))])),n.mark(g);var E=n.makeTempVar();n.jumpIf(l.memberExpression(l.assignmentExpression("=",E,l.callExpression(b,[])),l.identifier("done"),!1),a),n.emitAssign(r.left,l.memberExpression(E,l.identifier("value"),!1)),n.leapManager.withEntry(new f.LoopEntry(a,g,t),function(){n.explodeStatement(e.get("body"))}),n.jump(g),n.mark(a);break;case"BreakStatement":n.emitAbruptCompletion({type:"break",target:n.leapManager.getBreakLoc(r.label)});break;case"ContinueStatement":n.emitAbruptCompletion({type:"continue",target:n.leapManager.getContinueLoc(r.label)});break;case"SwitchStatement":for(var x=n.emitAssign(n.makeTempVar(),n.explodeExpression(e.get("discriminant"))),a=i(),S=i(),A=S,D=[],C=r.cases||[],w=C.length-1;w>=0;--w){var I=C[w];c.SwitchCase.assert(I),I.test?A=l.conditionalExpression(l.binaryExpression("===",x,I.test),D[w]=i(),A):D[w]=S}n.jump(n.explodeExpression(new p.NodePath(A,e,"discriminant"))),n.leapManager.withEntry(new f.SwitchEntry(a),function(){e.get("cases").each(function(e){var t=(e.value,e.name);n.mark(D[t]),e.get("consequent").each(n.explodeStatement,n)})}),n.mark(a),-1===S.value&&(n.mark(S),u.strictEqual(a.value,S.value));break;case"IfStatement":var _=r.alternate&&i(),a=i();n.jumpIfNot(n.explodeExpression(e.get("test")),_||a),n.explodeStatement(e.get("consequent")),_&&(n.jump(a),n.mark(_),n.explodeStatement(e.get("alternate"))),n.mark(a);break;case"ReturnStatement":n.emitAbruptCompletion({type:"return",value:n.explodeExpression(e.get("argument"))});break;case"WithStatement":throw new Error(node.type+" not supported in generator functions.");case"TryStatement":var a=i(),F=r.handler;!F&&r.handlers&&(F=r.handlers[0]||null);var k=F&&i(),P=k&&new f.CatchEntry(k,F.param),B=r.finalizer&&i(),T=B&&new f.FinallyEntry(B,a),M=new f.TryEntry(n.getUnmarkedCurrentLoc(),P,T);n.tryEntries.push(M),n.updateContextPrevLoc(M.firstLoc),n.leapManager.withEntry(M,function(){if(n.explodeStatement(e.get("block")),k){B?n.jump(B):n.jump(a),n.updateContextPrevLoc(n.mark(k));var t=e.get("handler","body"),r=n.makeTempVar();n.clearPendingException(M.firstLoc,r);var i=t.scope,s=F.param.name;c.CatchClause.assert(i.node),u.strictEqual(i.lookup(s),i),p.visit(t,{visitIdentifier:function(e){return h.isReference(e,s)&&e.scope.lookup(s)===i?r:void this.traverse(e)},visitFunction:function(e){return e.scope.declares(s)?!1:void this.traverse(e)}}),n.leapManager.withEntry(P,function(){n.explodeStatement(t)})}B&&(n.updateContextPrevLoc(n.mark(B)),n.leapManager.withEntry(T,function(){n.explodeStatement(e.get("finalizer"))}),n.emit(l.returnStatement(l.callExpression(n.contextProperty("finish"),[T.firstLoc]))))}),n.mark(a);break;case"ThrowStatement":n.emit(l.throwStatement(n.explodeExpression(e.get("argument"))));break;default:throw new Error("unknown Statement of type "+JSON.stringify(r.type))}},g.emitAbruptCompletion=function(e){o(e)||u.ok(!1,"invalid completion record: "+JSON.stringify(e)),u.notStrictEqual(e.type,"normal","normal completions are not abrupt");var t=[l.literal(e.type)];"break"===e.type||"continue"===e.type?(c.Literal.assert(e.target),t[1]=e.target):("return"===e.type||"throw"===e.type)&&e.value&&(c.Expression.assert(e.value),t[1]=e.value),this.emit(l.returnStatement(l.callExpression(this.contextProperty("abrupt"),t)))},g.getUnmarkedCurrentLoc=function(){return l.literal(this.listing.length)},g.updateContextPrevLoc=function(e){e?(c.Literal.assert(e),-1===e.value?e.value=this.listing.length:u.strictEqual(e.value,this.listing.length)):e=this.getUnmarkedCurrentLoc(),this.emitAssign(this.contextProperty("prev"),e)},g.explodeExpression=function(e,t){function r(e){return c.Expression.assert(e),t?void o.emit(e):e}function n(e,t,r){u.ok(t instanceof p.NodePath),u.ok(!r||!e,"Ignoring the result of a child expression but forcing it to be assigned to a temporary variable?");var n=o.explodeExpression(t,r);return r||(e||f&&!c.Literal.check(n))&&(n=o.emitAssign(e||o.makeTempVar(),n)),n}u.ok(e instanceof p.NodePath);var a=e.value;if(!a)return a;c.Expression.assert(a);var s,o=this;if(!d.containsLeap(a))return r(a);var f=d.containsLeap.onlyChildren(a);switch(a.type){case"MemberExpression":return r(l.memberExpression(o.explodeExpression(e.get("object")),a.computed?n(null,e.get("property")):a.property,a.computed));case"CallExpression":var h,m=e.get("callee"),y=e.get("arguments"),g=[],v=!1;if(y.each(function(e){v=v||d.containsLeap(e.value)}),c.MemberExpression.check(m.value))if(v){var b=n(o.makeTempVar(),m.get("object")),E=m.value.computed?n(null,m.get("property")):m.value.property;g.unshift(b),h=l.memberExpression(l.memberExpression(b,E,m.value.computed),l.identifier("call"),!1)}else h=o.explodeExpression(m);else h=o.explodeExpression(m),c.MemberExpression.check(h)&&(h=l.sequenceExpression([l.literal(0),h]));return y.each(function(e){g.push(n(null,e))}),r(l.callExpression(h,g));case"NewExpression":return r(l.newExpression(n(null,e.get("callee")),e.get("arguments").map(function(e){return n(null,e)})));case"ObjectExpression":return r(l.objectExpression(e.get("properties").map(function(e){return l.property(e.value.kind,e.value.key,n(null,e.get("value")))})));case"ArrayExpression":return r(l.arrayExpression(e.get("elements").map(function(e){return n(null,e)})));case"SequenceExpression":var x=a.expressions.length-1;return e.get("expressions").each(function(e){e.name===x?s=o.explodeExpression(e,t):o.explodeExpression(e,!0)}),s;case"LogicalExpression":var S=i();t||(s=o.makeTempVar());var A=n(s,e.get("left"));return"&&"===a.operator?o.jumpIfNot(A,S):(u.strictEqual(a.operator,"||"),o.jumpIf(A,S)),n(s,e.get("right"),t),o.mark(S),s;case"ConditionalExpression":var D=i(),S=i(),C=o.explodeExpression(e.get("test"));return o.jumpIfNot(C,D),t||(s=o.makeTempVar()),n(s,e.get("consequent"),t),o.jump(S),o.mark(D),n(s,e.get("alternate"),t),o.mark(S),s;case"UnaryExpression":return r(l.unaryExpression(a.operator,o.explodeExpression(e.get("argument")),!!a.prefix));case"BinaryExpression":return r(l.binaryExpression(a.operator,n(null,e.get("left")),n(null,e.get("right"))));case"AssignmentExpression":return r(l.assignmentExpression(a.operator,o.explodeExpression(e.get("left")),o.explodeExpression(e.get("right"))));case"UpdateExpression":return r(l.updateExpression(a.operator,o.explodeExpression(e.get("argument")),a.prefix));case"YieldExpression":var S=i(),w=a.argument&&o.explodeExpression(e.get("argument"));if(w&&a.delegate){var s=o.makeTempVar();return o.emit(l.returnStatement(l.callExpression(o.contextProperty("delegateYield"),[w,l.literal(s.property.name),S]))),o.mark(S),s}return o.emitAssign(o.contextProperty("next"),S),o.emit(l.returnStatement(w||null)),o.mark(S),o.contextProperty("sent");default:throw new Error("unknown Expression of type "+JSON.stringify(a.type))}}},{2:2,531:531,532:532,533:533,560:560}],530:[function(e,t,r){var n=e(2),i=e(560).types,a=i.namedTypes,s=i.builders,o=Object.prototype.hasOwnProperty;r.hoist=function(e){function t(e,t){a.VariableDeclaration.assert(e);var n=[];return e.declarations.forEach(function(e){r[e.id.name]=e.id,e.init?n.push(s.assignmentExpression("=",e.id,e.init)):t&&n.push(e.id)}),0===n.length?null:1===n.length?n[0]:s.sequenceExpression(n)}n.ok(e instanceof i.NodePath),a.Function.assert(e.value);var r={};i.visit(e.get("body"),{visitVariableDeclaration:function(e){var r=t(e.value,!1);return null!==r?s.expressionStatement(r):(e.replace(),!1)},visitForStatement:function(e){var r=e.value.init;a.VariableDeclaration.check(r)&&e.get("init").replace(t(r,!1)),this.traverse(e)},visitForInStatement:function(e){var r=e.value.left;a.VariableDeclaration.check(r)&&e.get("left").replace(t(r,!0)),this.traverse(e)},visitFunctionDeclaration:function(e){var t=e.value;r[t.id.name]=t.id;var n=(e.parent.node,s.expressionStatement(s.assignmentExpression("=",t.id,s.functionExpression(t.id,t.params,t.body,t.generator,t.expression))));return a.BlockStatement.check(e.parent.node)?(e.parent.get("body").unshift(n),e.replace()):e.replace(n),!1},visitFunctionExpression:function(e){return!1}});var u={};e.get("params").each(function(e){var t=e.value;a.Identifier.check(t)&&(u[t.name]=t)});var p=[];return Object.keys(r).forEach(function(e){o.call(u,e)||p.push(s.variableDeclarator(r[e],null))}),0===p.length?null:s.variableDeclaration("var",p)}},{2:2,560:560}],531:[function(e,t,r){function n(){f.ok(this instanceof n)}function i(e){n.call(this),h.Literal.assert(e),this.returnLoc=e}function a(e,t,r){n.call(this),h.Literal.assert(e),h.Literal.assert(t),r?h.Identifier.assert(r):r=null,this.breakLoc=e,this.continueLoc=t,this.label=r}function s(e){n.call(this),h.Literal.assert(e),this.breakLoc=e}function o(e,t,r){n.call(this),h.Literal.assert(e),t?f.ok(t instanceof u):t=null,r?f.ok(r instanceof p):r=null,f.ok(t||r),this.firstLoc=e,this.catchEntry=t,this.finallyEntry=r}function u(e,t){n.call(this),h.Literal.assert(e),h.Identifier.assert(t),this.firstLoc=e,this.paramId=t}function p(e,t){n.call(this),h.Literal.assert(e),h.Literal.assert(t),this.firstLoc=e,this.afterLoc=t}function l(e,t){n.call(this),h.Literal.assert(e),h.Identifier.assert(t),this.breakLoc=e,this.label=t}function c(t){f.ok(this instanceof c);var r=e(529).Emitter;f.ok(t instanceof r),this.emitter=t,this.entryStack=[new i(t.finalLoc)]}var f=e(2),d=e(560).types,h=d.namedTypes,m=(d.builders,e(13).inherits);Object.prototype.hasOwnProperty;m(i,n),r.FunctionEntry=i,m(a,n),r.LoopEntry=a,m(s,n),r.SwitchEntry=s,m(o,n),r.TryEntry=o,m(u,n),r.CatchEntry=u,m(p,n),r.FinallyEntry=p,m(l,n),r.LabeledEntry=l;var y=c.prototype;r.LeapManager=c,y.withEntry=function(e,t){f.ok(e instanceof n),this.entryStack.push(e);try{t.call(this.emitter)}finally{var r=this.entryStack.pop();f.strictEqual(r,e)}},y._findLeapLocation=function(e,t){for(var r=this.entryStack.length-1;r>=0;--r){var n=this.entryStack[r],i=n[e];if(i)if(t){if(n.label&&n.label.name===t.name)return i}else if(!(n instanceof l))return i}return null},y.getBreakLoc=function(e){return this._findLeapLocation("breakLoc",e)},y.getContinueLoc=function(e){return this._findLeapLocation("continueLoc",e)}},{13:13,2:2,529:529,560:560}],532:[function(e,t,r){function n(e,t){function r(e){function t(e){return r||(o.check(e)?e.some(t):u.Node.check(e)&&(i.strictEqual(r,!1),r=n(e))),r}u.Node.assert(e);var r=!1;return s.eachField(e,function(e,r){t(r)}),r}function n(n){u.Node.assert(n);var i=a(n);return p.call(i,e)?i[e]:p.call(l,n.type)?i[e]=!1:p.call(t,n.type)?i[e]=!0:i[e]=r(n)}return n.onlyChildren=r,n}var i=e(2),a=e(528).makeAccessor(),s=e(560).types,o=s.builtInTypes.array,u=s.namedTypes,p=Object.prototype.hasOwnProperty,l={FunctionExpression:!0},c={CallExpression:!0,ForInStatement:!0,UnaryExpression:!0,BinaryExpression:!0,AssignmentExpression:!0,UpdateExpression:!0,NewExpression:!0},f={YieldExpression:!0,BreakStatement:!0,ContinueStatement:!0,ReturnStatement:!0,ThrowStatement:!0};for(var d in f)p.call(f,d)&&(c[d]=f[d]);r.hasSideEffects=n("hasSideEffects",c),r.containsLeap=n("containsLeap",f)},{2:2,528:528,560:560}],533:[function(e,t,r){var n=(e(2),e(560).types),i=n.namedTypes,a=n.builders,s=Object.prototype.hasOwnProperty;r.defaults=function(e){for(var t,r=arguments.length,n=1;r>n;++n)if(t=arguments[n])for(var i in t)s.call(t,i)&&!s.call(e,i)&&(e[i]=t[i]);return e},r.runtimeProperty=function(e){return a.memberExpression(a.identifier("regeneratorRuntime"),a.identifier(e),!1)},r.isReference=function(e,t){var r=e.value;if(!i.Identifier.check(r))return!1;if(t&&r.name!==t)return!1;var n=e.parent.value;switch(n.type){case"VariableDeclarator":return"init"===e.name;case"MemberExpression":return"object"===e.name||n.computed&&"property"===e.name;case"FunctionExpression":case"FunctionDeclaration":case"ArrowFunctionExpression":return"id"===e.name?!1:"params"===e.parentPath.name&&n.params===e.parentPath.value&&n.params[e.name]===r?!1:!0;case"ClassDeclaration":case"ClassExpression":return"id"!==e.name;case"CatchClause":return"param"!==e.name;case"Property":case"MethodDefinition":return"key"!==e.name;case"ImportSpecifier":case"ImportDefaultSpecifier":case"ImportNamespaceSpecifier":case"LabeledStatement":return!1;default:return!0}}},{2:2,560:560}],534:[function(e,t,r){function n(t){f.Program.assert(t);var r=e(535).runtime.path,n=p.readFileSync(r,"utf8"),i=l.parse(n,{sourceFileName:r}).program.body,a=t.body;a.unshift.apply(a,i)}function i(e){var t=e.value;if(f.Function.assert(t),t.generator&&f.FunctionDeclaration.check(t)){for(var r=e.parent;r&&!f.BlockStatement.check(r.value)&&!f.Program.check(r.value);)r=r.parent;if(!r)return t.id;var n=a(r),i=n.declarations[0].id,s=n.declarations[0].init.callee.object;f.ArrayExpression.assert(s);var o=s.elements.length;return s.elements.push(t.id),d.memberExpression(i,d.literal(o),!0)}return t.id||(t.id=e.scope.parent.declareTemporary("callee$"))}function a(e){u.ok(e instanceof m);var t=e.node;h.assert(t.body);var r=E(t);if(r.decl)return r.decl;r.decl=d.variableDeclaration("var",[d.variableDeclarator(e.scope.declareTemporary("marked"),d.callExpression(d.memberExpression(d.arrayExpression([]),d.identifier("map"),!1),[b("mark")]))]);for(var n=0;n<t.body.length&&s(e.get("body",n));++n);return e.get("body").insertAt(n,r.decl),r.decl}function s(e){var t=e.value;return f.Statement.assert(t),f.ExpressionStatement.check(t)&&f.Literal.check(t.expression)&&"use strict"===t.expression.value}function o(e,t){u.ok(e instanceof c.NodePath);var r=e.value,n=!1;return l.visit(e,{visitFunction:function(e){return e.value!==r?!1:void this.traverse(e)},visitIdentifier:function(e){return"arguments"===e.value.name&&v.isReference(e)?(e.replace(t),n=!0,!1):void this.traverse(e)}}),n}var u=e(2),p=e(1),l=e(560),c=l.types,f=c.namedTypes,d=c.builders,h=c.builtInTypes.array,m=(c.builtInTypes.object,c.NodePath),y=e(530).hoist,g=e(529).Emitter,v=e(533),b=v.runtimeProperty,E=e(528).makeAccessor();r.transform=function(e,t){t=t||{};var r=e instanceof m?e:new m(e);return x.visit(r,t),e=r.value,(t.includeRuntime===!0||"if used"===t.includeRuntime&&x.wasChangeReported())&&n(f.File.check(e)?e.program:e),t.madeChanges=x.wasChangeReported(),e};var x=c.PathVisitor.fromMethodsObject({reset:function(e,t){this.options=t},visitFunction:function(e){this.traverse(e);var t=e.value,r=t.async&&!this.options.disableAsync;if(t.generator||r){this.reportChanged(),t.expression&&(t.expression=!1,t.body=d.blockStatement([d.returnStatement(t.body)])),r&&S.visit(e.get("body"));var n=[],a=[],s=e.get("body","body");s.each(function(e){var t=e.value;t&&null!=t._blockHoist?n.push(t):a.push(t)}),n.length>0&&s.replace(a);var u=i(e);f.Identifier.assert(t.id);var p=d.identifier(t.id.name+"$"),l=e.scope.declareTemporary("context$"),c=e.scope.declareTemporary("args$"),h=y(e),m=o(e,c);m&&(h=h||d.variableDeclaration("var",[]),h.declarations.push(d.variableDeclarator(c,d.identifier("arguments"))));var v=new g(l);v.explode(e.get("body")),h&&h.declarations.length>0&&n.push(h);var E=[v.getContextFunction(p),t.generator?u:d.literal(null),d.thisExpression()],x=v.getTryLocsList();x&&E.push(x);var A=d.callExpression(b(r?"async":"wrap"),E);n.push(d.returnStatement(A)),t.body=d.blockStatement(n);var D=t.generator;return D&&(t.generator=!1),r&&(t.async=!1),D&&f.Expression.check(t)?d.callExpression(b("mark"),[t]):void 0}},visitForOfStatement:function(e){this.traverse(e);var t,r=e.value,n=e.scope.declareTemporary("t$"),i=d.variableDeclarator(n,d.callExpression(b("values"),[r.right])),a=e.scope.declareTemporary("t$"),s=d.variableDeclarator(a,null),o=r.left;f.VariableDeclaration.check(o)?(t=o.declarations[0].id,o.declarations.push(i,s)):(t=o,o=d.variableDeclaration("var",[i,s])),f.Identifier.assert(t);var u=d.expressionStatement(d.assignmentExpression("=",t,d.memberExpression(a,d.identifier("value"),!1)));return f.BlockStatement.check(r.body)?r.body.body.unshift(u):r.body=d.blockStatement([u,r.body]),d.forStatement(o,d.unaryExpression("!",d.memberExpression(d.assignmentExpression("=",a,d.callExpression(d.memberExpression(n,d.identifier("next"),!1),[])),d.identifier("done"),!1)),null,r.body)}}),S=c.PathVisitor.fromMethodsObject({visitFunction:function(e){return!1},visitAwaitExpression:function(e){var t=e.value.argument;return e.value.all&&(t=d.callExpression(d.memberExpression(d.identifier("Promise"),d.identifier("all"),!1),[t])),d.yieldExpression(d.callExpression(b("awrap"),[t]),!1)}})},{1:1,2:2,528:528,529:529,530:530,533:533,535:535,560:560}],535:[function(e,t,r){(function(r){function n(e,t){function r(e){i.push(e)}function n(){this.queue(a(i.join(""),t).code),this.queue(null)}var i=[];return h(r,n)}function i(){e(577)}function a(e,t){if(t=s(t),!b.test(e))return{code:(t.includeRuntime===!0?d.readFileSync(f.join(r,"runtime.js"),"utf-8")+"\n":"")+e};var n=o(t),i=g.parse(e,n),a=new v.NodePath(i),p=a.get("program");return u(e,t)&&l(p.node),m(p,t),g.print(a,n)}function s(t){return t=y.defaults(t||{},{includeRuntime:!1,supportBlockBinding:!0}),t.esprima||(t.esprima=e(1)),c.ok(/harmony/.test(t.esprima.version),"Bad esprima version: "+t.esprima.version),t}function o(e){function t(t){t in e&&(r[t]=e[t])}var r={range:!0};return t("esprima"),t("sourceFileName"),t("sourceMapName"),t("inputSourceMap"),t("sourceRoot"),r}function u(e,t){var r=!!t.supportBlockBinding;return r&&(E.test(e)||(r=!1)),r}function p(e,t){var r=o(s(t)),n=g.parse(e,r);return l(n.program),g.print(n,r).code}function l(t){v.namedTypes.Program.assert(t);var r=e(536)(t,{ast:!0,disallowUnknownReferences:!1,disallowDuplicated:!1,disallowVars:!1,loopClosures:"iife"});if(r.errors)throw new Error(r.errors.join("\n"));return t}var c=e(2),f=e(9),d=e(1),h=e(1),m=e(534).transform,y=e(533),g=e(560),v=g.types,b=/\bfunction\s*\*|\basync\b/,E=/\b(let|const)\s+/;t.exports=n,n.runtime=i,i.path=f.join(r,"runtime.js"),n.varify=p,n.types=v,n.compile=a,n.transform=m}).call(this,"/node_modules/regenerator")},{1:1,2:2,533:533,534:534,536:536,560:560,577:577,9:9}],536:[function(e,t,r){"use strict";function n(e){return D.someof(e,["const","let"])}function i(e){return D.someof(e,["var","const","let"])}function a(e){return"BlockStatement"===e.type&&D.noneof(e.$parent.type,["FunctionDeclaration","FunctionExpression"])}function s(e){return"ForStatement"===e.type&&e.init&&"VariableDeclaration"===e.init.type&&n(e.init.kind)}function o(e){return u(e)&&"VariableDeclaration"===e.left.type&&n(e.left.kind)}function u(e){return D.someof(e.type,["ForInStatement","ForOfStatement"])}function p(e){return D.someof(e.type,["FunctionDeclaration","FunctionExpression"])}function l(e){return D.someof(e.type,["ForStatement","ForInStatement","ForOfStatement","WhileStatement","DoWhileStatement"])}function c(e){var t=e.$parent;return e.$refToScope||"Identifier"===e.type&&!("VariableDeclarator"===t.type&&t.id===e)&&!("MemberExpression"===t.type&&t.computed===!1&&t.property===e)&&!("Property"===t.type&&t.key===e)&&!("LabeledStatement"===t.type&&t.label===e)&&!("CatchClause"===t.type&&t.param===e)&&!(p(t)&&t.id===e)&&!(p(t)&&D.someof(e,t.params))&&!0}function f(e){return c(e)&&("AssignmentExpression"===e.$parent.type&&e.$parent.left===e||"UpdateExpression"===e.$parent.type&&e.$parent.argument===e)}function d(e,t){if(A(!e.$scope),e.$parent=t,e.$scope=e.$parent?e.$parent.$scope:null,"Program"===e.type)e.$scope=new P({kind:"hoist",node:e,parent:null});else if(p(e))e.$scope=new P({kind:"hoist",node:e,parent:e.$parent.$scope}),e.id&&(A("Identifier"===e.id.type),"FunctionDeclaration"===e.type?e.$parent.$scope.add(e.id.name,"fun",e.id,null):"FunctionExpression"===e.type?e.$scope.add(e.id.name,"fun",e.id,null):A(!1)),e.params.forEach(function(t){e.$scope.add(t.name,"param",t,null)});else if("VariableDeclaration"===e.type)A(i(e.kind)),e.declarations.forEach(function(t){A("VariableDeclarator"===t.type);var r=t.id.name;M.disallowVars&&"var"===e.kind&&B(T(t),"var {0} is not allowed (use let or const)",r),e.$scope.add(r,e.kind,t.id,t.range[1])});else if(s(e)||o(e))e.$scope=new P({kind:"block",node:e,parent:e.$parent.$scope});else if(a(e))e.$scope=new P({kind:"block",node:e,parent:e.$parent.$scope});else if("CatchClause"===e.type){var r=e.param;e.$scope=new P({kind:"catch-block",node:e,parent:e.$parent.$scope}),e.$scope.add(r.name,"caught",r,null),e.$scope.closestHoistScope().markPropagates(r.name)}}function h(e,t,r){function n(e){for(var t in e){var r=e[t],n=r?"var":"const";i.hasOwn(t)&&i.remove(t),i.add(t,n,{loc:{start:{line:-1}}},-1)}}var i=new P({kind:"hoist",node:{},parent:null}),a={undefined:!1,Infinity:!1,console:!1};return n(a),n(j.reservedVars),n(j.ecmaIdentifiers),t&&t.forEach(function(e){j[e]?n(j[e]):B(-1,'environment "{0}" not found',e)}),r&&n(r),e.parent=i,i.children.push(e),i}function m(e,t,r){function n(e){if(c(e)){t.add(e.name);var r=e.$scope.lookup(e.name);if(i&&!r&&M.disallowUnknownReferences&&B(T(e),"reference to unknown global variable {0}",e.name),i&&r&&D.someof(r.getKind(e.name),["const","let"])){var n=r.getFromPos(e.name),a=e.range[0];A(D.finitenumber(n)),A(D.finitenumber(a)),n>a&&(e.$scope.hasFunctionScopeBetween(r)||B(T(e),"{0} is referenced before its declaration",e.name))}e.$refToScope=r}}var i=D.own(r,"analyze")?r.analyze:!0;F(e,{pre:n})}function y(e,t,r,i){function a(e){A(r.has(e));for(var t=0;;t++){var n=e+"$"+String(t);if(!r.has(n))return n}}function s(e){if("VariableDeclaration"===e.type&&n(e.kind)){var s=e.$scope.closestHoistScope(),o=e.$scope;i.push({start:e.range[0],end:e.range[0]+e.kind.length,str:"var"}),e.declarations.forEach(function(n){A("VariableDeclarator"===n.type);var u=n.id.name;t.declarator(e.kind);var p=o!==s&&(s.hasOwn(u)||s.doesPropagate(u)),l=p?a(u):u;o.remove(u),s.add(l,"var",n.id,n.range[1]),o.moves=o.moves||w(),o.moves.set(u,{name:l,scope:s}),r.add(l),l!==u&&(t.rename(u,l,T(n)),n.id.originalName=u,n.id.name=l,i.push({start:n.id.range[0],end:n.id.range[1],str:l}))}),e.kind="var"}}function o(e){if(e.$refToScope){var t=e.$refToScope.moves&&e.$refToScope.moves.get(e.name);if(t&&(e.$refToScope=t.scope,e.name!==t.name))if(e.originalName=e.name,e.name=t.name,e.alterop){for(var r=null,n=0;n<i.length;n++){var a=i[n];if(a.node===e){r=a;break}}A(r),r.str=t.name}else i.push({start:e.range[0],end:e.range[1],str:t.name})}}F(e,{pre:s}),F(e,{pre:o}),e.$scope.traverse({pre:function(e){delete e.moves}})}function g(e){function t(e,t){return k(function(r){return F(e,{pre:function(e){if(p(e))return!1;var n=!0,i="loop-variable {0} is captured by a loop-closure that can't be transformed due to use of {1} at line {2}";"BreakStatement"===e.type?B(T(t),i,t.name,"break",T(e)):"ContinueStatement"===e.type?B(T(t),i,t.name,"continue",T(e)):"ReturnStatement"===e.type?B(T(t),i,t.name,"return",T(e)):"YieldExpression"===e.type?B(T(t),i,t.name,"yield",T(e)):"Identifier"===e.type&&"arguments"===e.name?B(T(t),i,t.name,"arguments",T(e)):"VariableDeclaration"===e.type&&"var"===e.kind?B(T(t),i,t.name,"var",T(e)):n=!1,n&&r(!0)}}),!1})}function r(e){var r=null;if(c(e)&&e.$refToScope&&n(e.$refToScope.getKind(e.name))){for(var i=e.$refToScope.node;;){if(p(i))return;if(l(i)){r=i;break}if(i=i.$parent,!i)return}A(l(r));for(var a=e.$refToScope,s="iife"===M.loopClosures,o=e.$scope;o;o=o.parent){if(o===a)return;if(p(o.node)){if(!s){var u='loop-variable {0} is captured by a loop-closure. Tried "loopClosures": "iife" in defs-config.json?';return B(T(e),u,e.name)}if("ForStatement"===r.type&&a.node===r){var f=a.getNode(e.name);return B(T(f),"Not yet specced ES6 feature. {0} is declared in for-loop header and then captured in loop closure",f.name)}if(t(r.body,e))return;r.$iify=!0}}}}F(e,{pre:r})}function v(e,t,r){function n(e,r,n){var i={start:e,end:e,str:r};n&&(i.node=n),t.push(i)}F(e,{pre:function(e){if(e.$iify){var t="BlockStatement"===e.body.type,i=t?e.body.range[0]+1:e.body.range[0],a=t?e.body.range[1]-1:e.body.range[1],s=u(e)&&e.left.declarations[0].id.name,o=C("(function({0}){",s?s:""),p=C("}).call(this{0});",s?", "+s:""),l=r.parse(o+p),c=l.body[0],f=c.expression.callee.object.body;if(t){var d=e.body,h=d.body;d.body=[c],f.body=h}else{var m=e.body;e.body=c,f.body[0]=m}if(n(i,o),s){n(a,"}).call(this, ");var y=c.expression.arguments,g=y[1];g.alterop=!0,n(a,s,g),n(a,");")}else n(a,p)}}})}function b(e){F(e,{pre:function(e){if(f(e)){var t=e.$scope.lookup(e.name);t&&"const"===t.getKind(e.name)&&B(T(e),"can't assign to const variable {0}",e.name)}}})}function E(e,t){F(e,{pre:d});var r=h(e.$scope,M.environments,M.globals),n=I();return r.traverse({pre:function(e){n.addMany(e.decls.keys())}}),m(e,n,t),n}function x(e){F(e,{pre:function(e){for(var t in e)"$"===t[0]&&delete e[t]}})}function S(e,t){for(var r in t)M[r]=t[r];var n;if(D.object(e)){if(!M.ast)return{errors:["Can't produce string output when input is an AST. Did you forget to set options.ast = true?"]};n=e}else{if(!D.string(e))return{errors:["Input was neither an AST object nor a string."]};try{n=M.parse(e,{loc:!0,range:!0})}catch(i){return{errors:[C("line {0} column {1}: Error during input file parsing\n{2}\n{3}",i.lineNumber,i.column,e.split("\n")[i.lineNumber-1],C.repeat(" ",i.column-1)+"^")]
}}}var a=n;B.reset();var s=E(a,{});g(a),b(a);var o=[];if(v(a,o,M),B.errors.length>=1)return{errors:B.errors};o.length>0&&(x(a),s=E(a,{analyze:!1})),A(0===B.errors.length);var u=new O;if(y(a,u,s,o),M.ast)return x(a),{stats:u,ast:a};var p=_(e,o);return{stats:u,src:p}}var A=e(2),D=e(547),C=e(546),w=e(548),I=e(549),_=e(542),F=e(544),k=e(545),P=e(540),B=e(537),T=B.getline,M=e(539),O=e(541),j=e(538);t.exports=S},{2:2,537:537,538:538,539:539,540:540,541:541,542:542,544:544,545:545,546:546,547:547,548:548,549:549}],537:[function(e,t,r){"use strict";function n(e,t){a(arguments.length>=2);var r=2===arguments.length?String(t):i.apply(i,Array.prototype.slice.call(arguments,1));n.errors.push(-1===e?r:i("line {0}: {1}",e,r))}var i=e(546),a=e(2);n.reset=function(){n.errors=[]},n.getline=function(e){return e&&e.loc&&e.loc.start?e.loc.start.line:-1},n.reset(),t.exports=n},{2:2,546:546}],538:[function(e,t,r){"use strict";r.reservedVars={arguments:!1,NaN:!1},r.ecmaIdentifiers={Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,JSON:!1,Math:!1,Map:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,Set:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1,WeakMap:!1},r.browser={ArrayBuffer:!1,ArrayBufferView:!1,Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,DataView:!1,DOMParser:!1,defaultStatus:!1,document:!1,Element:!1,event:!1,FileReader:!1,Float32Array:!1,Float64Array:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Image:!1,length:!1,localStorage:!1,location:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,print:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,top:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1,WebSocket:!1,window:!1,Worker:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},r.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},r.worker={importScripts:!0,postMessage:!0,self:!0},r.nonstandard={escape:!1,unescape:!1},r.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},r.node={__filename:!1,__dirname:!1,Buffer:!1,DataView:!1,console:!1,exports:!0,GLOBAL:!1,global:!1,module:!1,process:!1,require:!1,setTimeout:!1,clearTimeout:!1,setInterval:!1,clearInterval:!1},r.phantom={phantom:!0,require:!0,WebPage:!0},r.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},r.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},r.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},r.jquery={$:!1,jQuery:!1},r.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,Iframe:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},r.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},r.yui={YUI:!1,Y:!1,YUI_config:!1}},{}],539:[function(e,t,r){t.exports={disallowVars:!1,disallowDuplicated:!0,disallowUnknownReferences:!0,parse:e(1).parse}},{1:1}],540:[function(e,t,r){"use strict";function n(e){i(o.someof(e.kind,["hoist","block","catch-block"])),i(o.object(e.node)),i(null===e.parent||o.object(e.parent)),this.kind=e.kind,this.node=e.node,this.parent=e.parent,this.children=[],this.decls=a(),this.written=s(),this.propagates="hoist"===this.kind?s():null,this.parent&&this.parent.children.push(this)}var i=e(2),a=e(548),s=e(549),o=e(547),u=e(546),p=e(537),l=p.getline,c=e(539);n.prototype.print=function(e){e=e||0;var t=this,r=this.decls.keys().map(function(e){return u("{0} [{1}]",e,t.decls.get(e).kind)}).join(", "),n=this.propagates?this.propagates.items().join(", "):"";console.log(u("{0}{1}: {2}. propagates: {3}",u.repeat(" ",e),this.node.type,r,n)),this.children.forEach(function(t){t.print(e+2)})},n.prototype.add=function(e,t,r,n){function a(e){return o.someof(e,["const","let"])}i(o.someof(t,["fun","param","var","caught","const","let"]));var s=this;if(o.someof(t,["fun","param","var"]))for(;"hoist"!==s.kind;){if(s.decls.has(e)&&a(s.decls.get(e).kind))return p(l(r),"{0} is already declared",e);s=s.parent}if(s.decls.has(e)&&(c.disallowDuplicated||a(s.decls.get(e).kind)||a(t)))return p(l(r),"{0} is already declared",e);var u={kind:t,node:r};n&&(i(o.someof(t,["var","const","let"])),u.from=n),s.decls.set(e,u)},n.prototype.getKind=function(e){i(o.string(e));var t=this.decls.get(e);return t?t.kind:null},n.prototype.getNode=function(e){i(o.string(e));var t=this.decls.get(e);return t?t.node:null},n.prototype.getFromPos=function(e){i(o.string(e));var t=this.decls.get(e);return t?t.from:null},n.prototype.hasOwn=function(e){return this.decls.has(e)},n.prototype.remove=function(e){return this.decls.remove(e)},n.prototype.doesPropagate=function(e){return this.propagates.has(e)},n.prototype.markPropagates=function(e){this.propagates.add(e)},n.prototype.closestHoistScope=function(){for(var e=this;"hoist"!==e.kind;)e=e.parent;return e},n.prototype.hasFunctionScopeBetween=function(e){function t(e){return o.someof(e.type,["FunctionDeclaration","FunctionExpression"])}for(var r=this;r;r=r.parent){if(r===e)return!1;if(t(r.node))return!0}throw new Error("wasn't inner scope of outer")},n.prototype.lookup=function(e){for(var t=this;t;t=t.parent){if(t.decls.has(e))return t;"hoist"===t.kind&&t.propagates.add(e)}return null},n.prototype.markWrite=function(e){i(o.string(e)),this.written.add(e)},n.prototype.detectUnmodifiedLets=function(){function e(r){r!==t&&r.decls.keys().forEach(function(e){return"let"!==r.getKind(e)||r.written.has(e)?void 0:p(l(r.getNode(e)),"{0} is declared as let but never modified so could be const",e)}),r.children.forEach(function(t){e(t)})}var t=this;e(this)},n.prototype.traverse=function(e){function t(e){r&&r(e),e.children.forEach(function(e){t(e)}),n&&n(e)}e=e||{};var r=e.pre,n=e.post;t(this)},t.exports=n},{2:2,537:537,539:539,546:546,547:547,548:548,549:549}],541:[function(e,t,r){function n(){this.lets=0,this.consts=0,this.renames=[]}var i=e(546),a=e(547),s=e(2);n.prototype.declarator=function(e){s(a.someof(e,["const","let"])),"const"===e?this.consts++:this.lets++},n.prototype.rename=function(e,t,r){this.renames.push({oldName:e,newName:t,line:r})},n.prototype.toString=function(){var e=this.renames.map(function(e){return e}).sort(function(e,t){return e.line-t.line}),t=e.map(function(e){return i("\nline {0}: {1} => {2}",e.line,e.oldName,e.newName)}).join(""),r=this.consts+this.lets,n=0===r?"can't calculate const coverage (0 consts, 0 lets)":i("{0}% const coverage ({1} consts, {2} lets)",Math.floor(100*this.consts/r),this.consts,this.lets);return n+t+"\n"},t.exports=n},{2:2,546:546,547:547}],542:[function(e,t,r){function n(e,t){"use strict";var r=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)};i("string"==typeof e),i(r(t));for(var n=a(t,function(e,t){return e.start-t.start}),s=[],o=0,u=0;u<n.length;u++){var p=n[u];i(o<=p.start),i(p.start<=p.end),s.push(e.slice(o,p.start)),s.push(p.str),o=p.end}return o<e.length&&s.push(e.slice(o)),s.join("")}var i=e(2),a=e(543);"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{2:2,543:543}],543:[function(e,t,r){!function(){function e(e,t){"function"!=typeof t&&(t=function(e,t){return String(e).localeCompare(t)});var r=e.length;if(1>=r)return e;for(var i=new Array(r),a=1;r>a;a*=2){n(e,t,a,i);var s=e;e=i,i=s}return e}var r=function(t,r){return e(t.slice(),r)};r.inplace=function(t,r){var i=e(t,r);return i!==t&&n(i,null,t.length,t),t};var n=function(e,t,r,n){var i,a,s,o,u,p=e.length,l=0,c=2*r;for(i=0;p>i;i+=c)for(a=i+r,s=a+r,a>p&&(a=p),s>p&&(s=p),o=i,u=a;;)if(a>o&&s>u)t(e[o],e[u])<=0?n[l++]=e[o++]:n[l++]=e[u++];else if(a>o)n[l++]=e[o++];else{if(!(s>u))break;n[l++]=e[u++]}};"undefined"!=typeof t?t.exports=r:window.stable=r}()},{}],544:[function(e,t,r){function n(e,t){"use strict";function r(e,t,s,o){if(e&&"string"==typeof e.type){var u=void 0;if(n&&(u=n(e,t,s,o)),u!==!1)for(var s in e)if(a?!a(s,e):"$"!==s[0]){var p=e[s];if(Array.isArray(p))for(var l=0;l<p.length;l++)r(p[l],e,s,l);else r(p,e,s)}i&&i(e,t,s,o)}}t=t||{};var n=t.pre,i=t.post,a=t.skipProperty;r(e,null)}"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],545:[function(e,t,r){var n=function(){"use strict";function e(e,t){this.val=e,this.brk=t}function t(){return function t(r){throw new e(r,t)}}function r(r){var n=t();try{return r(n)}catch(i){if(i instanceof e&&i.brk===n)return i.val;throw i}}return r}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],546:[function(e,t,r){var n=function(){"use strict";function e(e,t){var r=Array.prototype.slice.call(arguments,1);return e.replace(/\{(\d+)\}/g,function(e,t){return t in r?r[t]:e})}function t(e,t){return e.replace(/\{([_$a-zA-Z0-9][_$a-zA-Z0-9]*)\}/g,function(e,r){return r in t?t[r]:e})}function r(e,t){return new Array(t+1).join(e)}return e.fmt=e,e.obj=t,e.repeat=r,e}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],547:[function(e,t,r){var n=function(){"use strict";var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,r=void 0;return{nan:function(e){return e!==e},"boolean":function(e){return"boolean"==typeof e},number:function(e){return"number"==typeof e},string:function(e){return"string"==typeof e},fn:function(e){return"function"==typeof e},object:function(e){return null!==e&&"object"==typeof e},primitive:function(e){var t=typeof e;return null===e||e===r||"boolean"===t||"number"===t||"string"===t},array:Array.isArray||function(e){return"[object Array]"===t.call(e)},finitenumber:function(e){return"number"==typeof e&&isFinite(e)},someof:function(e,t){return t.indexOf(e)>=0},noneof:function(e,t){return-1===t.indexOf(e)},own:function(t,r){return e.call(t,r)}}}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],548:[function(e,t,r){var n=function(){"use strict";function e(t){return this instanceof e?(this.obj=r(),this.hasProto=!1,this.proto=void 0,void(t&&this.setMany(t))):new e(t)}var t=Object.prototype.hasOwnProperty,r=function(){function e(e){for(var r in e)if(t.call(e,r))return!0;return!1}function r(e){return t.call(e,"__count__")||t.call(e,"__parent__")}var n=!1;if("function"==typeof Object.create&&(e(Object.create(null))||(n=!0)),n===!1&&e({}))throw new Error("StringMap environment error 0, please file a bug at https://github.com/olov/stringmap/issues");var i=n?Object.create(null):{},a=!1;if(r(i)){if(i.__proto__=null,e(i)||r(i))throw new Error("StringMap environment error 1, please file a bug at https://github.com/olov/stringmap/issues");a=!0}return function(){var e=n?Object.create(null):{};return a&&(e.__proto__=null),e}}();return e.prototype.has=function(e){if("string"!=typeof e)throw new Error("StringMap expected string key");return"__proto__"===e?this.hasProto:t.call(this.obj,e)},e.prototype.get=function(e){if("string"!=typeof e)throw new Error("StringMap expected string key");return"__proto__"===e?this.proto:t.call(this.obj,e)?this.obj[e]:void 0},e.prototype.set=function(e,t){if("string"!=typeof e)throw new Error("StringMap expected string key");"__proto__"===e?(this.hasProto=!0,this.proto=t):this.obj[e]=t},e.prototype.remove=function(e){if("string"!=typeof e)throw new Error("StringMap expected string key");var t=this.has(e);return"__proto__"===e?(this.hasProto=!1,this.proto=void 0):delete this.obj[e],t},e.prototype["delete"]=e.prototype.remove,e.prototype.isEmpty=function(){for(var e in this.obj)if(t.call(this.obj,e))return!1;return!this.hasProto},e.prototype.size=function(){var e=0;for(var r in this.obj)t.call(this.obj,r)&&++e;return this.hasProto?e+1:e},e.prototype.keys=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push(r);return this.hasProto&&e.push("__proto__"),e},e.prototype.values=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push(this.obj[r]);return this.hasProto&&e.push(this.proto),e},e.prototype.items=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push([r,this.obj[r]]);return this.hasProto&&e.push(["__proto__",this.proto]),e},e.prototype.setMany=function(e){if(null===e||"object"!=typeof e&&"function"!=typeof e)throw new Error("StringMap expected Object");for(var r in e)t.call(e,r)&&this.set(r,e[r]);return this},e.prototype.merge=function(e){for(var t=e.keys(),r=0;r<t.length;r++){var n=t[r];this.set(n,e.get(n))}return this},e.prototype.map=function(e){for(var t=this.keys(),r=0;r<t.length;r++){var n=t[r];t[r]=e(this.get(n),n)}return t},e.prototype.forEach=function(e){for(var t=this.keys(),r=0;r<t.length;r++){var n=t[r];e(this.get(n),n)}},e.prototype.clone=function(){var t=e();return t.merge(this)},e.prototype.toString=function(){var e=this;return"{"+this.keys().map(function(t){return JSON.stringify(t)+":"+JSON.stringify(e.get(t))}).join(",")+"}"},e}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],549:[function(e,t,r){var n=function(){"use strict";function e(t){return this instanceof e?(this.obj=r(),this.hasProto=!1,void(t&&this.addMany(t))):new e(t)}var t=Object.prototype.hasOwnProperty,r=function(){function e(e){for(var r in e)if(t.call(e,r))return!0;return!1}function r(e){return t.call(e,"__count__")||t.call(e,"__parent__")}var n=!1;if("function"==typeof Object.create&&(e(Object.create(null))||(n=!0)),n===!1&&e({}))throw new Error("StringSet environment error 0, please file a bug at https://github.com/olov/stringset/issues");var i=n?Object.create(null):{},a=!1;if(r(i)){if(i.__proto__=null,e(i)||r(i))throw new Error("StringSet environment error 1, please file a bug at https://github.com/olov/stringset/issues");a=!0}return function(){var e=n?Object.create(null):{};return a&&(e.__proto__=null),e}}();return e.prototype.has=function(e){if("string"!=typeof e)throw new Error("StringSet expected string item");return"__proto__"===e?this.hasProto:t.call(this.obj,e)},e.prototype.add=function(e){if("string"!=typeof e)throw new Error("StringSet expected string item");"__proto__"===e?this.hasProto=!0:this.obj[e]=!0},e.prototype.remove=function(e){if("string"!=typeof e)throw new Error("StringSet expected string item");var t=this.has(e);return"__proto__"===e?this.hasProto=!1:delete this.obj[e],t},e.prototype["delete"]=e.prototype.remove,e.prototype.isEmpty=function(){for(var e in this.obj)if(t.call(this.obj,e))return!1;return!this.hasProto},e.prototype.size=function(){var e=0;for(var r in this.obj)t.call(this.obj,r)&&++e;return this.hasProto?e+1:e},e.prototype.items=function(){var e=[];for(var r in this.obj)t.call(this.obj,r)&&e.push(r);return this.hasProto&&e.push("__proto__"),e},e.prototype.addMany=function(e){if(!Array.isArray(e))throw new Error("StringSet expected array");for(var t=0;t<e.length;t++)this.add(e[t]);return this},e.prototype.merge=function(e){return this.addMany(e.items()),this},e.prototype.clone=function(){var t=e();return t.merge(this)},e.prototype.toString=function(){return"{"+this.items().map(JSON.stringify).join(",")+"}"},e}();"undefined"!=typeof t&&"undefined"!=typeof t.exports&&(t.exports=n)},{}],550:[function(e,t,r){function n(e,t){if(e){if(E.fixFaultyLocations(e),t){if(h.Node.check(e)&&h.SourceLocation.check(e.loc)){for(var r=t.length-1;r>=0&&!(x(t[r].loc.end,e.loc.start)<=0);--r);return void t.splice(r+1,0,e)}}else if(e[S])return e[S];var i;if(m.check(e))i=Object.keys(e);else{if(!y.check(e))return;i=d.getFieldNames(e)}t||Object.defineProperty(e,S,{value:t=[],enumerable:!1});for(var r=0,a=i.length;a>r;++r)n(e[i[r]],t);return t}}function i(e,t){for(var r=n(e),a=0,s=r.length;s>a;){var o=a+s>>1,u=r[o];if(x(u.loc.start,t.loc.start)<=0&&x(t.loc.end,u.loc.end)<=0)return void i(t.enclosingNode=u,t);if(x(u.loc.end,t.loc.start)<=0){var p=u;a=o+1}else{if(!(x(t.loc.end,u.loc.start)<=0))throw new Error("Comment location overlaps with node location");var l=u;s=o}}p&&(t.precedingNode=p),l&&(t.followingNode=l)}function a(e,t){var r=e.length;if(0!==r){for(var n=e[0].precedingNode,i=e[0].followingNode,a=i.loc.start,s=r;s>0;--s){var u=e[s-1];f.strictEqual(u.precedingNode,n),f.strictEqual(u.followingNode,i);var l=t.sliceString(u.loc.end,a);if(/\S/.test(l))break;a=u.loc.start}for(;r>=s&&(u=e[s])&&"Line"===u.type&&u.loc.start.column>i.loc.start.column;)++s;e.forEach(function(e,t){s>t?p(n,e):o(i,e)}),e.length=0}}function s(e,t){var r=e.comments||(e.comments=[]);r.push(t)}function o(e,t){t.leading=!0,t.trailing=!1,s(e,t)}function u(e,t){t.leading=!1,t.trailing=!1,s(e,t)}function p(e,t){t.leading=!1,t.trailing=!0,s(e,t)}function l(e,t){var r=e.getValue();h.Comment.assert(r);var n=r.loc,i=n&&n.lines,a=[t(e)];if(r.trailing)a.push("\n");else if(i instanceof v){var s=i.slice(n.end,i.skipSpaces(n.end));1===s.length?a.push(s):a.push(new Array(s.length).join("\n"))}else a.push("\n");return b(a)}function c(e,t){var r=e.getValue(e);h.Comment.assert(r);var n=r.loc,i=n&&n.lines,a=[];if(i instanceof v){var s=i.skipSpaces(n.start,!0)||i.firstPos(),o=i.slice(s,n.start);1===o.length?a.push(o):a.push(new Array(o.length).join("\n"))}return a.push(t(e)),b(a)}var f=e(2),d=e(558),h=d.namedTypes,m=d.builtInTypes.array,y=d.builtInTypes.object,g=e(552),v=(g.fromString,g.Lines),b=g.concat,E=e(559),x=E.comparePos,S=e(528).makeUniqueKey();r.attach=function(e,t,r){if(m.check(e)){var n=[];e.forEach(function(e){e.loc.lines=r,i(t,e);var s=e.precedingNode,l=e.enclosingNode,c=e.followingNode;if(s&&c){var d=n.length;if(d>0){var h=n[d-1];f.strictEqual(h.precedingNode===e.precedingNode,h.followingNode===e.followingNode),h.followingNode!==e.followingNode&&a(n,r)}n.push(e)}else if(s)a(n,r),p(s,e);else if(c)a(n,r),o(c,e);else{if(!l)throw new Error("AST contains no nodes at all?");a(n,r),u(l,e)}}),a(n,r),e.forEach(function(e){delete e.precedingNode,delete e.enclosingNode,delete e.followingNode})}},r.printComments=function(e,t){var r=e.getValue(),n=t(e),i=h.Node.check(r)&&d.getFieldValue(r,"comments");if(!i||0===i.length)return n;var a=[],s=[n];return e.each(function(e){var r=e.getValue(),n=d.getFieldValue(r,"leading"),i=d.getFieldValue(r,"trailing");n||i&&"Block"!==r.type?a.push(l(e,t)):i&&(f.strictEqual(r.type,"Block"),s.push(c(e,t)))},"comments"),a.push.apply(a,s),b(a)}},{2:2,528:528,552:552,558:558,559:559}],551:[function(e,t,r){function n(e){o.ok(this instanceof n),this.stack=[e]}function i(e,t){for(var r=e.stack,n=r.length-1;n>=0;n-=2){var i=r[n];if(p.Node.check(i)&&--t<0)return i}return null}function a(e){return p.BinaryExpression.check(e)||p.LogicalExpression.check(e)}function s(e){return p.CallExpression.check(e)?!0:l.check(e)?e.some(s):p.Node.check(e)?u.someField(e,function(e,t){return s(t)}):!1}var o=e(2),u=e(558),p=u.namedTypes,l=(p.Node,u.builtInTypes.array),c=u.builtInTypes.number,f=n.prototype;t.exports=n,n.from=function(e){if(e instanceof n)return e.copy();if(e instanceof u.NodePath){for(var t,r=Object.create(n.prototype),i=[e.value];t=e.parentPath;e=t)i.push(e.name,t.value);return r.stack=i.reverse(),r}return new n(e)},f.copy=function h(){var h=Object.create(n.prototype);return h.stack=this.stack.slice(0),h},f.getName=function(){var e=this.stack,t=e.length;return t>1?e[t-2]:null},f.getValue=function(){var e=this.stack;return e[e.length-1]},f.getNode=function(e){return i(this,~~e)},f.getParentNode=function(e){return i(this,~~e+1)},f.getRootValue=function(){var e=this.stack;return e.length%2===0?e[1]:e[0]},f.call=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,a=1;i>a;++a){var s=arguments[a];n=n[s],t.push(s,n)}var o=e(this);return t.length=r,o},f.each=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,a=1;i>a;++a){var s=arguments[a];n=n[s],t.push(s,n)}for(var a=0;a<n.length;++a)a in n&&(t.push(a,n[a]),e(this),t.length-=2);t.length=r},f.map=function(e){for(var t=this.stack,r=t.length,n=t[r-1],i=arguments.length,a=1;i>a;++a){var s=arguments[a];n=n[s],t.push(s,n)}for(var o=new Array(n.length),a=0;a<n.length;++a)a in n&&(t.push(a,n[a]),o[a]=e(this,a),t.length-=2);return t.length=r,o},f.needsParens=function(e){var t=this.getParentNode();if(!t)return!1;var r=this.getName(),n=this.getNode();if(this.getValue()!==n)return!1;if(!p.Expression.check(n))return!1;if("Identifier"===n.type)return!1;if("ParenthesizedExpression"===t.type)return!1;switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===t.type&&"object"===r&&t.object===n;case"BinaryExpression":case"LogicalExpression":switch(t.type){case"CallExpression":return"callee"===r&&t.callee===n;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===r&&t.object===n;case"BinaryExpression":case"LogicalExpression":var i=t.operator,u=d[i],l=n.operator,f=d[l];if(u>f)return!0;if(u===f&&"right"===r)return o.strictEqual(t.right,n),!0;default:return!1}case"SequenceExpression":switch(t.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==r;default:return!0}case"YieldExpression":switch(t.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===t.type&&c.check(n.value)&&"object"===r&&t.object===n;case"AssignmentExpression":case"ConditionalExpression":switch(t.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===r&&t.callee===n;case"ConditionalExpression":return"test"===r&&t.test===n;case"MemberExpression":return"object"===r&&t.object===n;default:return!1}case"ArrowFunctionExpression":return a(t);case"ObjectExpression":if("ArrowFunctionExpression"===t.type&&"body"===r)return!0;default:if("NewExpression"===t.type&&"callee"===r&&t.callee===n)return s(n)}return e!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement()?!0:!1};var d={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){d[e]=t})}),f.canBeFirstInStatement=function(){var e=this.getNode();return!p.FunctionExpression.check(e)&&!p.ObjectExpression.check(e)},f.firstInStatement=function(){for(var e,t,r,n,i=this.stack,s=i.length-1;s>=0;s-=2)if(p.Node.check(i[s])&&(r=e,n=t,e=i[s-1],t=i[s]),t&&n){if(p.BlockStatement.check(t)&&"body"===e&&0===r)return o.strictEqual(t.body[0],n),!0;if(p.ExpressionStatement.check(t)&&"expression"===r)return o.strictEqual(t.expression,n),!0;if(p.SequenceExpression.check(t)&&"expressions"===e&&0===r)o.strictEqual(t.expressions[0],n);else if(p.CallExpression.check(t)&&"callee"===r)o.strictEqual(t.callee,n);else if(p.MemberExpression.check(t)&&"object"===r)o.strictEqual(t.object,n);else if(p.ConditionalExpression.check(t)&&"test"===r)o.strictEqual(t.test,n);else if(a(t)&&"left"===r)o.strictEqual(t.left,n);else{if(!p.UnaryExpression.check(t)||t.prefix||"argument"!==r)return!1;o.strictEqual(t.argument,n)}}return!0}},{2:2,558:558}],552:[function(e,t,r){function n(e){return e[d]}function i(e,t){l.ok(this instanceof i),l.ok(e.length>0),t?m.assert(t):t=null,Object.defineProperty(this,d,{value:{infos:e,mappings:[],name:t,cachedSourceMap:null}}),t&&n(this).mappings.push(new g(this,{start:this.firstPos(),end:this.lastPos()}))}function a(e){return{line:e.line,indent:e.indent,sliceStart:e.sliceStart,sliceEnd:e.sliceEnd}}function s(e,t){for(var r=0,n=e.length,i=0;n>i;++i)switch(e.charCodeAt(i)){case 9:l.strictEqual(typeof t,"number"),l.ok(t>0);var a=Math.ceil(r/t)*t;a===r?r+=t:r=a;break;case 11:case 12:case 13:case 65279:break;case 32:default:r+=1}return r}function o(e,t){if(e instanceof i)return e;e+="";var r=t&&t.tabWidth,n=e.indexOf(" ")<0,a=!t&&n&&e.length<=x;if(l.ok(r||n,"No tab width specified but encountered tabs in string\n"+e),a&&E.call(b,e))return b[e];var o=new i(e.split(A).map(function(e){var t=S.exec(e)[0];return{line:e,indent:s(t,r),sliceStart:t.length,sliceEnd:e.length}}),f(t).sourceFileName);return a&&(b[e]=o),o}function u(e){return!/\S/.test(e)}function p(e,t,r){var n=e.sliceStart,i=e.sliceEnd,a=Math.max(e.indent,0),s=a+i-n;return"undefined"==typeof r&&(r=s),t=Math.max(t,0),r=Math.min(r,s),r=Math.max(r,t),a>r?(a=r,i=n):i-=s-r,s=r,s-=t,a>t?a-=t:(t-=a,a=0,n+=t),l.ok(a>=0),l.ok(i>=n),l.strictEqual(s,a+i-n),e.indent===a&&e.sliceStart===n&&e.sliceEnd===i?e:{line:e.line,indent:a,sliceStart:n,sliceEnd:i}}var l=e(2),c=e(599),f=e(554).normalize,d=e(528).makeUniqueKey(),h=e(558),m=h.builtInTypes.string,y=e(559).comparePos,g=e(553);r.Lines=i;var v=i.prototype;Object.defineProperties(v,{length:{get:function(){return n(this).infos.length}},name:{get:function(){return n(this).name}}});var b={},E=b.hasOwnProperty,x=10;r.countSpaces=s;var S=/^\s*/,A=/\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/;r.fromString=o,v.toString=function(e){return this.sliceString(this.firstPos(),this.lastPos(),e)},v.getSourceMap=function(e,t){function r(r){return r=r||{},m.assert(e),r.file=e,t&&(m.assert(t),r.sourceRoot=t),r}if(!e)return null;var i=this,a=n(i);if(a.cachedSourceMap)return r(a.cachedSourceMap.toJSON());var s=new c.SourceMapGenerator(r()),o={};return a.mappings.forEach(function(e){for(var t=e.sourceLines.skipSpaces(e.sourceLoc.start)||e.sourceLines.lastPos(),r=i.skipSpaces(e.targetLoc.start)||i.lastPos();y(t,e.sourceLoc.end)<0&&y(r,e.targetLoc.end)<0;){var n=e.sourceLines.charAt(t),a=i.charAt(r);l.strictEqual(n,a);var u=e.sourceLines.name;if(s.addMapping({source:u,original:{line:t.line,column:t.column},generated:{line:r.line,column:r.column}}),!E.call(o,u)){var p=e.sourceLines.toString();s.setSourceContent(u,p),o[u]=p}i.nextPos(r,!0),e.sourceLines.nextPos(t,!0)}}),a.cachedSourceMap=s,s.toJSON()},v.bootstrapCharAt=function(e){l.strictEqual(typeof e,"object"),l.strictEqual(typeof e.line,"number"),l.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,n=this.toString().split(A),i=n[t-1];return"undefined"==typeof i?"":r===i.length&&t<n.length?"\n":r>=i.length?"":i.charAt(r)},v.charAt=function(e){l.strictEqual(typeof e,"object"),l.strictEqual(typeof e.line,"number"),l.strictEqual(typeof e.column,"number");var t=e.line,r=e.column,i=n(this),a=i.infos,s=a[t-1],o=r;if("undefined"==typeof s||0>o)return"";var u=this.getIndentAt(t);return u>o?" ":(o+=s.sliceStart-u,o===s.sliceEnd&&t<this.length?"\n":o>=s.sliceEnd?"":s.line.charAt(o))},v.stripMargin=function(e,t){if(0===e)return this;if(l.ok(e>0,"negative margin: "+e),t&&1===this.length)return this;var r=n(this),s=new i(r.infos.map(function(r,n){return r.line&&(n>0||!t)&&(r=a(r),r.indent=Math.max(0,r.indent-e)),r}));if(r.mappings.length>0){var o=n(s).mappings;l.strictEqual(o.length,0),r.mappings.forEach(function(r){o.push(r.indent(e,t,!0))})}return s},v.indent=function(e){if(0===e)return this;var t=n(this),r=new i(t.infos.map(function(t){return t.line&&(t=a(t),t.indent+=e),t}));if(t.mappings.length>0){var s=n(r).mappings;l.strictEqual(s.length,0),t.mappings.forEach(function(t){s.push(t.indent(e))})}return r},v.indentTail=function(e){if(0===e)return this;if(this.length<2)return this;var t=n(this),r=new i(t.infos.map(function(t,r){return r>0&&t.line&&(t=a(t),t.indent+=e),t}));if(t.mappings.length>0){var s=n(r).mappings;l.strictEqual(s.length,0),t.mappings.forEach(function(t){s.push(t.indent(e,!0))})}return r},v.getIndentAt=function(e){l.ok(e>=1,"no line "+e+" (line numbers start from 1)");var t=n(this),r=t.infos[e-1];return Math.max(r.indent,0)},v.guessTabWidth=function(){var e=n(this);if(E.call(e,"cachedTabWidth"))return e.cachedTabWidth;for(var t=[],r=0,i=1,a=this.length;a>=i;++i){var s=e.infos[i-1],o=s.line.slice(s.sliceStart,s.sliceEnd);if(!u(o)){var p=Math.abs(s.indent-r);t[p]=~~t[p]+1,r=s.indent}}for(var l=-1,c=2,f=1;f<t.length;f+=1)E.call(t,f)&&t[f]>l&&(l=t[f],c=f);return e.cachedTabWidth=c},v.isOnlyWhitespace=function(){return u(this.toString())},v.isPrecededOnlyByWhitespace=function(e){var t=n(this),r=t.infos[e.line-1],i=Math.max(r.indent,0),a=e.column-i;if(0>=a)return!0;var s=r.sliceStart,o=Math.min(s+a,r.sliceEnd),p=r.line.slice(s,o);return u(p)},v.getLineLength=function(e){var t=n(this),r=t.infos[e-1];return this.getIndentAt(e)+r.sliceEnd-r.sliceStart},v.nextPos=function(e,t){var r=Math.max(e.line,0),n=Math.max(e.column,0);return n<this.getLineLength(r)?(e.column+=1,t?!!this.skipSpaces(e,!1,!0):!0):r<this.length?(e.line+=1,e.column=0,t?!!this.skipSpaces(e,!1,!0):!0):!1},v.prevPos=function(e,t){var r=e.line,n=e.column;if(1>n){if(r-=1,1>r)return!1;n=this.getLineLength(r)}else n=Math.min(n-1,this.getLineLength(r));return e.line=r,e.column=n,t?!!this.skipSpaces(e,!0,!0):!0},v.firstPos=function(){return{line:1,column:0}},v.lastPos=function(){return{line:this.length,column:this.getLineLength(this.length)}},v.skipSpaces=function(e,t,r){if(e=e?r?e:{line:e.line,column:e.column}:t?this.lastPos():this.firstPos(),t){for(;this.prevPos(e);)if(!u(this.charAt(e))&&this.nextPos(e))return e;return null}for(;u(this.charAt(e));)if(!this.nextPos(e))return null;return e},v.trimLeft=function(){var e=this.skipSpaces(this.firstPos(),!1,!0);return e?this.slice(e):D},v.trimRight=function(){var e=this.skipSpaces(this.lastPos(),!0,!0);return e?this.slice(this.firstPos(),e):D},v.trim=function(){var e=this.skipSpaces(this.firstPos(),!1,!0);if(null===e)return D;var t=this.skipSpaces(this.lastPos(),!0,!0);return l.notStrictEqual(t,null),this.slice(e,t)},v.eachPos=function(e,t,r){
var n=this.firstPos();if(t&&(n.line=t.line,n.column=t.column),!r||this.skipSpaces(n,!1,!0))do e.call(this,n);while(this.nextPos(n,r))},v.bootstrapSlice=function(e,t){var r=this.toString().split(A).slice(e.line-1,t.line);return r.push(r.pop().slice(0,t.column)),r[0]=r[0].slice(e.column),o(r.join("\n"))},v.slice=function(e,t){if(!t){if(!e)return this;t=this.lastPos()}var r=n(this),a=r.infos.slice(e.line-1,t.line);e.line===t.line?a[0]=p(a[0],e.column,t.column):(l.ok(e.line<t.line),a[0]=p(a[0],e.column),a.push(p(a.pop(),0,t.column)));var s=new i(a);if(r.mappings.length>0){var o=n(s).mappings;l.strictEqual(o.length,0),r.mappings.forEach(function(r){var n=r.slice(this,e,t);n&&o.push(n)},this)}return s},v.bootstrapSliceString=function(e,t,r){return this.slice(e,t).toString(r)},v.sliceString=function(e,t,r){if(!t){if(!e)return this;t=this.lastPos()}r=f(r);for(var i=n(this).infos,a=[],o=r.tabWidth,l=e.line;l<=t.line;++l){var c=i[l-1];l===e.line?c=l===t.line?p(c,e.column,t.column):p(c,e.column):l===t.line&&(c=p(c,0,t.column));var d=Math.max(c.indent,0),h=c.line.slice(0,c.sliceStart);if(r.reuseWhitespace&&u(h)&&s(h,r.tabWidth)===d)a.push(c.line.slice(0,c.sliceEnd));else{var m=0,y=d;r.useTabs&&(m=Math.floor(d/o),y-=m*o);var g="";m>0&&(g+=new Array(m+1).join(" ")),y>0&&(g+=new Array(y+1).join(" ")),g+=c.line.slice(c.sliceStart,c.sliceEnd),a.push(g)}}return a.join(r.lineTerminator)},v.isEmpty=function(){return this.length<2&&this.getLineLength(1)<1},v.join=function(e){function t(e){if(null!==e){if(s){var t=e.infos[0],r=new Array(t.indent+1).join(" "),n=l.length,i=Math.max(s.indent,0)+s.sliceEnd-s.sliceStart;s.line=s.line.slice(0,s.sliceEnd)+r+t.line.slice(t.sliceStart,t.sliceEnd),s.sliceEnd=s.line.length,e.mappings.length>0&&e.mappings.forEach(function(e){c.push(e.add(n,i))})}else e.mappings.length>0&&c.push.apply(c,e.mappings);e.infos.forEach(function(e,t){(!s||t>0)&&(s=a(e),l.push(s))})}}function r(e,r){r>0&&t(p),t(e)}var s,u=this,p=n(u),l=[],c=[];if(e.map(function(e){var t=o(e);return t.isEmpty()?null:n(t)}).forEach(u.isEmpty()?t:r),l.length<1)return D;var f=new i(l);return n(f).mappings=c,f},r.concat=function(e){return D.join(e)},v.concat=function(e){var t=arguments,r=[this];return r.push.apply(r,t),l.strictEqual(r.length,t.length+1),D.join(r)};var D=o("")},{2:2,528:528,553:553,554:554,558:558,559:559,599:599}],553:[function(e,t,r){function n(e,t,r){o.ok(this instanceof n),o.ok(e instanceof f.Lines),l.assert(t),r?o.ok(p.check(r.start.line)&&p.check(r.start.column)&&p.check(r.end.line)&&p.check(r.end.column)):r=t,Object.defineProperties(this,{sourceLines:{value:e},sourceLoc:{value:t},targetLoc:{value:r}})}function i(e,t,r){return{line:e.line+t-1,column:1===e.line?e.column+r:e.column}}function a(e,t,r){return{line:e.line-t+1,column:e.line===t?e.column-r:e.column}}function s(e,t,r,n,i){o.ok(e instanceof f.Lines),o.ok(r instanceof f.Lines),c.assert(t),c.assert(n),c.assert(i);var a=d(n,i);if(0===a)return t;if(0>a){var s=e.skipSpaces(t),u=r.skipSpaces(n),p=i.line-u.line;for(s.line+=p,u.line+=p,p>0?(s.column=0,u.column=0):o.strictEqual(p,0);d(u,i)<0&&r.nextPos(u,!0);)o.ok(e.nextPos(s,!0)),o.strictEqual(e.charAt(s),r.charAt(u))}else{var s=e.skipSpaces(t,!0),u=r.skipSpaces(n,!0),p=i.line-u.line;for(s.line+=p,u.line+=p,0>p?(s.column=e.getLineLength(s.line),u.column=r.getLineLength(u.line)):o.strictEqual(p,0);d(i,u)<0&&r.prevPos(u,!0);)o.ok(e.prevPos(s,!0)),o.strictEqual(e.charAt(s),r.charAt(u))}return s}var o=e(2),u=e(558),p=(u.builtInTypes.string,u.builtInTypes.number),l=u.namedTypes.SourceLocation,c=u.namedTypes.Position,f=e(552),d=e(559).comparePos,h=n.prototype;t.exports=n,h.slice=function(e,t,r){function i(n){var i=p[n],a=l[n],c=t;return"end"===n?c=r:o.strictEqual(n,"start"),s(u,i,e,a,c)}o.ok(e instanceof f.Lines),c.assert(t),r?c.assert(r):r=e.lastPos();var u=this.sourceLines,p=this.sourceLoc,l=this.targetLoc;if(d(t,l.start)<=0)if(d(l.end,r)<=0)l={start:a(l.start,t.line,t.column),end:a(l.end,t.line,t.column)};else{if(d(r,l.start)<=0)return null;p={start:p.start,end:i("end")},l={start:a(l.start,t.line,t.column),end:a(r,t.line,t.column)}}else{if(d(l.end,t)<=0)return null;d(l.end,r)<=0?(p={start:i("start"),end:p.end},l={start:{line:1,column:0},end:a(l.end,t.line,t.column)}):(p={start:i("start"),end:i("end")},l={start:{line:1,column:0},end:a(r,t.line,t.column)})}return new n(this.sourceLines,p,l)},h.add=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:i(this.targetLoc.start,e,t),end:i(this.targetLoc.end,e,t)})},h.subtract=function(e,t){return new n(this.sourceLines,this.sourceLoc,{start:a(this.targetLoc.start,e,t),end:a(this.targetLoc.end,e,t)})},h.indent=function(e,t,r){if(0===e)return this;var i=this.targetLoc,a=i.start.line,s=i.end.line;if(t&&1===a&&1===s)return this;if(i={start:i.start,end:i.end},!t||a>1){var o=i.start.column+e;i.start={line:a,column:r?Math.max(0,o):o}}if(!t||s>1){var u=i.end.column+e;i.end={line:s,column:r?Math.max(0,u):u}}return new n(this.sourceLines,this.sourceLoc,i)}},{2:2,552:552,558:558,559:559}],554:[function(e,t,r){var n={esprima:e(1),tabWidth:4,useTabs:!1,reuseWhitespace:!0,lineTerminator:e(8).EOL,wrapColumn:74,sourceFileName:null,sourceMapName:null,sourceRoot:null,inputSourceMap:null,range:!1,tolerant:!0,quote:null,trailingComma:!1},i=n.hasOwnProperty;r.normalize=function(e){function t(t){return i.call(e,t)?e[t]:n[t]}return e=e||n,{tabWidth:+t("tabWidth"),useTabs:!!t("useTabs"),reuseWhitespace:!!t("reuseWhitespace"),lineTerminator:t("lineTerminator"),wrapColumn:Math.max(t("wrapColumn"),0),sourceFileName:t("sourceFileName"),sourceMapName:t("sourceMapName"),sourceRoot:t("sourceRoot"),inputSourceMap:t("inputSourceMap"),esprima:t("esprima"),range:t("range"),tolerant:t("tolerant"),quote:t("quote"),trailingComma:t("trailingComma")}}},{1:1,8:8}],555:[function(e,t,r){function n(e){i.ok(this instanceof n),this.lines=e,this.indent=0}var i=e(2),a=e(558),s=(a.namedTypes,a.builders),o=a.builtInTypes.object,u=a.builtInTypes.array,p=(a.builtInTypes["function"],e(556).Patcher,e(554).normalize),l=e(552).fromString,c=e(550).attach,f=e(559);r.parse=function(e,t){t=p(t);var r=l(e,t),i=r.toString({tabWidth:t.tabWidth,reuseWhitespace:!1,useTabs:!1}),a=[],o=t.esprima.parse(i,{loc:!0,locations:!0,range:t.range,comment:!0,onComment:a,tolerant:t.tolerant,ecmaVersion:6,sourceType:"module"});o.loc=o.loc||{start:r.firstPos(),end:r.lastPos()},o.loc.lines=r,o.loc.indent=0;var u=f.getTrueLoc(o,r);o.loc.start=u.start,o.loc.end=u.end,o.comments&&(a=o.comments,delete o.comments);var d=s.file(o);return d.loc={lines:r,indent:0,start:r.firstPos(),end:r.lastPos()},c(a,o.body.length?d.program:d,r),new n(r).copy(d)};var d=n.prototype;d.copy=function(e){if(u.check(e))return e.map(this.copy,this);if(!o.check(e))return e;f.fixFaultyLocations(e);var t=Object.create(Object.getPrototypeOf(e),{original:{value:e,configurable:!1,enumerable:!1,writable:!0}}),r=e.loc,n=this.indent,i=n;r&&(("Block"===e.type||"Line"===e.type||this.lines.isPrecededOnlyByWhitespace(r.start))&&(i=this.indent=r.start.column),r.lines=this.lines,r.indent=i);for(var a=Object.keys(e),s=a.length,p=0;s>p;++p){var l=a[p];"loc"===l?t[l]=e[l]:t[l]=this.copy(e[l])}return this.indent=n,t}},{2:2,550:550,552:552,554:554,556:556,558:558,559:559}],556:[function(e,t,r){function n(e){d.ok(this instanceof n),d.ok(e instanceof h.Lines);var t=this,r=[];t.replace=function(e,t){D.check(t)&&(t=h.fromString(t)),r.push({lines:t,start:e.start,end:e.end})},t.get=function(t){function n(t,r){d.ok(E(t,r)<=0),a.push(e.slice(t,r))}t=t||{start:{line:1,column:0},end:{line:e.length,column:e.getLineLength(e.length)}};var i=t.start,a=[];return r.sort(function(e,t){return E(e.start,t.start)}).forEach(function(e){E(i,e.start)>0||(n(i,e.start),a.push(e.lines),i=e.end)}),n(i,t.end),h.concat(a)}}function i(e){var t=[];return e.comments&&e.comments.length>0&&e.comments.forEach(function(e){(e.leading||e.trailing)&&t.push(e)}),t}function a(e,t){var r=e.getValue();y.assert(r);var n=r.original;if(y.assert(n),d.deepEqual(t,[]),r.type!==n.type)return!1;var i=new x(n),a=f(e,i,t);return a||(t.length=0),a}function s(e,t,r){var n=e.getValue(),i=t.getValue();return n===i?!0:A.check(n)?o(e,t,r):S.check(n)?u(e,t,r):!1}function o(e,t,r){var n=e.getValue(),i=t.getValue();A.assert(n);var a=n.length;if(!A.check(i)||i.length!==a)return!1;for(var o=0;a>o;++o){e.stack.push(o,n[o]),t.stack.push(o,i[o]);var u=s(e,t,r);if(e.stack.length-=2,t.stack.length-=2,!u)return!1}return!0}function u(e,t,r){var n=e.getValue();if(S.assert(n),null===n.original)return!1;var i=t.getValue();if(!S.check(i))return!1;if(y.check(n)){if(!y.check(i))return!1;if(n.type===i.type){var a=[];if(f(e,t,a))r.push.apply(r,a);else{if(!i.loc)return!1;r.push({oldPath:t.copy(),newPath:e.copy()})}return!0}return g.check(n)&&g.check(i)&&i.loc?(r.push({oldPath:t.copy(),newPath:e.copy()}),!0):!1}return f(e,t,r)}function p(e){var t=e.getValue(),r=t.loc,n=r&&r.lines;if(n){var i=I;for(i.line=r.start.line,i.column=r.start.column;n.prevPos(i);){var a=n.charAt(i);if("("===a)return E(e.getRootValue().loc.start,i)<=0;if(_.test(a))return!1}}return!1}function l(e){var t=e.getValue(),r=t.loc,n=r&&r.lines;if(n){var i=I;i.line=r.end.line,i.column=r.end.column;do{var a=n.charAt(i);if(")"===a)return E(i,e.getRootValue().loc.end)<=0;if(_.test(a))return!1}while(n.nextPos(i))}return!1}function c(e){return p(e)&&l(e)}function f(e,t,r){var n=e.getValue(),i=t.getValue();if(S.assert(n),S.assert(i),null===n.original)return!1;if(!e.canBeFirstInStatement()&&e.firstInStatement()&&!p(t))return!1;if(e.needsParens(!0)&&!c(t))return!1;for(var a in b.getUnionOfKeys(n,i))if("loc"!==a){e.stack.push(a,m.getFieldValue(n,a)),t.stack.push(a,m.getFieldValue(i,a));var o=s(e,t,r);if(e.stack.length-=2,t.stack.length-=2,!o)return!1}return!0}var d=e(2),h=e(552),m=e(558),y=(m.getFieldValue,m.namedTypes.Printable),g=m.namedTypes.Expression,v=m.namedTypes.SourceLocation,b=e(559),E=b.comparePos,x=e(551),S=m.builtInTypes.object,A=m.builtInTypes.array,D=m.builtInTypes.string,C=/[0-9a-z_$]/i;r.Patcher=n;var w=n.prototype;w.tryToReprintComments=function(e,t,r){var n=this;if(!e.comments&&!t.comments)return!0;var a=x.from(e),s=x.from(t);a.stack.push("comments",i(e)),s.stack.push("comments",i(t));var u=[],p=o(a,s,u);return p&&u.length>0&&u.forEach(function(e){var t=e.oldPath.getValue();d.ok(t.leading||t.trailing),n.replace(t.loc,r(e.newPath).indentTail(t.loc.indent))}),p},w.deleteComments=function(e){if(e.comments){var t=this;e.comments.forEach(function(r){r.leading?t.replace({start:r.loc.start,end:e.loc.lines.skipSpaces(r.loc.end,!1,!1)},""):r.trailing&&t.replace({start:e.loc.lines.skipSpaces(r.loc.start,!0,!1),end:r.loc.end},"")})}},r.getReprinter=function(e){d.ok(e instanceof x);var t=e.getValue();if(y.check(t)){var r=t.original,i=r&&r.loc,s=i&&i.lines,o=[];if(s&&a(e,o))return function(e){var t=new n(s);return o.forEach(function(r){var n=r.newPath.getValue(),i=r.oldPath.getValue();v.assert(i.loc,!0);var a=!t.tryToReprintComments(n,i,e);a&&t.deleteComments(i);var o=b.copyPos(i.loc.start),u=s.prevPos(o)&&C.test(s.charAt(o)),p=e(r.newPath,a).indentTail(i.loc.indent),l=C.test(s.charAt(i.loc.end));if(u||l){var c=[];u&&c.push(" "),c.push(p),l&&c.push(" "),p=h.concat(c)}t.replace(i.loc,p)}),t.get(i).indentTail(-r.loc.indent)}}};var I={line:1,column:0},_=/\S/},{2:2,551:551,552:552,558:558,559:559}],557:[function(e,t,r){function n(e,t){E.ok(this instanceof n),F.assert(e),this.code=e,t&&(k.assert(t),this.map=t)}function i(e){function t(e){return E.ok(e instanceof P),x(e,r)}function r(e,r){if(r)return t(e);if(E.ok(e instanceof P),!l){var n=c.tabWidth,i=e.getNode().loc;if(i&&i.lines&&i.lines.guessTabWidth){c.tabWidth=i.lines.guessTabWidth();var a=o(e);return c.tabWidth=n,a}}return o(e)}function o(e){var t=w(e);return t?a(e,t(r)):u(e)}function u(e){return s(e,c,t)}function p(e){return s(e,c,p)}E.ok(this instanceof i);var l=e&&e.tabWidth,c=C(e);E.notStrictEqual(c,e),c.sourceFileName=null,this.print=function(e){if(!e)return O;var t=r(P.from(e),!0);return new n(t.toString(c),B.composeSourceMaps(c.inputSourceMap,t.getSourceMap(c.sourceMapName,c.sourceRoot)))},this.printGenerically=function(e){if(!e)return O;var t=P.from(e),r=c.reuseWhitespace;c.reuseWhitespace=!1;var i=new n(p(t).toString(c));return c.reuseWhitespace=r,i}}function a(e,t){return e.needsParens()?D(["(",t,")"]):t}function s(e,t,r){return E.ok(e instanceof P),a(e,o(e,t,r))}function o(e,t,r){var n=e.getValue();if(!n)return A("");if("string"==typeof n)return A(n,t);switch(_.Printable.assert(n),n.type){case"File":return e.call(r,"program");case"Program":return e.call(function(e){return u(e,t,r)},"body");case"Noop":case"EmptyStatement":return A("");case"ExpressionStatement":return D([e.call(r,"expression"),";"]);case"ParenthesizedExpression":return D(["(",e.call(r,"expression"),")"]);case"BinaryExpression":case"LogicalExpression":case"AssignmentExpression":return A(" ").join([e.call(r,"left"),n.operator,e.call(r,"right")]);case"AssignmentPattern":return D([e.call(r,"left"),"=",e.call(r,"right")]);case"MemberExpression":var i=[e.call(r,"object")],a=e.call(r,"property");return n.computed?i.push("[",a,"]"):i.push(".",a),D(i);case"MetaProperty":return D([e.call(r,"meta"),".",e.call(r,"property")]);case"BindExpression":var i=[];return n.object&&i.push(e.call(r,"object")),i.push("::",e.call(r,"callee")),D(i);case"Path":return A(".").join(n.body);case"Identifier":return D([A(n.name,t),e.call(r,"typeAnnotation")]);case"SpreadElement":case"SpreadElementPattern":case"SpreadProperty":case"SpreadPropertyPattern":case"RestElement":return D(["...",e.call(r,"argument")]);case"FunctionDeclaration":case"FunctionExpression":var i=[];return n.async&&i.push("async "),i.push("function"),n.generator&&i.push("*"),n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),i.push("(",d(e,t,r),")",e.call(r,"returnType")," ",e.call(r,"body")),D(i);case"ArrowFunctionExpression":var i=[];return n.async&&i.push("async "),1!==n.params.length||n.rest||"SpreadElementPattern"===n.params[0].type||"RestElement"===n.params[0].type?i.push("(",d(e,t,r),")"):i.push(e.call(r,"params",0)),i.push(" => ",e.call(r,"body")),D(i);case"MethodDefinition":var i=[];return n["static"]&&i.push("static "),i.push(c(e,t,r)),D(i);case"YieldExpression":var i=["yield"];return n.delegate&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),D(i);case"AwaitExpression":var i=["await"];return n.all&&i.push("*"),n.argument&&i.push(" ",e.call(r,"argument")),D(i);case"ModuleDeclaration":var i=["module",e.call(r,"id")];return n.source?(E.ok(!n.body),i.push("from",e.call(r,"source"))):i.push(e.call(r,"body")),A(" ").join(i);case"ImportSpecifier":var i=[];return n.imported?(i.push(e.call(r,"imported")),n.local&&n.local.name!==n.imported.name&&i.push(" as ",e.call(r,"local"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),D(i);case"ExportSpecifier":var i=[];return n.local?(i.push(e.call(r,"local")),n.exported&&n.exported.name!==n.local.name&&i.push(" as ",e.call(r,"exported"))):n.id&&(i.push(e.call(r,"id")),n.name&&i.push(" as ",e.call(r,"name"))),D(i);case"ExportBatchSpecifier":return A("*");case"ImportNamespaceSpecifier":var i=["* as "];return n.local?i.push(e.call(r,"local")):n.id&&i.push(e.call(r,"id")),D(i);case"ImportDefaultSpecifier":return n.local?e.call(r,"local"):e.call(r,"id");case"ExportDeclaration":var i=["export"];if(n["default"])i.push(" default");else if(n.specifiers&&n.specifiers.length>0)return 1===n.specifiers.length&&"ExportBatchSpecifier"===n.specifiers[0].type?i.push(" *"):i.push(" { ",A(", ").join(e.map(r,"specifiers"))," }"),n.source&&i.push(" from ",e.call(r,"source")),i.push(";"),D(i);if(n.declaration){var s=e.call(r,"declaration");i.push(" ",s),";"!==m(s)&&i.push(";")}return D(i);case"ExportDefaultDeclaration":return D(["export default ",e.call(r,"declaration")]);case"ExportNamedDeclaration":var i=["export "];return n.declaration&&i.push(e.call(r,"declaration")),n.specifiers&&n.specifiers.length>0&&i.push(n.declaration?", {":"{",A(", ").join(e.map(r,"specifiers")),"}"),n.source&&i.push(" from ",e.call(r,"source")),D(i);case"ExportAllDeclaration":var i=["export *"];return n.exported&&i.push(" as ",e.call(r,"exported")),D([" from ",e.call(r,"source")]);case"ExportNamespaceSpecifier":return D(["* as ",e.call(r,"exported")]);case"ExportDefaultSpecifier":return e.call(r,"exported");case"ImportDeclaration":var i=["import "];if(n.importKind&&"value"!==n.importKind&&i.push(n.importKind+" "),n.specifiers&&n.specifiers.length>0){var o=!1;e.each(function(e){var t=e.getName();t>0&&i.push(", ");var n=e.getValue();_.ImportDefaultSpecifier.check(n)||_.ImportNamespaceSpecifier.check(n)?E.strictEqual(o,!1):(_.ImportSpecifier.assert(n),o||(o=!0,i.push("{"))),i.push(r(e))},"specifiers"),o&&i.push("}"),i.push(" from ")}return i.push(e.call(r,"source"),";"),D(i);case"BlockStatement":var l=e.call(function(e){return u(e,t,r)},"body");return l.isEmpty()?A("{}"):D(["{\n",l.indent(t.tabWidth),"\n}"]);case"ReturnStatement":var i=["return"];if(n.argument){var g=e.call(r,"argument");g.length>1&&(_.XJSElement&&_.XJSElement.check(n.argument)||_.JSXElement&&_.JSXElement.check(n.argument))?i.push(" (\n",g.indent(t.tabWidth),"\n)"):i.push(" ",g)}return i.push(";"),D(i);case"CallExpression":return D([e.call(r,"callee"),f(e,t,r)]);case"ObjectExpression":case"ObjectPattern":case"ObjectTypeAnnotation":var b=!1,x="ObjectTypeAnnotation"===n.type,S=x?";":",",C=[];x&&C.push("indexers","callProperties"),C.push("properties");var w=0;C.forEach(function(e){w+=n[e].length});var I=x&&1===w||0===w,i=[I?"{":"{\n"],F=0;return C.forEach(function(n){e.each(function(e){var n=r(e);I||(n=n.indent(t.tabWidth));var a=!x&&n.length>1;a&&b&&i.push("\n"),i.push(n),w-1>F?(i.push(S+(a?"\n\n":"\n")),b=!a):1!==w&&x?i.push(S):t.trailingComma&&i.push(S),F++},n)}),i.push(I?"}":"\n}"),D(i);case"PropertyPattern":return D([e.call(r,"key"),": ",e.call(r,"pattern")]);case"Property":if(n.method||"get"===n.kind||"set"===n.kind)return c(e,t,r);var i=[];n.decorators&&e.each(function(e){i.push(r(e),"\n")},"decorators");var k=e.call(r,"key");return n.computed?i.push("[",k,"]"):i.push(k),n.shorthand||i.push(": ",e.call(r,"value")),D(i);case"Decorator":return D(["@",e.call(r,"expression")]);case"ArrayExpression":case"ArrayPattern":var P=n.elements,w=P.length,B=e.map(r,"elements"),T=A(", ").join(B),I=T.getLineLength(1)<=t.wrapColumn,i=[I?"[":"[\n"];return e.each(function(e){var r=e.getName(),n=e.getValue();if(n){var a=B[r];I?r>0&&i.push(" "):a=a.indent(t.tabWidth),i.push(a),(w-1>r||!I&&t.trailingComma)&&i.push(","),I||i.push("\n")}else i.push(",")},"elements"),i.push("]"),D(i);case"SequenceExpression":return A(", ").join(e.map(r,"expressions"));case"ThisExpression":return A("this");case"Super":return A("super");case"Literal":return"string"!=typeof n.value?A(n.value,t):A(v(n.value,t),t);case"ModuleSpecifier":if(n.local)throw new Error("The ESTree ModuleSpecifier type should be abstract");return A(v(n.value,t),t);case"UnaryExpression":var i=[n.operator];return/[a-z]$/.test(n.operator)&&i.push(" "),i.push(e.call(r,"argument")),D(i);case"UpdateExpression":var i=[e.call(r,"argument"),n.operator];return n.prefix&&i.reverse(),D(i);case"ConditionalExpression":return D(["(",e.call(r,"test")," ? ",e.call(r,"consequent")," : ",e.call(r,"alternate"),")"]);case"NewExpression":var i=["new ",e.call(r,"callee")],M=n.arguments;return M&&i.push(f(e,t,r)),D(i);case"VariableDeclaration":var i=[n.kind," "],O=0,B=e.map(function(e){var t=r(e);return O=Math.max(t.length,O),t},"declarations");1===O?i.push(A(", ").join(B)):B.length>1?i.push(A(",\n").join(B).indentTail(n.kind.length+1)):i.push(B[0]);var j=e.getParentNode();return _.ForStatement.check(j)||_.ForInStatement.check(j)||_.ForOfStatement&&_.ForOfStatement.check(j)||i.push(";"),D(i);case"VariableDeclarator":return n.init?A(" = ").join([e.call(r,"id"),e.call(r,"init")]):e.call(r,"id");case"WithStatement":return D(["with (",e.call(r,"object"),") ",e.call(r,"body")]);case"IfStatement":var L=h(e.call(r,"consequent"),t),i=["if (",e.call(r,"test"),")",L];return n.alternate&&i.push(y(L)?" else":"\nelse",h(e.call(r,"alternate"),t)),D(i);case"ForStatement":var N=e.call(r,"init"),R=N.length>1?";\n":"; ",V="for (",U=A(R).join([N,e.call(r,"test"),e.call(r,"update")]).indentTail(V.length),q=D([V,U,")"]),G=h(e.call(r,"body"),t),i=[q];return q.length>1&&(i.push("\n"),G=G.trimLeft()),i.push(G),D(i);case"WhileStatement":return D(["while (",e.call(r,"test"),")",h(e.call(r,"body"),t)]);case"ForInStatement":return D([n.each?"for each (":"for (",e.call(r,"left")," in ",e.call(r,"right"),")",h(e.call(r,"body"),t)]);case"ForOfStatement":return D(["for (",e.call(r,"left")," of ",e.call(r,"right"),")",h(e.call(r,"body"),t)]);case"DoWhileStatement":var H=D(["do",h(e.call(r,"body"),t)]),i=[H];return y(H)?i.push(" while"):i.push("\nwhile"),i.push(" (",e.call(r,"test"),");"),D(i);case"DoExpression":var W=e.call(function(e){return u(e,t,r)},"body");return D(["do {\n",W.indent(t.tabWidth),"\n}"]);case"BreakStatement":var i=["break"];return n.label&&i.push(" ",e.call(r,"label")),i.push(";"),D(i);case"ContinueStatement":var i=["continue"];return n.label&&i.push(" ",e.call(r,"label")),i.push(";"),D(i);case"LabeledStatement":return D([e.call(r,"label"),":\n",e.call(r,"body")]);case"TryStatement":var i=["try ",e.call(r,"block")];return n.handler?i.push(" ",e.call(r,"handler")):n.handlers&&e.each(function(e){i.push(" ",r(e))},"handlers"),n.finalizer&&i.push(" finally ",e.call(r,"finalizer")),D(i);case"CatchClause":var i=["catch (",e.call(r,"param")];return n.guard&&i.push(" if ",e.call(r,"guard")),i.push(") ",e.call(r,"body")),D(i);case"ThrowStatement":return D(["throw ",e.call(r,"argument"),";"]);case"SwitchStatement":return D(["switch (",e.call(r,"discriminant"),") {\n",A("\n").join(e.map(r,"cases")),"\n}"]);case"SwitchCase":var i=[];return n.test?i.push("case ",e.call(r,"test"),":"):i.push("default:"),n.consequent.length>0&&i.push("\n",e.call(function(e){return u(e,t,r)},"consequent").indent(t.tabWidth)),D(i);case"DebuggerStatement":return A("debugger;");case"XJSAttribute":case"JSXAttribute":var i=[e.call(r,"name")];return n.value&&i.push("=",e.call(r,"value")),D(i);case"XJSIdentifier":case"JSXIdentifier":return A(n.name,t);case"XJSNamespacedName":case"JSXNamespacedName":return A(":").join([e.call(r,"namespace"),e.call(r,"name")]);case"XJSMemberExpression":case"JSXMemberExpression":return A(".").join([e.call(r,"object"),e.call(r,"property")]);case"XJSSpreadAttribute":case"JSXSpreadAttribute":return D(["{...",e.call(r,"argument"),"}"]);case"XJSExpressionContainer":case"JSXExpressionContainer":return D(["{",e.call(r,"expression"),"}"]);case"XJSElement":case"JSXElement":var X=e.call(r,"openingElement");if(n.openingElement.selfClosing)return E.ok(!n.closingElement),X;var Y=D(e.map(function(e){var t=e.getValue();if(_.Literal.check(t)&&"string"==typeof t.value){if(/\S/.test(t.value))return t.value.replace(/^\s+|\s+$/g,"");if(/\n/.test(t.value))return"\n"}return r(e)},"children")).indentTail(t.tabWidth),J=e.call(r,"closingElement");return D([X,Y,J]);case"XJSOpeningElement":case"JSXOpeningElement":var i=["<",e.call(r,"name")],z=[];e.each(function(e){z.push(" ",r(e))},"attributes");var K=D(z),$=K.length>1||K.getLineLength(1)>t.wrapColumn;return $&&(z.forEach(function(e,t){" "===e&&(E.strictEqual(t%2,0),z[t]="\n")}),K=D(z).indentTail(t.tabWidth)),i.push(K,n.selfClosing?" />":">"),D(i);case"XJSClosingElement":case"JSXClosingElement":return D(["</",e.call(r,"name"),">"]);case"XJSText":case"JSXText":return A(n.value,t);case"XJSEmptyExpression":case"JSXEmptyExpression":return A("");case"TypeAnnotatedIdentifier":return D([e.call(r,"annotation")," ",e.call(r,"identifier")]);case"ClassBody":return 0===n.body.length?A("{}"):D(["{\n",e.call(function(e){return u(e,t,r)},"body").indent(t.tabWidth),"\n}"]);case"ClassPropertyDefinition":var i=["static ",e.call(r,"definition")];return _.MethodDefinition.check(n.definition)||i.push(";"),D(i);case"ClassProperty":var i=[];return n["static"]&&i.push("static "),i.push(e.call(r,"key")),n.typeAnnotation&&i.push(e.call(r,"typeAnnotation")),n.value&&i.push(" = ",e.call(r,"value")),i.push(";"),D(i);case"ClassDeclaration":case"ClassExpression":var i=["class"];return n.id&&i.push(" ",e.call(r,"id"),e.call(r,"typeParameters")),n.superClass&&i.push(" extends ",e.call(r,"superClass"),e.call(r,"superTypeParameters")),n["implements"]&&i.push(" implements ",A(", ").join(e.map(r,"implements"))),i.push(" ",e.call(r,"body")),D(i);case"TemplateElement":return A(n.value.raw,t);case"TemplateLiteral":var Q=e.map(r,"expressions"),i=["`"];return e.each(function(e){var t=e.getName();i.push(r(e)),t<Q.length&&i.push("${",Q[t],"}")},"quasis"),i.push("`"),D(i);case"TaggedTemplateExpression":return D([e.call(r,"tag"),e.call(r,"quasi")]);case"Node":case"Printable":case"SourceLocation":case"Position":case"Statement":case"Function":case"Pattern":case"Expression":case"Declaration":case"Specifier":case"NamedSpecifier":case"Comment":case"MemberTypeAnnotation":case"TupleTypeAnnotation":case"Type":throw new Error("unprintable type: "+JSON.stringify(n.type));case"CommentBlock":case"Block":return D(["/*",A(n.value,t),"*/"]);case"CommentLine":case"Line":return D(["//",A(n.value,t)]);case"TypeAnnotation":var i=[];return n.typeAnnotation?("FunctionTypeAnnotation"!==n.typeAnnotation.type&&i.push(": "),i.push(e.call(r,"typeAnnotation")),D(i)):A("");case"AnyTypeAnnotation":return A("any",t);case"MixedTypeAnnotation":return A("mixed",t);case"ArrayTypeAnnotation":return D([e.call(r,"elementType"),"[]"]);case"BooleanTypeAnnotation":return A("boolean",t);case"BooleanLiteralTypeAnnotation":return E.strictEqual(typeof n.value,"boolean"),A(""+n.value,t);case"DeclareClass":return D([A("declare class ",t),e.call(r,"id")," ",e.call(r,"body")]);case"DeclareFunction":return D([A("declare function ",t),e.call(r,"id"),";"]);case"DeclareModule":return D([A("declare module ",t),e.call(r,"id")," ",e.call(r,"body")]);case"DeclareVariable":return D([A("declare var ",t),e.call(r,"id"),";"]);case"FunctionTypeAnnotation":var i=[],Z=e.getParentNode(0),ee=!(_.ObjectTypeCallProperty.check(Z)||_.DeclareFunction.check(e.getParentNode(2))),te=ee&&!_.FunctionTypeParam.check(Z);return te&&i.push(": "),i.push("(",A(", ").join(e.map(r,"params")),")"),n.returnType&&i.push(ee?" => ":": ",e.call(r,"returnType")),D(i);case"FunctionTypeParam":return D([e.call(r,"name"),": ",e.call(r,"typeAnnotation")]);case"GenericTypeAnnotation":return D([e.call(r,"id"),e.call(r,"typeParameters")]);case"InterfaceDeclaration":var i=[A("interface ",t),e.call(r,"id"),e.call(r,"typeParameters")," "];return n["extends"]&&i.push("extends ",A(", ").join(e.map(r,"extends"))),i.push(" ",e.call(r,"body")),D(i);case"ClassImplements":case"InterfaceExtends":return D([e.call(r,"id"),e.call(r,"typeParameters")]);case"IntersectionTypeAnnotation":return A(" & ").join(e.map(r,"types"));case"NullableTypeAnnotation":return D(["?",e.call(r,"typeAnnotation")]);case"NumberTypeAnnotation":return A("number",t);case"ObjectTypeCallProperty":return e.call(r,"value");case"ObjectTypeIndexer":return D(["[",e.call(r,"id"),": ",e.call(r,"key"),"]: ",e.call(r,"value")]);case"ObjectTypeProperty":return D([e.call(r,"key"),": ",e.call(r,"value")]);case"QualifiedTypeIdentifier":return D([e.call(r,"qualification"),".",e.call(r,"id")]);case"StringLiteralTypeAnnotation":return A(v(n.value,t),t);case"NumberLiteralTypeAnnotation":return E.strictEqual(typeof n.value,"number"),A(""+n.value,t);case"StringTypeAnnotation":return A("string",t);case"TypeAlias":return D(["type ",e.call(r,"id")," = ",e.call(r,"right"),";"]);case"TypeCastExpression":return D(["(",e.call(r,"expression"),e.call(r,"typeAnnotation"),")"]);case"TypeParameterDeclaration":case"TypeParameterInstantiation":return D(["<",A(", ").join(e.map(r,"params")),">"]);case"TypeofTypeAnnotation":return D([A("typeof ",t),e.call(r,"argument")]);case"UnionTypeAnnotation":return A(" | ").join(e.map(r,"types"));case"VoidTypeAnnotation":return A("void",t);case"ClassHeritage":case"ComprehensionBlock":case"ComprehensionExpression":case"Glob":case"GeneratorExpression":case"LetStatement":case"LetExpression":case"GraphExpression":case"GraphIndexExpression":case"XMLDefaultDeclaration":case"XMLAnyName":case"XMLQualifiedIdentifier":case"XMLFunctionQualifiedIdentifier":case"XMLAttributeSelector":case"XMLFilterExpression":case"XML":case"XMLElement":case"XMLList":case"XMLEscape":case"XMLText":case"XMLStartTag":case"XMLEndTag":case"XMLPointTag":case"XMLName":case"XMLAttribute":case"XMLCdata":case"XMLComment":case"XMLProcessingInstruction":default:throw new Error("unknown type: "+JSON.stringify(n.type))}return p}function u(e,t,r){var n=_.ClassBody&&_.ClassBody.check(e.getParentNode()),i=[],a=!1,s=!1;e.each(function(e){var t=(e.getName(),e.getValue());t&&"EmptyStatement"!==t.type&&(_.Comment.check(t)?a=!0:n||(_.Statement.assert(t),s=!0),i.push({node:t,printed:r(e)}))}),a&&E.strictEqual(s,!1,"Comments may appear as statements in otherwise empty statement lists, but may not coexist with non-Comment nodes.");var o=null,u=i.length,p=[];return i.forEach(function(e,r){var n,i,a=e.printed,s=e.node,c=a.length>1,f=r>0,d=u-1>r,h=s&&s.loc&&s.loc.lines,m=h&&t.reuseWhitespace&&B.getTrueLoc(s,h);if(f)if(m){var y=h.skipSpaces(m.start,!0),g=y?y.line:1,v=m.start.line-g;n=Array(v+1).join("\n")}else n=c?"\n\n":"\n";else n="";if(d)if(m){var b=h.skipSpaces(m.end),E=b?b.line:h.length,x=E-m.end.line;i=Array(x+1).join("\n")}else i=c?"\n\n":"\n";else i="";p.push(l(o,n),a),d?o=i:i&&p.push(i)}),D(p)}function l(e,t){if(!e&&!t)return A("");if(!e)return A(t);if(!t)return A(e);var r=A(e),n=A(t);return n.length>r.length?n:r}function c(e,t,r){var n=e.getNode(),i=n.kind,a=[];_.FunctionExpression.assert(n.value),n.decorators&&e.each(function(e){a.push(r(e),"\n")},"decorators"),n.value.async&&a.push("async "),i&&"init"!==i&&"method"!==i&&"constructor"!==i?(E.ok("get"===i||"set"===i),a.push(i," ")):n.value.generator&&a.push("*");var s=e.call(r,"key");return n.computed&&(s=D(["[",s,"]"])),a.push(s,e.call(r,"value","typeParameters"),"(",e.call(function(e){return d(e,t,r)},"value"),")",e.call(r,"value","returnType")," ",e.call(r,"value","body")),D(a)}function f(e,t,r){var n=e.map(r,"arguments"),i=A(", ").join(n);return i.getLineLength(1)>t.wrapColumn?(i=A(",\n").join(n),D(["(\n",i.indent(t.tabWidth),t.trailingComma?",\n)":"\n)"])):D(["(",i,")"])}function d(e,t,r){var n=e.getValue();_.Function.assert(n);var i=e.map(r,"params");n.defaults&&e.each(function(e){var t=e.getName(),n=i[t];n&&e.getValue()&&(i[t]=D([n,"=",r(e)]))},"defaults"),n.rest&&i.push(D(["...",e.call(r,"rest")]));var a=A(", ").join(i);return a.length>1||a.getLineLength(1)>t.wrapColumn?(a=A(",\n").join(i),t.trailingComma&&!n.rest&&(a=D([a,",\n"])),D(["\n",a.indent(t.tabWidth)])):a}function h(e,t){return D(e.length>1?[" ",e]:["\n",b(e).indent(t.tabWidth)])}function m(e){var t=e.lastPos();do{var r=e.charAt(t);if(/\S/.test(r))return r}while(e.prevPos(t))}function y(e){return"}"===m(e)}function g(e){return e.replace(/['"]/g,function(e){return'"'===e?"'":'"'})}function v(e,t){switch(F.assert(e),t.quote){case"auto":var r=JSON.stringify(e),n=g(JSON.stringify(g(e)));return r.length>n.length?n:r;case"single":return g(JSON.stringify(g(e)));case"double":default:return JSON.stringify(e)}}function b(e){var t=m(e);return!t||"\n};".indexOf(t)<0?D([e,";"]):e}var E=e(2),x=(e(599),e(550).printComments),S=e(552),A=S.fromString,D=S.concat,C=e(554).normalize,w=e(556).getReprinter,I=e(558),_=I.namedTypes,F=I.builtInTypes.string,k=I.builtInTypes.object,P=e(551),B=e(559),T=n.prototype,M=!1;T.toString=function(){return M||(console.warn("Deprecation warning: recast.print now returns an object with a .code property. You appear to be treating the object as a string, which might still work but is strongly discouraged."),M=!0),this.code};var O=new n("");r.Printer=i},{2:2,550:550,551:551,552:552,554:554,556:556,558:558,559:559,599:599}],558:[function(e,t,r){t.exports=e(576)},{576:576}],559:[function(e,t,r){function n(){
for(var e={},t=arguments.length,r=0;t>r;++r)for(var n=Object.keys(arguments[r]),i=n.length,a=0;i>a;++a)e[n[a]]=!0;return e}function i(e,t){return e.line-t.line||e.column-t.column}function a(e){return{line:e.line,column:e.column}}var s=(e(2),e(558)),o=(s.getFieldValue,s.namedTypes),u=e(599),p=u.SourceMapConsumer,l=u.SourceMapGenerator,c=Object.prototype.hasOwnProperty;r.getUnionOfKeys=n,r.comparePos=i,r.copyPos=a,r.composeSourceMaps=function(e,t){if(!e)return t||null;if(!t)return e;var r=new p(e),n=new p(t),i=new l({file:t.file,sourceRoot:t.sourceRoot}),s={};return n.eachMapping(function(e){var t=r.originalPositionFor({line:e.originalLine,column:e.originalColumn}),n=t.source;if(null!==n){i.addMapping({source:n,original:a(t),generated:{line:e.generatedLine,column:e.generatedColumn},name:e.name});var o=r.sourceContentFor(n);o&&!c.call(s,n)&&(s[n]=o,i.setSourceContent(n,o))}}),i.toJSON()},r.getTrueLoc=function(e,t){if(!e.loc)return null;var r=e.loc.start,n=e.loc.end;return e.comments&&e.comments.forEach(function(e){e.loc&&(i(e.loc.start,r)<0&&(r=e.loc.start),i(n,e.loc.end)<0&&(n=e.loc.end))}),{start:t.skipSpaces(r,!1,!1),end:t.skipSpaces(n,!0,!1)}},r.fixFaultyLocations=function(e){(o.MethodDefinition&&o.MethodDefinition.check(e)||o.Property.check(e)&&(e.method||e.shorthand))&&(e.value.loc=null,o.FunctionExpression.check(e.value)&&(e.value.id=null));var t=e.loc;t&&(t.start.line<1&&(t.start.line=1),t.end.line<1&&(t.end.line=1))}},{2:2,558:558,599:599}],560:[function(e,t,r){(function(t){function n(e,t){return new c(t).print(e)}function i(e,t){return new c(t).printGenerically(e)}function a(e,r){return s(t.argv[2],e,r)}function s(t,r,n){e(1).readFile(t,"utf-8",function(e,t){return e?void console.error(e):void u(t,r,n)})}function o(e){t.stdout.write(e)}function u(e,t,r){var i=r&&r.writeback||o;t(l(e,r),function(e){i(n(e,r).code)})}var p=e(558),l=e(555).parse,c=e(557).Printer;Object.defineProperties(r,{parse:{enumerable:!0,value:l},visit:{enumerable:!0,value:p.visit},print:{enumerable:!0,value:n},prettyPrint:{enumerable:!1,value:i},types:{enumerable:!1,value:p},run:{enumerable:!1,value:a}})}).call(this,e(10))},{1:1,10:10,555:555,557:557,558:558}],561:[function(e,t,r){e(565);var n=e(575),i=e(574).defaults,a=n.Type.def,s=n.Type.or;a("Noop").bases("Node").build(),a("DoExpression").bases("Expression").build("body").field("body",[a("Statement")]),a("Super").bases("Expression").build(),a("BindExpression").bases("Expression").build("object","callee").field("object",s(a("Expression"),null)).field("callee",a("Expression")),a("Decorator").bases("Node").build("expression").field("expression",a("Expression")),a("Property").field("decorators",s([a("Decorator")],null),i["null"]),a("MethodDefinition").field("decorators",s([a("Decorator")],null),i["null"]),a("MetaProperty").bases("Expression").build("meta","property").field("meta",a("Identifier")).field("property",a("Identifier")),a("ParenthesizedExpression").bases("Expression").build("expression").field("expression",a("Expression")),a("ImportSpecifier").bases("ModuleSpecifier").build("imported","local").field("imported",a("Identifier")),a("ImportDefaultSpecifier").bases("ModuleSpecifier").build("local"),a("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("local"),a("ExportDefaultDeclaration").bases("Declaration").build("declaration").field("declaration",s(a("Declaration"),a("Expression"))),a("ExportNamedDeclaration").bases("Declaration").build("declaration","specifiers","source").field("declaration",s(a("Declaration"),null)).field("specifiers",[a("ExportSpecifier")],i.emptyArray).field("source",s(a("Literal"),null),i["null"]),a("ExportSpecifier").bases("ModuleSpecifier").build("local","exported").field("exported",a("Identifier")),a("ExportNamespaceSpecifier").bases("Specifier").build("exported").field("exported",a("Identifier")),a("ExportDefaultSpecifier").bases("Specifier").build("exported").field("exported",a("Identifier")),a("ExportAllDeclaration").bases("Declaration").build("exported","source").field("exported",s(a("Identifier"),null)).field("source",a("Literal")),a("CommentBlock").bases("Comment").build("value","leading","trailing"),a("CommentLine").bases("Comment").build("value","leading","trailing")},{565:565,574:574,575:575}],562:[function(e,t,r){var n=e(575),i=n.Type,a=i.def,s=i.or,o=e(574),u=o.defaults,p=o.geq;a("Printable").field("loc",s(a("SourceLocation"),null),u["null"],!0),a("Node").bases("Printable").field("type",String).field("comments",s([a("Comment")],null),u["null"],!0),a("SourceLocation").build("start","end","source").field("start",a("Position")).field("end",a("Position")).field("source",s(String,null),u["null"]),a("Position").build("line","column").field("line",p(1)).field("column",p(0)),a("File").bases("Node").build("program").field("program",a("Program")),a("Program").bases("Node").build("body").field("body",[a("Statement")]),a("Function").bases("Node").field("id",s(a("Identifier"),null),u["null"]).field("params",[a("Pattern")]).field("body",a("BlockStatement")),a("Statement").bases("Node"),a("EmptyStatement").bases("Statement").build(),a("BlockStatement").bases("Statement").build("body").field("body",[a("Statement")]),a("ExpressionStatement").bases("Statement").build("expression").field("expression",a("Expression")),a("IfStatement").bases("Statement").build("test","consequent","alternate").field("test",a("Expression")).field("consequent",a("Statement")).field("alternate",s(a("Statement"),null),u["null"]),a("LabeledStatement").bases("Statement").build("label","body").field("label",a("Identifier")).field("body",a("Statement")),a("BreakStatement").bases("Statement").build("label").field("label",s(a("Identifier"),null),u["null"]),a("ContinueStatement").bases("Statement").build("label").field("label",s(a("Identifier"),null),u["null"]),a("WithStatement").bases("Statement").build("object","body").field("object",a("Expression")).field("body",a("Statement")),a("SwitchStatement").bases("Statement").build("discriminant","cases","lexical").field("discriminant",a("Expression")).field("cases",[a("SwitchCase")]).field("lexical",Boolean,u["false"]),a("ReturnStatement").bases("Statement").build("argument").field("argument",s(a("Expression"),null)),a("ThrowStatement").bases("Statement").build("argument").field("argument",a("Expression")),a("TryStatement").bases("Statement").build("block","handler","finalizer").field("block",a("BlockStatement")).field("handler",s(a("CatchClause"),null),function(){return this.handlers&&this.handlers[0]||null}).field("handlers",[a("CatchClause")],function(){return this.handler?[this.handler]:[]},!0).field("guardedHandlers",[a("CatchClause")],u.emptyArray).field("finalizer",s(a("BlockStatement"),null),u["null"]),a("CatchClause").bases("Node").build("param","guard","body").field("param",a("Pattern")).field("guard",s(a("Expression"),null),u["null"]).field("body",a("BlockStatement")),a("WhileStatement").bases("Statement").build("test","body").field("test",a("Expression")).field("body",a("Statement")),a("DoWhileStatement").bases("Statement").build("body","test").field("body",a("Statement")).field("test",a("Expression")),a("ForStatement").bases("Statement").build("init","test","update","body").field("init",s(a("VariableDeclaration"),a("Expression"),null)).field("test",s(a("Expression"),null)).field("update",s(a("Expression"),null)).field("body",a("Statement")),a("ForInStatement").bases("Statement").build("left","right","body").field("left",s(a("VariableDeclaration"),a("Expression"))).field("right",a("Expression")).field("body",a("Statement")),a("DebuggerStatement").bases("Statement").build(),a("Declaration").bases("Statement"),a("FunctionDeclaration").bases("Function","Declaration").build("id","params","body").field("id",a("Identifier")),a("FunctionExpression").bases("Function","Expression").build("id","params","body"),a("VariableDeclaration").bases("Declaration").build("kind","declarations").field("kind",s("var","let","const")).field("declarations",[a("VariableDeclarator")]),a("VariableDeclarator").bases("Node").build("id","init").field("id",a("Pattern")).field("init",s(a("Expression"),null)),a("Expression").bases("Node","Pattern"),a("ThisExpression").bases("Expression").build(),a("ArrayExpression").bases("Expression").build("elements").field("elements",[s(a("Expression"),null)]),a("ObjectExpression").bases("Expression").build("properties").field("properties",[a("Property")]),a("Property").bases("Node").build("kind","key","value").field("kind",s("init","get","set")).field("key",s(a("Literal"),a("Identifier"))).field("value",a("Expression")),a("SequenceExpression").bases("Expression").build("expressions").field("expressions",[a("Expression")]);var l=s("-","+","!","~","typeof","void","delete");a("UnaryExpression").bases("Expression").build("operator","argument","prefix").field("operator",l).field("argument",a("Expression")).field("prefix",Boolean,u["true"]);var c=s("==","!=","===","!==","<","<=",">",">=","<<",">>",">>>","+","-","*","/","%","&","|","^","in","instanceof","..");a("BinaryExpression").bases("Expression").build("operator","left","right").field("operator",c).field("left",a("Expression")).field("right",a("Expression"));var f=s("=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","|=","^=","&=");a("AssignmentExpression").bases("Expression").build("operator","left","right").field("operator",f).field("left",a("Pattern")).field("right",a("Expression"));var d=s("++","--");a("UpdateExpression").bases("Expression").build("operator","argument","prefix").field("operator",d).field("argument",a("Expression")).field("prefix",Boolean);var h=s("||","&&");a("LogicalExpression").bases("Expression").build("operator","left","right").field("operator",h).field("left",a("Expression")).field("right",a("Expression")),a("ConditionalExpression").bases("Expression").build("test","consequent","alternate").field("test",a("Expression")).field("consequent",a("Expression")).field("alternate",a("Expression")),a("NewExpression").bases("Expression").build("callee","arguments").field("callee",a("Expression")).field("arguments",[a("Expression")]),a("CallExpression").bases("Expression").build("callee","arguments").field("callee",a("Expression")).field("arguments",[a("Expression")]),a("MemberExpression").bases("Expression").build("object","property","computed").field("object",a("Expression")).field("property",s(a("Identifier"),a("Expression"))).field("computed",Boolean,u["false"]),a("Pattern").bases("Node"),a("SwitchCase").bases("Node").build("test","consequent").field("test",s(a("Expression"),null)).field("consequent",[a("Statement")]),a("Identifier").bases("Node","Expression","Pattern").build("name").field("name",String),a("Literal").bases("Node","Expression").build("value").field("value",s(String,Boolean,null,Number,RegExp)).field("regex",s({pattern:String,flags:String},null),function(){if(this.value instanceof RegExp){var e="";return this.value.ignoreCase&&(e+="i"),this.value.multiline&&(e+="m"),this.value.global&&(e+="g"),{pattern:this.value.source,flags:e}}return null}),a("Comment").bases("Printable").field("value",String).field("leading",Boolean,u["true"]).field("trailing",Boolean,u["false"])},{574:574,575:575}],563:[function(e,t,r){e(562);var n=e(575),i=n.Type.def,a=n.Type.or;i("XMLDefaultDeclaration").bases("Declaration").field("namespace",i("Expression")),i("XMLAnyName").bases("Expression"),i("XMLQualifiedIdentifier").bases("Expression").field("left",a(i("Identifier"),i("XMLAnyName"))).field("right",a(i("Identifier"),i("Expression"))).field("computed",Boolean),i("XMLFunctionQualifiedIdentifier").bases("Expression").field("right",a(i("Identifier"),i("Expression"))).field("computed",Boolean),i("XMLAttributeSelector").bases("Expression").field("attribute",i("Expression")),i("XMLFilterExpression").bases("Expression").field("left",i("Expression")).field("right",i("Expression")),i("XMLElement").bases("XML","Expression").field("contents",[i("XML")]),i("XMLList").bases("XML","Expression").field("contents",[i("XML")]),i("XML").bases("Node"),i("XMLEscape").bases("XML").field("expression",i("Expression")),i("XMLText").bases("XML").field("text",String),i("XMLStartTag").bases("XML").field("contents",[i("XML")]),i("XMLEndTag").bases("XML").field("contents",[i("XML")]),i("XMLPointTag").bases("XML").field("contents",[i("XML")]),i("XMLName").bases("XML").field("contents",a(String,[i("XML")])),i("XMLAttribute").bases("XML").field("value",String),i("XMLCdata").bases("XML").field("contents",String),i("XMLComment").bases("XML").field("contents",String),i("XMLProcessingInstruction").bases("XML").field("target",String).field("contents",a(String,null))},{562:562,575:575}],564:[function(e,t,r){e(562);var n=e(575),i=n.Type.def,a=n.Type.or,s=e(574).defaults;i("Function").field("generator",Boolean,s["false"]).field("expression",Boolean,s["false"]).field("defaults",[a(i("Expression"),null)],s.emptyArray).field("rest",a(i("Identifier"),null),s["null"]),i("RestElement").bases("Pattern").build("argument").field("argument",i("Pattern")),i("SpreadElementPattern").bases("Pattern").build("argument").field("argument",i("Pattern")),i("FunctionDeclaration").build("id","params","body","generator","expression"),i("FunctionExpression").build("id","params","body","generator","expression"),i("ArrowFunctionExpression").bases("Function","Expression").build("params","body","expression").field("id",null,s["null"]).field("body",a(i("BlockStatement"),i("Expression"))).field("generator",!1,s["false"]),i("YieldExpression").bases("Expression").build("argument","delegate").field("argument",a(i("Expression"),null)).field("delegate",Boolean,s["false"]),i("GeneratorExpression").bases("Expression").build("body","blocks","filter").field("body",i("Expression")).field("blocks",[i("ComprehensionBlock")]).field("filter",a(i("Expression"),null)),i("ComprehensionExpression").bases("Expression").build("body","blocks","filter").field("body",i("Expression")).field("blocks",[i("ComprehensionBlock")]).field("filter",a(i("Expression"),null)),i("ComprehensionBlock").bases("Node").build("left","right","each").field("left",i("Pattern")).field("right",i("Expression")).field("each",Boolean),i("Property").field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("value",a(i("Expression"),i("Pattern"))).field("method",Boolean,s["false"]).field("shorthand",Boolean,s["false"]).field("computed",Boolean,s["false"]),i("PropertyPattern").bases("Pattern").build("key","pattern").field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("pattern",i("Pattern")).field("computed",Boolean,s["false"]),i("ObjectPattern").bases("Pattern").build("properties").field("properties",[a(i("PropertyPattern"),i("Property"))]),i("ArrayPattern").bases("Pattern").build("elements").field("elements",[a(i("Pattern"),null)]),i("MethodDefinition").bases("Declaration").build("kind","key","value","static").field("kind",a("constructor","method","get","set")).field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("value",i("Function")).field("computed",Boolean,s["false"]).field("static",Boolean,s["false"]),i("SpreadElement").bases("Node").build("argument").field("argument",i("Expression")),i("ArrayExpression").field("elements",[a(i("Expression"),i("SpreadElement"),i("RestElement"),null)]),i("NewExpression").field("arguments",[a(i("Expression"),i("SpreadElement"))]),i("CallExpression").field("arguments",[a(i("Expression"),i("SpreadElement"))]),i("AssignmentPattern").bases("Pattern").build("left","right").field("left",i("Pattern")).field("right",i("Expression"));var o=a(i("MethodDefinition"),i("VariableDeclarator"),i("ClassPropertyDefinition"),i("ClassProperty"));i("ClassProperty").bases("Declaration").build("key").field("key",a(i("Literal"),i("Identifier"),i("Expression"))).field("computed",Boolean,s["false"]),i("ClassPropertyDefinition").bases("Declaration").build("definition").field("definition",o),i("ClassBody").bases("Declaration").build("body").field("body",[o]),i("ClassDeclaration").bases("Declaration").build("id","body","superClass").field("id",a(i("Identifier"),null)).field("body",i("ClassBody")).field("superClass",a(i("Expression"),null),s["null"]),i("ClassExpression").bases("Expression").build("id","body","superClass").field("id",a(i("Identifier"),null),s["null"]).field("body",i("ClassBody")).field("superClass",a(i("Expression"),null),s["null"]).field("implements",[i("ClassImplements")],s.emptyArray),i("ClassImplements").bases("Node").build("id").field("id",i("Identifier")).field("superClass",a(i("Expression"),null),s["null"]),i("Specifier").bases("Node"),i("ModuleSpecifier").bases("Specifier").field("local",a(i("Identifier"),null),s["null"]).field("id",a(i("Identifier"),null),s["null"]).field("name",a(i("Identifier"),null),s["null"]),i("TaggedTemplateExpression").bases("Expression").build("tag","quasi").field("tag",i("Expression")).field("quasi",i("TemplateLiteral")),i("TemplateLiteral").bases("Expression").build("quasis","expressions").field("quasis",[i("TemplateElement")]).field("expressions",[i("Expression")]),i("TemplateElement").bases("Node").build("value","tail").field("value",{cooked:String,raw:String}).field("tail",Boolean)},{562:562,574:574,575:575}],565:[function(e,t,r){e(564);var n=e(575),i=n.Type.def,a=n.Type.or,s=(n.builtInTypes,e(574).defaults);i("Function").field("async",Boolean,s["false"]),i("SpreadProperty").bases("Node").build("argument").field("argument",i("Expression")),i("ObjectExpression").field("properties",[a(i("Property"),i("SpreadProperty"))]),i("SpreadPropertyPattern").bases("Pattern").build("argument").field("argument",i("Pattern")),i("ObjectPattern").field("properties",[a(i("Property"),i("PropertyPattern"),i("SpreadPropertyPattern"))]),i("AwaitExpression").bases("Expression").build("argument","all").field("argument",a(i("Expression"),null)).field("all",Boolean,s["false"])},{564:564,574:574,575:575}],566:[function(e,t,r){e(565);var n=e(575),i=e(574).defaults,a=n.Type.def,s=n.Type.or;a("VariableDeclaration").field("declarations",[s(a("VariableDeclarator"),a("Identifier"))]),a("Property").field("value",s(a("Expression"),a("Pattern"))),a("ArrayPattern").field("elements",[s(a("Pattern"),a("SpreadElement"),null)]),a("ObjectPattern").field("properties",[s(a("Property"),a("PropertyPattern"),a("SpreadPropertyPattern"),a("SpreadProperty"))]),a("ExportSpecifier").bases("ModuleSpecifier").build("id","name"),a("ExportBatchSpecifier").bases("Specifier").build(),a("ImportSpecifier").bases("ModuleSpecifier").build("id","name"),a("ImportNamespaceSpecifier").bases("ModuleSpecifier").build("id"),a("ImportDefaultSpecifier").bases("ModuleSpecifier").build("id"),a("ExportDeclaration").bases("Declaration").build("default","declaration","specifiers","source").field("default",Boolean).field("declaration",s(a("Declaration"),a("Expression"),null)).field("specifiers",[s(a("ExportSpecifier"),a("ExportBatchSpecifier"))],i.emptyArray).field("source",s(a("Literal"),null),i["null"]),a("ImportDeclaration").bases("Declaration").build("specifiers","source").field("specifiers",[s(a("ImportSpecifier"),a("ImportNamespaceSpecifier"),a("ImportDefaultSpecifier"))],i.emptyArray).field("source",a("Literal")),a("Block").bases("Comment").build("value","leading","trailing"),a("Line").bases("Comment").build("value","leading","trailing")},{565:565,574:574,575:575}],567:[function(e,t,r){e(565);var n=e(575),i=n.Type.def,a=n.Type.or,s=e(574).defaults;i("JSXAttribute").bases("Node").build("name","value").field("name",a(i("JSXIdentifier"),i("JSXNamespacedName"))).field("value",a(i("Literal"),i("JSXExpressionContainer"),null),s["null"]),i("JSXIdentifier").bases("Identifier").build("name").field("name",String),i("JSXNamespacedName").bases("Node").build("namespace","name").field("namespace",i("JSXIdentifier")).field("name",i("JSXIdentifier")),i("JSXMemberExpression").bases("MemberExpression").build("object","property").field("object",a(i("JSXIdentifier"),i("JSXMemberExpression"))).field("property",i("JSXIdentifier")).field("computed",Boolean,s["false"]);var o=a(i("JSXIdentifier"),i("JSXNamespacedName"),i("JSXMemberExpression"));i("JSXSpreadAttribute").bases("Node").build("argument").field("argument",i("Expression"));var u=[a(i("JSXAttribute"),i("JSXSpreadAttribute"))];i("JSXExpressionContainer").bases("Expression").build("expression").field("expression",i("Expression")),i("JSXElement").bases("Expression").build("openingElement","closingElement","children").field("openingElement",i("JSXOpeningElement")).field("closingElement",a(i("JSXClosingElement"),null),s["null"]).field("children",[a(i("JSXElement"),i("JSXExpressionContainer"),i("JSXText"),i("Literal"))],s.emptyArray).field("name",o,function(){return this.openingElement.name},!0).field("selfClosing",Boolean,function(){return this.openingElement.selfClosing},!0).field("attributes",u,function(){return this.openingElement.attributes},!0),i("JSXOpeningElement").bases("Node").build("name","attributes","selfClosing").field("name",o).field("attributes",u,s.emptyArray).field("selfClosing",Boolean,s["false"]),i("JSXClosingElement").bases("Node").build("name").field("name",o),i("JSXText").bases("Literal").build("value").field("value",String),i("JSXEmptyExpression").bases("Expression").build(),i("Type").bases("Node"),i("AnyTypeAnnotation").bases("Type").build(),i("MixedTypeAnnotation").bases("Type").build(),i("VoidTypeAnnotation").bases("Type").build(),i("NumberTypeAnnotation").bases("Type").build(),i("NumberLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Number).field("raw",String),i("StringTypeAnnotation").bases("Type").build(),i("StringLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",String).field("raw",String),i("BooleanTypeAnnotation").bases("Type").build(),i("BooleanLiteralTypeAnnotation").bases("Type").build("value","raw").field("value",Boolean).field("raw",String),i("TypeAnnotation").bases("Node").build("typeAnnotation").field("typeAnnotation",i("Type")),i("NullableTypeAnnotation").bases("Type").build("typeAnnotation").field("typeAnnotation",i("Type")),i("FunctionTypeAnnotation").bases("Type").build("params","returnType","rest","typeParameters").field("params",[i("FunctionTypeParam")]).field("returnType",i("Type")).field("rest",a(i("FunctionTypeParam"),null)).field("typeParameters",a(i("TypeParameterDeclaration"),null)),i("FunctionTypeParam").bases("Node").build("name","typeAnnotation","optional").field("name",i("Identifier")).field("typeAnnotation",i("Type")).field("optional",Boolean),i("ArrayTypeAnnotation").bases("Type").build("elementType").field("elementType",i("Type")),i("ObjectTypeAnnotation").bases("Type").build("properties").field("properties",[i("ObjectTypeProperty")]).field("indexers",[i("ObjectTypeIndexer")],s.emptyArray).field("callProperties",[i("ObjectTypeCallProperty")],s.emptyArray),i("ObjectTypeProperty").bases("Node").build("key","value","optional").field("key",a(i("Literal"),i("Identifier"))).field("value",i("Type")).field("optional",Boolean),i("ObjectTypeIndexer").bases("Node").build("id","key","value").field("id",i("Identifier")).field("key",i("Type")).field("value",i("Type")),i("ObjectTypeCallProperty").bases("Node").build("value").field("value",i("FunctionTypeAnnotation")).field("static",Boolean,!1),i("QualifiedTypeIdentifier").bases("Node").build("qualification","id").field("qualification",a(i("Identifier"),i("QualifiedTypeIdentifier"))).field("id",i("Identifier")),i("GenericTypeAnnotation").bases("Type").build("id","typeParameters").field("id",a(i("Identifier"),i("QualifiedTypeIdentifier"))).field("typeParameters",a(i("TypeParameterInstantiation"),null)),i("MemberTypeAnnotation").bases("Type").build("object","property").field("object",i("Identifier")).field("property",a(i("MemberTypeAnnotation"),i("GenericTypeAnnotation"))),i("UnionTypeAnnotation").bases("Type").build("types").field("types",[i("Type")]),i("IntersectionTypeAnnotation").bases("Type").build("types").field("types",[i("Type")]),i("TypeofTypeAnnotation").bases("Type").build("argument").field("argument",i("Type")),i("Identifier").field("typeAnnotation",a(i("TypeAnnotation"),null),s["null"]),i("TypeParameterDeclaration").bases("Node").build("params").field("params",[i("Identifier")]),i("TypeParameterInstantiation").bases("Node").build("params").field("params",[i("Type")]),i("Function").field("returnType",a(i("TypeAnnotation"),null),s["null"]).field("typeParameters",a(i("TypeParameterDeclaration"),null),s["null"]),i("ClassProperty").build("key","value","typeAnnotation","static").field("value",a(i("Expression"),null)).field("typeAnnotation",a(i("TypeAnnotation"),null)).field("static",Boolean,s["false"]),i("ClassImplements").field("typeParameters",a(i("TypeParameterInstantiation"),null),s["null"]),i("InterfaceDeclaration").bases("Statement").build("id","body","extends").field("id",i("Identifier")).field("typeParameters",a(i("TypeParameterDeclaration"),null),s["null"]).field("body",i("ObjectTypeAnnotation")).field("extends",[i("InterfaceExtends")]),i("InterfaceExtends").bases("Node").build("id").field("id",i("Identifier")).field("typeParameters",a(i("TypeParameterInstantiation"),null)),i("TypeAlias").bases("Statement").build("id","typeParameters","right").field("id",i("Identifier")).field("typeParameters",a(i("TypeParameterDeclaration"),null)).field("right",i("Type")),i("TypeCastExpression").bases("Expression").build("expression","typeAnnotation").field("expression",i("Expression")).field("typeAnnotation",i("TypeAnnotation")),i("TupleTypeAnnotation").bases("Type").build("types").field("types",[i("Type")]),i("DeclareVariable").bases("Statement").build("id").field("id",i("Identifier")),i("DeclareFunction").bases("Statement").build("id").field("id",i("Identifier")),i("DeclareClass").bases("InterfaceDeclaration").build("id"),i("DeclareModule").bases("Statement").build("id","body").field("id",a(i("Identifier"),i("Literal"))).field("body",i("BlockStatement"))},{565:565,574:574,575:575}],568:[function(e,t,r){e(562);var n=e(575),i=n.Type.def,a=n.Type.or,s=e(574),o=s.geq,u=s.defaults;i("Function").field("body",a(i("BlockStatement"),i("Expression"))),i("ForInStatement").build("left","right","body","each").field("each",Boolean,u["false"]),i("ForOfStatement").bases("Statement").build("left","right","body").field("left",a(i("VariableDeclaration"),i("Expression"))).field("right",i("Expression")).field("body",i("Statement")),i("LetStatement").bases("Statement").build("head","body").field("head",[i("VariableDeclarator")]).field("body",i("Statement")),i("LetExpression").bases("Expression").build("head","body").field("head",[i("VariableDeclarator")]).field("body",i("Expression")),i("GraphExpression").bases("Expression").build("index","expression").field("index",o(0)).field("expression",i("Literal")),i("GraphIndexExpression").bases("Expression").build("index").field("index",o(0))},{562:562,574:574,575:575}],569:[function(e,t,r){function n(e,t,r){return c.check(r)?r.length=0:r=null,a(e,t,r)}function i(e){return/[_$a-z][_$a-z0-9]*/i.test(e)?"."+e:"["+JSON.stringify(e)+"]"}function a(e,t,r){return e===t?!0:c.check(e)?s(e,t,r):f.check(e)?o(e,t,r):d.check(e)?d.check(t)&&+e===+t:h.check(e)?h.check(t)&&e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.ignoreCase===t.ignoreCase:e==t}function s(e,t,r){c.assert(e);var n=e.length;if(!c.check(t)||t.length!==n)return r&&r.push("length"),!1;for(var i=0;n>i;++i){if(r&&r.push(i),i in e!=i in t)return!1;if(!a(e[i],t[i],r))return!1;if(r){var s=r.pop();if(s!==i)throw new Error(""+s)}}return!0}function o(e,t,r){if(f.assert(e),!f.check(t))return!1;if(e.type!==t.type)return r&&r.push("type"),!1;var n=p(e),i=n.length,s=p(t),o=s.length;if(i===o){for(var u=0;i>u;++u){var c=n[u],d=l(e,c),h=l(t,c);if(r&&r.push(c),!a(d,h,r))return!1;if(r){var y=r.pop();if(y!==c)throw new Error(""+y)}}return!0}if(!r)return!1;var g=Object.create(null);for(u=0;i>u;++u)g[n[u]]=!0;for(u=0;o>u;++u){if(c=s[u],!m.call(g,c))return r.push(c),!1;delete g[c]}for(c in g){r.push(c);break}return!1}var u=e(576),p=u.getFieldNames,l=u.getFieldValue,c=u.builtInTypes.array,f=u.builtInTypes.object,d=u.builtInTypes.Date,h=u.builtInTypes.RegExp,m=Object.prototype.hasOwnProperty;n.assert=function(e,t){var r=[];if(!n(e,t,r)){if(0!==r.length)throw new Error("Nodes differ in the following path: "+r.map(i).join(""));if(e!==t)throw new Error("Nodes must be equal")}},t.exports=n},{576:576}],570:[function(e,t,r){function n(e,t,r){if(!(this instanceof n))throw new Error("NodePath constructor cannot be invoked without 'new'");h.call(this,e,t,r)}function i(e){return l.BinaryExpression.check(e)||l.LogicalExpression.check(e)}function a(e){return l.CallExpression.check(e)?!0:d.check(e)?e.some(a):l.Node.check(e)?p.someField(e,function(e,t){return a(t)}):!1}function s(e){for(var t,r;e.parent;e=e.parent){if(t=e.node,r=e.parent.node,l.BlockStatement.check(r)&&"body"===e.parent.name&&0===e.name){if(r.body[0]!==t)throw new Error("Nodes must be equal");return!0}if(l.ExpressionStatement.check(r)&&"expression"===e.name){if(r.expression!==t)throw new Error("Nodes must be equal");return!0}if(l.SequenceExpression.check(r)&&"expressions"===e.parent.name&&0===e.name){if(r.expressions[0]!==t)throw new Error("Nodes must be equal")}else if(l.CallExpression.check(r)&&"callee"===e.name){if(r.callee!==t)throw new Error("Nodes must be equal")}else if(l.MemberExpression.check(r)&&"object"===e.name){if(r.object!==t)throw new Error("Nodes must be equal")}else if(l.ConditionalExpression.check(r)&&"test"===e.name){if(r.test!==t)throw new Error("Nodes must be equal")}else if(i(r)&&"left"===e.name){if(r.left!==t)throw new Error("Nodes must be equal")}else{if(!l.UnaryExpression.check(r)||r.prefix||"argument"!==e.name)return!1;if(r.argument!==t)throw new Error("Nodes must be equal")}}return!0}function o(e){if(l.VariableDeclaration.check(e.node)){var t=e.get("declarations").value;if(!t||0===t.length)return e.prune()}else if(l.ExpressionStatement.check(e.node)){if(!e.get("expression").value)return e.prune()}else l.IfStatement.check(e.node)&&u(e);return e}function u(e){var t=e.get("test").value,r=e.get("alternate").value,n=e.get("consequent").value;if(n||r){if(!n&&r){var i=c.unaryExpression("!",t,!0);l.UnaryExpression.check(t)&&"!"===t.operator&&(i=t.argument),e.get("test").replace(i),e.get("consequent").replace(r),e.get("alternate").replace()}}else{var a=c.expressionStatement(t);e.replace(a)}}var p=e(575),l=p.namedTypes,c=p.builders,f=p.builtInTypes.number,d=p.builtInTypes.array,h=e(572),m=e(573),y=n.prototype=Object.create(h.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}});Object.defineProperties(y,{node:{get:function(){return Object.defineProperty(this,"node",{configurable:!0,value:this._computeNode()}),this.node}},parent:{get:function(){return Object.defineProperty(this,"parent",{configurable:!0,value:this._computeParent()}),this.parent}},scope:{get:function(){return Object.defineProperty(this,"scope",{configurable:!0,value:this._computeScope()}),this.scope}}}),y.replace=function(){return delete this.node,delete this.parent,delete this.scope,h.prototype.replace.apply(this,arguments)},y.prune=function(){var e=this.parent;return this.replace(),o(e)},y._computeNode=function(){var e=this.value;if(l.Node.check(e))return e;var t=this.parentPath;return t&&t.node||null},y._computeParent=function(){var e=this.value,t=this.parentPath;if(!l.Node.check(e)){for(;t&&!l.Node.check(t.value);)t=t.parentPath;t&&(t=t.parentPath)}for(;t&&!l.Node.check(t.value);)t=t.parentPath;return t||null},y._computeScope=function(){var e=this.value,t=this.parentPath,r=t&&t.scope;return l.Node.check(e)&&m.isEstablishedBy(e)&&(r=new m(this,r)),r||null},y.getValueProperty=function(e){return p.getFieldValue(this.value,e)},y.needsParens=function(e){var t=this.parentPath;if(!t)return!1;var r=this.value;if(!l.Expression.check(r))return!1;if("Identifier"===r.type)return!1;for(;!l.Node.check(t.value);)if(t=t.parentPath,!t)return!1;var n=t.value;switch(r.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return"MemberExpression"===n.type&&"object"===this.name&&n.object===r;
case"BinaryExpression":case"LogicalExpression":switch(n.type){case"CallExpression":return"callee"===this.name&&n.callee===r;case"UnaryExpression":case"SpreadElement":case"SpreadProperty":return!0;case"MemberExpression":return"object"===this.name&&n.object===r;case"BinaryExpression":case"LogicalExpression":var i=n.operator,t=g[i],s=r.operator,o=g[s];if(t>o)return!0;if(t===o&&"right"===this.name){if(n.right!==r)throw new Error("Nodes must be equal");return!0}default:return!1}case"SequenceExpression":switch(n.type){case"ForStatement":return!1;case"ExpressionStatement":return"expression"!==this.name;default:return!0}case"YieldExpression":switch(n.type){case"BinaryExpression":case"LogicalExpression":case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"CallExpression":case"MemberExpression":case"NewExpression":case"ConditionalExpression":case"YieldExpression":return!0;default:return!1}case"Literal":return"MemberExpression"===n.type&&f.check(r.value)&&"object"===this.name&&n.object===r;case"AssignmentExpression":case"ConditionalExpression":switch(n.type){case"UnaryExpression":case"SpreadElement":case"SpreadProperty":case"BinaryExpression":case"LogicalExpression":return!0;case"CallExpression":return"callee"===this.name&&n.callee===r;case"ConditionalExpression":return"test"===this.name&&n.test===r;case"MemberExpression":return"object"===this.name&&n.object===r;default:return!1}default:if("NewExpression"===n.type&&"callee"===this.name&&n.callee===r)return a(r)}return e!==!0&&!this.canBeFirstInStatement()&&this.firstInStatement()?!0:!1};var g={};[["||"],["&&"],["|"],["^"],["&"],["==","===","!=","!=="],["<",">","<=",">=","in","instanceof"],[">>","<<",">>>"],["+","-"],["*","/","%"]].forEach(function(e,t){e.forEach(function(e){g[e]=t})}),y.canBeFirstInStatement=function(){var e=this.node;return!l.FunctionExpression.check(e)&&!l.ObjectExpression.check(e)},y.firstInStatement=function(){return s(this)},t.exports=n},{572:572,573:573,575:575}],571:[function(e,t,r){function n(){if(!(this instanceof n))throw new Error("PathVisitor constructor cannot be invoked without 'new'");this._reusableContextStack=[],this._methodNameTable=i(this),this._shouldVisitComments=h.call(this._methodNameTable,"Block")||h.call(this._methodNameTable,"Line"),this.Context=o(this),this._visiting=!1,this._changeReported=!1}function i(e){var t=Object.create(null);for(var r in e)/^visit[A-Z]/.test(r)&&(t[r.slice("visit".length)]=!0);for(var n=p.computeSupertypeLookupTable(t),i=Object.create(null),t=Object.keys(n),a=t.length,s=0;a>s;++s){var o=t[s];r="visit"+n[o],d.check(e[r])&&(i[o]=r)}return i}function a(e,t){for(var r in t)h.call(t,r)&&(e[r]=t[r]);return e}function s(e,t){if(!(e instanceof l))throw new Error("");if(!(t instanceof n))throw new Error("");var r=e.value;if(c.check(r))e.each(t.visitWithoutReset,t);else if(f.check(r)){var i=p.getFieldNames(r);t._shouldVisitComments&&r.comments&&i.indexOf("comments")<0&&i.push("comments");for(var a=i.length,s=[],o=0;a>o;++o){var u=i[o];h.call(r,u)||(r[u]=p.getFieldValue(r,u)),s.push(e.get(u))}for(var o=0;a>o;++o)t.visitWithoutReset(s[o])}else;return e.value}function o(e){function t(r){if(!(this instanceof t))throw new Error("");if(!(this instanceof n))throw new Error("");if(!(r instanceof l))throw new Error("");Object.defineProperty(this,"visitor",{value:e,writable:!1,enumerable:!0,configurable:!1}),this.currentPath=r,this.needToCallTraverse=!0,Object.seal(this)}if(!(e instanceof n))throw new Error("");var r=t.prototype=Object.create(e);return r.constructor=t,a(r,y),t}var u,p=e(575),l=e(570),c=(p.namedTypes.Printable,p.builtInTypes.array),f=p.builtInTypes.object,d=p.builtInTypes["function"],h=Object.prototype.hasOwnProperty;n.fromMethodsObject=function(e){function t(){if(!(this instanceof t))throw new Error("Visitor constructor cannot be invoked without 'new'");n.call(this)}if(e instanceof n)return e;if(!f.check(e))return new n;var r=t.prototype=Object.create(m);return r.constructor=t,a(r,e),a(t,n),d.assert(t.fromMethodsObject),d.assert(t.visit),new t},n.visit=function(e,t){return n.fromMethodsObject(t).visit(e)};var m=n.prototype;m.visit=function(){if(this._visiting)throw new Error("Recursively calling visitor.visit(path) resets visitor state. Try this.visit(path) or this.traverse(path) instead.");this._visiting=!0,this._changeReported=!1,this._abortRequested=!1;for(var e=arguments.length,t=new Array(e),r=0;e>r;++r)t[r]=arguments[r];t[0]instanceof l||(t[0]=new l({root:t[0]}).get("root")),this.reset.apply(this,t);try{var n=this.visitWithoutReset(t[0]),i=!0}finally{if(this._visiting=!1,!i&&this._abortRequested)return t[0].value}return n},m.AbortRequest=function(){},m.abort=function(){var e=this;e._abortRequested=!0;var t=new e.AbortRequest;throw t.cancel=function(){e._abortRequested=!1},t},m.reset=function(e){},m.visitWithoutReset=function(e){if(this instanceof this.Context)return this.visitor.visitWithoutReset(e);if(!(e instanceof l))throw new Error("");var t=e.value,r=t&&"object"==typeof t&&"string"==typeof t.type&&this._methodNameTable[t.type];if(!r)return s(e,this);var n=this.acquireContext(e);try{return n.invokeVisitorMethod(r)}finally{this.releaseContext(n)}},m.acquireContext=function(e){return 0===this._reusableContextStack.length?new this.Context(e):this._reusableContextStack.pop().reset(e)},m.releaseContext=function(e){if(!(e instanceof this.Context))throw new Error("");this._reusableContextStack.push(e),e.currentPath=null},m.reportChanged=function(){this._changeReported=!0},m.wasChangeReported=function(){return this._changeReported};var y=Object.create(null);y.reset=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof l))throw new Error("");return this.currentPath=e,this.needToCallTraverse=!0,this},y.invokeVisitorMethod=function(e){if(!(this instanceof this.Context))throw new Error("");if(!(this.currentPath instanceof l))throw new Error("");var t=this.visitor[e].call(this,this.currentPath);if(t===!1?this.needToCallTraverse=!1:t!==u&&(this.currentPath=this.currentPath.replace(t)[0],this.needToCallTraverse&&this.traverse(this.currentPath)),this.needToCallTraverse!==!1)throw new Error("Must either call this.traverse or return false in "+e);var r=this.currentPath;return r&&r.value},y.traverse=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof l))throw new Error("");if(!(this.currentPath instanceof l))throw new Error("");return this.needToCallTraverse=!1,s(e,n.fromMethodsObject(t||this.visitor))},y.visit=function(e,t){if(!(this instanceof this.Context))throw new Error("");if(!(e instanceof l))throw new Error("");if(!(this.currentPath instanceof l))throw new Error("");return this.needToCallTraverse=!1,n.fromMethodsObject(t||this.visitor).visitWithoutReset(e)},y.reportChanged=function(){this.visitor.reportChanged()},y.abort=function(){this.needToCallTraverse=!1,this.visitor.abort()},t.exports=n},{570:570,575:575}],572:[function(e,t,r){function n(e,t,r){if(!(this instanceof n))throw new Error("Path constructor cannot be invoked without 'new'");if(t){if(!(t instanceof n))throw new Error("")}else t=null,r=null;this.value=e,this.parentPath=t,this.name=r,this.__childCache=null}function i(e){return e.__childCache||(e.__childCache=Object.create(null))}function a(e,t){var r=i(e),n=e.getValueProperty(t),a=r[t];return l.call(r,t)&&a.value===n||(a=r[t]=new e.constructor(n,e,t)),a}function s(){}function o(e,t,r,n){if(f.assert(e.value),0===t)return s;var a=e.value.length;if(1>a)return s;var o=arguments.length;2===o?(r=0,n=a):3===o?(r=Math.max(r,0),n=a):(r=Math.max(r,0),n=Math.min(n,a)),d.assert(r),d.assert(n);for(var u=Object.create(null),p=i(e),c=r;n>c;++c)if(l.call(e.value,c)){var h=e.get(c);if(h.name!==c)throw new Error("");var m=c+t;h.name=m,u[m]=h,delete p[c]}return delete p.length,function(){for(var t in u){var r=u[t];if(r.name!==+t)throw new Error("");p[t]=r,e.value[t]=r.value}}}function u(e){if(!(e instanceof n))throw new Error("");var t=e.parentPath;if(!t)return e;var r=t.value,a=i(t);if(r[e.name]===e.value)a[e.name]=e;else if(f.check(r)){var s=r.indexOf(e.value);s>=0&&(a[e.name=s]=e)}else r[e.name]=e.value,a[e.name]=e;if(r[e.name]!==e.value)throw new Error("");if(e.parentPath.get(e.name)!==e)throw new Error("");return e}var p=Object.prototype,l=p.hasOwnProperty,c=e(575),f=c.builtInTypes.array,d=c.builtInTypes.number,h=Array.prototype,m=(h.slice,h.map,n.prototype);m.getValueProperty=function(e){return this.value[e]},m.get=function(e){for(var t=this,r=arguments,n=r.length,i=0;n>i;++i)t=a(t,r[i]);return t},m.each=function(e,t){for(var r=[],n=this.value.length,i=0,i=0;n>i;++i)l.call(this.value,i)&&(r[i]=this.get(i));for(t=t||this,i=0;n>i;++i)l.call(r,i)&&e.call(t,r[i])},m.map=function(e,t){var r=[];return this.each(function(t){r.push(e.call(this,t))},t),r},m.filter=function(e,t){var r=[];return this.each(function(t){e.call(this,t)&&r.push(t)},t),r},m.shift=function(){var e=o(this,-1),t=this.value.shift();return e(),t},m.unshift=function(e){var t=o(this,arguments.length),r=this.value.unshift.apply(this.value,arguments);return t(),r},m.push=function(e){return f.assert(this.value),delete i(this).length,this.value.push.apply(this.value,arguments)},m.pop=function(){f.assert(this.value);var e=i(this);return delete e[this.value.length-1],delete e.length,this.value.pop()},m.insertAt=function(e,t){var r=arguments.length,n=o(this,r-1,e);if(n===s)return this;e=Math.max(e,0);for(var i=1;r>i;++i)this.value[e+i-1]=arguments[i];return n(),this},m.insertBefore=function(e){for(var t=this.parentPath,r=arguments.length,n=[this.name],i=0;r>i;++i)n.push(arguments[i]);return t.insertAt.apply(t,n)},m.insertAfter=function(e){for(var t=this.parentPath,r=arguments.length,n=[this.name+1],i=0;r>i;++i)n.push(arguments[i]);return t.insertAt.apply(t,n)},m.replace=function(e){var t=[],r=this.parentPath.value,n=i(this.parentPath),a=arguments.length;if(u(this),f.check(r)){for(var s=r.length,p=o(this.parentPath,a-1,this.name+1),l=[this.name,1],c=0;a>c;++c)l.push(arguments[c]);var d=r.splice.apply(r,l);if(d[0]!==this.value)throw new Error("");if(r.length!==s-1+a)throw new Error("");if(p(),0===a)delete this.value,delete n[this.name],this.__childCache=null;else{if(r[this.name]!==e)throw new Error("");for(this.value!==e&&(this.value=e,this.__childCache=null),c=0;a>c;++c)t.push(this.parentPath.get(this.name+c));if(t[0]!==this)throw new Error("")}}else if(1===a)this.value!==e&&(this.__childCache=null),this.value=r[this.name]=e,t.push(this);else{if(0!==a)throw new Error("Could not replace path");delete r[this.name],delete this.value,this.__childCache=null}return t},t.exports=n},{575:575}],573:[function(e,t,r){function n(t,r){if(!(this instanceof n))throw new Error("Scope constructor cannot be invoked without 'new'");if(!(t instanceof e(570)))throw new Error("");g.assert(t.value);var i;if(r){if(!(r instanceof n))throw new Error("");i=r.depth+1}else r=null,i=0;Object.defineProperties(this,{path:{value:t},node:{value:t.value},isGlobal:{value:!r,enumerable:!0},depth:{value:i},parent:{value:r},bindings:{value:{}}})}function i(e,t){var r=e.value;g.assert(r),l.CatchClause.check(r)?o(e.get("param"),t):a(e,t)}function a(e,t){var r=e.value;e.parent&&l.FunctionExpression.check(e.parent.node)&&e.parent.node.id&&o(e.parent.get("id"),t),r&&(d.check(r)?e.each(function(e){s(e,t)}):l.Function.check(r)?(e.get("params").each(function(e){o(e,t)}),s(e.get("body"),t)):l.VariableDeclarator.check(r)?(o(e.get("id"),t),s(e.get("init"),t)):"ImportSpecifier"===r.type||"ImportNamespaceSpecifier"===r.type||"ImportDefaultSpecifier"===r.type?o(e.get(r.local?"local":r.name?"name":"id"),t):c.check(r)&&!f.check(r)&&u.eachField(r,function(r,n){var i=e.get(r);if(i.value!==n)throw new Error("");s(i,t)}))}function s(e,t){var r=e.value;if(!r||f.check(r));else if(l.FunctionDeclaration.check(r))o(e.get("id"),t);else if(l.ClassDeclaration&&l.ClassDeclaration.check(r))o(e.get("id"),t);else if(g.check(r)){if(l.CatchClause.check(r)){var n=r.param.name,i=h.call(t,n);a(e.get("body"),t),i||delete t[n]}}else a(e,t)}function o(e,t){var r=e.value;l.Pattern.assert(r),l.Identifier.check(r)?h.call(t,r.name)?t[r.name].push(e):t[r.name]=[e]:l.ObjectPattern&&l.ObjectPattern.check(r)?e.get("properties").each(function(e){var r=e.value;l.Pattern.check(r)?o(e,t):l.Property.check(r)?o(e.get("value"),t):l.SpreadProperty&&l.SpreadProperty.check(r)&&o(e.get("argument"),t)}):l.ArrayPattern&&l.ArrayPattern.check(r)?e.get("elements").each(function(e){var r=e.value;l.Pattern.check(r)?o(e,t):l.SpreadElement&&l.SpreadElement.check(r)&&o(e.get("argument"),t)}):l.PropertyPattern&&l.PropertyPattern.check(r)?o(e.get("pattern"),t):(l.SpreadElementPattern&&l.SpreadElementPattern.check(r)||l.SpreadPropertyPattern&&l.SpreadPropertyPattern.check(r))&&o(e.get("argument"),t)}var u=e(575),p=u.Type,l=u.namedTypes,c=l.Node,f=l.Expression,d=u.builtInTypes.array,h=Object.prototype.hasOwnProperty,m=u.builders,y=[l.Program,l.Function,l.CatchClause],g=p.or.apply(p,y);n.isEstablishedBy=function(e){return g.check(e)};var v=n.prototype;v.didScan=!1,v.declares=function(e){return this.scan(),h.call(this.bindings,e)},v.declareTemporary=function(e){if(e){if(!/^[a-z$_]/i.test(e))throw new Error("")}else e="t$";e+=this.depth.toString(36)+"$",this.scan();for(var t=0;this.declares(e+t);)++t;var r=e+t;return this.bindings[r]=u.builders.identifier(r)},v.injectTemporary=function(e,t){e||(e=this.declareTemporary());var r=this.path.get("body");return l.BlockStatement.check(r.value)&&(r=r.get("body")),r.unshift(m.variableDeclaration("var",[m.variableDeclarator(e,t||null)])),e},v.scan=function(e){if(e||!this.didScan){for(var t in this.bindings)delete this.bindings[t];i(this.path,this.bindings),this.didScan=!0}},v.getBindings=function(){return this.scan(),this.bindings},v.lookup=function(e){for(var t=this;t&&!t.declares(e);t=t.parent);return t},v.getGlobalScope=function(){for(var e=this;!e.isGlobal;)e=e.parent;return e},t.exports=n},{570:570,575:575}],574:[function(e,t,r){var n=e(575),i=n.Type,a=n.builtInTypes,s=a.number;r.geq=function(e){return new i(function(t){return s.check(t)&&t>=e},s+" >= "+e)},r.defaults={"null":function(){return null},emptyArray:function(){return[]},"false":function(){return!1},"true":function(){return!0},undefined:function(){}};var o=i.or(a.string,a.number,a["boolean"],a["null"],a.undefined);r.isPrimitive=new i(function(e){if(null===e)return!0;var t=typeof e;return!("object"===t||"function"===t)},o.toString())},{575:575}],575:[function(e,t,r){function n(e,t){var r=this;if(!(r instanceof n))throw new Error("Type constructor cannot be invoked without 'new'");if(b.call(e)!==E)throw new Error(e+" is not a function");var i=b.call(t);if(i!==E&&i!==x)throw new Error(t+" is neither a function nor a string");Object.defineProperties(r,{name:{value:t},check:{value:function(t,n){var i=e.call(r,t,n);return!i&&n&&b.call(n)===E&&n(r,t),i}}})}function i(e){return k.check(e)?"{"+Object.keys(e).map(function(t){return t+": "+e[t]}).join(", ")+"}":F.check(e)?"["+e.map(i).join(", ")+"]":JSON.stringify(e)}function a(e,t){var r=b.call(e),i=new n(function(e){return b.call(e)===r},t);return w[t]=i,e&&"function"==typeof e.constructor&&(D.push(e.constructor),C.push(i)),i}function s(e,t){if(e instanceof n)return e;if(e instanceof u)return e.type;if(F.check(e))return n.fromArray(e);if(k.check(e))return n.fromObject(e);if(_.check(e)){var r=D.indexOf(e);return r>=0?C[r]:new n(e,t)}return new n(function(t){return t===e},B.check(t)?function(){return e+""}:t)}function o(e,t,r,n){var i=this;if(!(i instanceof o))throw new Error("Field constructor cannot be invoked without 'new'");I.assert(e),t=s(t);var a={name:{value:e},type:{value:t},hidden:{value:!!n}};_.check(r)&&(a.defaultFn={value:r}),Object.defineProperties(i,a)}function u(e){var t=this;if(!(t instanceof u))throw new Error("Def constructor cannot be invoked without 'new'");Object.defineProperties(t,{typeName:{value:e},baseNames:{value:[]},ownFields:{value:Object.create(null)},allSupertypes:{value:Object.create(null)},supertypeList:{value:[]},allFields:{value:Object.create(null)},fieldNames:{value:[]},type:{value:new n(function(e,r){return t.check(e,r)},e)}})}function p(e){return e.replace(/^[A-Z]+/,function(e){var t=e.length;switch(t){case 0:return"";case 1:return e.toLowerCase();default:return e.slice(0,t-1).toLowerCase()+e.charAt(t-1)}})}function l(e){return e=p(e),e.replace(/(Expression)?$/,"Statement")}function c(e){var t=u.fromValue(e);if(t)return t.fieldNames.slice(0);if("type"in e)throw new Error("did not recognize object of type "+JSON.stringify(e.type));return Object.keys(e)}function f(e,t){var r=u.fromValue(e);if(r){var n=r.allFields[t];if(n)return n.getValue(e)}return e[t]}function d(e){var t=l(e);if(!j[t]){var r=j[p(e)];r&&(j[t]=function(){return j.expressionStatement(r.apply(j,arguments))})}}function h(e,t){t.length=0,t.push(e);for(var r=Object.create(null),n=0;n<t.length;++n){e=t[n];var i=M[e];if(i.finalized!==!0)throw new Error("");S.call(r,e)&&delete t[r[e]],r[e]=n,t.push.apply(t,i.baseNames)}for(var a=0,s=a,o=t.length;o>s;++s)S.call(t,s)&&(t[a++]=t[s]);t.length=a}function m(e,t){return Object.keys(t).forEach(function(r){e[r]=t[r]}),e}var y=Array.prototype,g=y.slice,v=(y.map,y.forEach,Object.prototype),b=v.toString,E=b.call(function(){}),x=b.call(""),S=v.hasOwnProperty,A=n.prototype;r.Type=n,A.assert=function(e,t){if(!this.check(e,t)){var r=i(e);throw new Error(r+" does not match type "+this)}return!0},A.toString=function(){var e=this.name;return I.check(e)?e:_.check(e)?e.call(this)+"":e+" type"};var D=[],C=[],w={};r.builtInTypes=w;var I=a("truthy","string"),_=a(function(){},"function"),F=a([],"array"),k=a({},"object"),P=(a(/./,"RegExp"),a(new Date,"Date"),a(3,"number")),B=(a(!0,"boolean"),a(null,"null"),a(void 0,"undefined"));n.or=function(){for(var e=[],t=arguments.length,r=0;t>r;++r)e.push(s(arguments[r]));return new n(function(r,n){for(var i=0;t>i;++i)if(e[i].check(r,n))return!0;return!1},function(){return e.join(" | ")})},n.fromArray=function(e){if(!F.check(e))throw new Error("");if(1!==e.length)throw new Error("only one element type is permitted for typed arrays");return s(e[0]).arrayOf()},A.arrayOf=function(){var e=this;return new n(function(t,r){return F.check(t)&&t.every(function(t){return e.check(t,r)})},function(){return"["+e+"]"})},n.fromObject=function(e){var t=Object.keys(e).map(function(t){return new o(t,e[t])});return new n(function(e,r){return k.check(e)&&t.every(function(t){return t.type.check(e[t.name],r)})},function(){return"{ "+t.join(", ")+" }"})};var T=o.prototype;T.toString=function(){return JSON.stringify(this.name)+": "+this.type},T.getValue=function(e){var t=e[this.name];return B.check(t)?(this.defaultFn&&(t=this.defaultFn.call(e)),t):t},n.def=function(e){return I.assert(e),S.call(M,e)?M[e]:M[e]=new u(e)};var M=Object.create(null);u.fromValue=function(e){if(e&&"object"==typeof e){var t=e.type;if("string"==typeof t&&S.call(M,t)){var r=M[t];if(r.finalized)return r}}return null};var O=u.prototype;O.isSupertypeOf=function(e){if(e instanceof u){if(this.finalized!==!0||e.finalized!==!0)throw new Error("");return S.call(e.allSupertypes,this.typeName)}throw new Error(e+" is not a Def")},r.getSupertypeNames=function(e){if(!S.call(M,e))throw new Error("");var t=M[e];if(t.finalized!==!0)throw new Error("");return t.supertypeList.slice(1)},r.computeSupertypeLookupTable=function(e){for(var t={},r=Object.keys(M),n=r.length,i=0;n>i;++i){var a=r[i],s=M[a];if(s.finalized!==!0)throw new Error(""+a);for(var o=0;o<s.supertypeList.length;++o){var u=s.supertypeList[o];if(S.call(e,u)){t[a]=u;break}}}return t},O.checkAllFields=function(e,t){function r(r){var i=n[r],a=i.type,s=i.getValue(e);return a.check(s,t)}var n=this.allFields;if(this.finalized!==!0)throw new Error(""+this.typeName);return k.check(e)&&Object.keys(n).every(r)},O.check=function(e,t){if(this.finalized!==!0)throw new Error("prematurely checking unfinalized type "+this.typeName);if(!k.check(e))return!1;var r=u.fromValue(e);return r?t&&r===this?this.checkAllFields(e,t):this.isSupertypeOf(r)?t?r.checkAllFields(e,t)&&this.checkAllFields(e,!1):!0:!1:"SourceLocation"===this.typeName||"Position"===this.typeName?this.checkAllFields(e,t):!1},O.bases=function(){var e=g.call(arguments),t=this.baseNames;if(this.finalized){if(e.length!==t.length)throw new Error("");for(var r=0;r<e.length;r++)if(e[r]!==t[r])throw new Error("");return this}return e.forEach(function(e){I.assert(e),t.indexOf(e)<0&&t.push(e)}),this},Object.defineProperty(O,"buildable",{value:!1});var j={};r.builders=j;var L={};r.defineMethod=function(e,t){var r=L[e];return B.check(t)?delete L[e]:(_.assert(t),Object.defineProperty(L,e,{enumerable:!0,configurable:!0,value:t})),r};var N=I.arrayOf();O.build=function(){var e=this,t=g.call(arguments);return N.assert(t),Object.defineProperty(e,"buildParams",{value:t,writable:!1,enumerable:!1,configurable:!0}),e.buildable?e:(e.field("type",String,function(){return e.typeName}),Object.defineProperty(e,"buildable",{value:!0}),Object.defineProperty(j,p(e.typeName),{enumerable:!0,value:function(){function t(t,s){if(!S.call(a,t)){var o=e.allFields;if(!S.call(o,t))throw new Error(""+t);var u,p=o[t],l=p.type;if(P.check(s)&&n>s)u=r[s];else{if(!p.defaultFn){var c="no value or default function given for field "+JSON.stringify(t)+" of "+e.typeName+"("+e.buildParams.map(function(e){return o[e]}).join(", ")+")";throw new Error(c)}u=p.defaultFn.call(a)}if(!l.check(u))throw new Error(i(u)+" does not match field "+p+" of type "+e.typeName);a[t]=u}}var r=arguments,n=r.length,a=Object.create(L);if(!e.finalized)throw new Error("attempting to instantiate unfinalized type "+e.typeName);if(e.buildParams.forEach(function(e,r){t(e,r)}),Object.keys(e.allFields).forEach(function(e){t(e)}),a.type!==e.typeName)throw new Error("");return a}}),e)},r.getBuilderName=p,r.getStatementBuilderName=l,O.field=function(e,t,r,n){return this.finalized?(console.error("Ignoring attempt to redefine field "+JSON.stringify(e)+" of finalized type "+JSON.stringify(this.typeName)),this):(this.ownFields[e]=new o(e,t,r,n),this)};var R={};r.namedTypes=R,r.getFieldNames=c,r.getFieldValue=f,r.eachField=function(e,t,r){c(e).forEach(function(r){t.call(this,r,f(e,r))},r)},r.someField=function(e,t,r){return c(e).some(function(r){return t.call(this,r,f(e,r))},r)},Object.defineProperty(O,"finalized",{value:!1}),O.finalize=function(){var e=this;if(!e.finalized){var t=e.allFields,r=e.allSupertypes;e.baseNames.forEach(function(n){var i=M[n];if(!(i instanceof u)){var a="unknown supertype name "+JSON.stringify(n)+" for subtype "+JSON.stringify(e.typeName);throw new Error(a)}i.finalize(),m(t,i.allFields),m(r,i.allSupertypes)}),m(t,e.ownFields),r[e.typeName]=e,e.fieldNames.length=0;for(var n in t)S.call(t,n)&&!t[n].hidden&&e.fieldNames.push(n);Object.defineProperty(R,e.typeName,{enumerable:!0,value:e.type}),Object.defineProperty(e,"finalized",{value:!0}),h(e.typeName,e.supertypeList),e.buildable&&e.supertypeList.lastIndexOf("Expression")>=0&&d(e.typeName)}},r.finalize=function(){Object.keys(M).forEach(function(e){M[e].finalize()})}},{}],576:[function(e,t,r){var n=e(575);e(562),e(564),e(565),e(568),e(563),e(567),e(566),e(561),n.finalize(),r.Type=n.Type,r.builtInTypes=n.builtInTypes,r.namedTypes=n.namedTypes,r.builders=n.builders,r.defineMethod=n.defineMethod,r.getFieldNames=n.getFieldNames,r.getFieldValue=n.getFieldValue,r.eachField=n.eachField,r.someField=n.someField,r.getSupertypeNames=n.getSupertypeNames,r.astNodesAreEquivalent=e(569),r.finalize=n.finalize,r.NodePath=e(570),r.PathVisitor=e(571),r.visit=r.PathVisitor.visit},{561:561,562:562,563:563,564:564,565:565,566:566,567:567,568:568,569:569,570:570,571:571,575:575}],577:[function(e,t,r){(function(e,r){!function(r){"use strict";function n(e,t,r,n){var i=Object.create((t||a).prototype),s=new h(n||[]);return i._invoke=c(e,r,s),i}function i(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(n){return{type:"throw",arg:n}}}function a(){}function s(){}function o(){}function u(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function p(e){this.arg=e}function l(t){function r(e,r){var n=t[e](r),i=n.value;return i instanceof p?Promise.resolve(i.arg).then(a,s):Promise.resolve(i).then(function(e){return n.value=e,n})}function n(e,t){function n(){return r(e,t)}return i=i?i.then(n,n):new Promise(function(e){e(n())})}"object"==typeof e&&e.domain&&(r=e.domain.bind(r));var i,a=r.bind(t,"next"),s=r.bind(t,"throw");r.bind(t,"return");this._invoke=n}function c(e,t,r){var n=S;return function(a,s){if(n===D)throw new Error("Generator is already running");if(n===C){if("throw"===a)throw s;return y()}for(;;){var o=r.delegate;if(o){if("return"===a||"throw"===a&&o.iterator[a]===g){r.delegate=null;var u=o.iterator["return"];if(u){var p=i(u,o.iterator,s);if("throw"===p.type){a="throw",s=p.arg;continue}}if("return"===a)continue}var p=i(o.iterator[a],o.iterator,s);if("throw"===p.type){r.delegate=null,a="throw",s=p.arg;continue}a="next",s=g;var l=p.arg;if(!l.done)return n=A,l;r[o.resultName]=l.value,r.next=o.nextLoc,r.delegate=null}if("next"===a)n===A?r.sent=s:r.sent=g;else if("throw"===a){if(n===S)throw n=C,s;r.dispatchException(s)&&(a="next",s=g)}else"return"===a&&r.abrupt("return",s);n=D;var p=i(e,t,r);if("normal"===p.type){n=r.done?C:A;var l={value:p.arg,done:r.done};if(p.arg!==w)return l;r.delegate&&"next"===a&&(s=g)}else"throw"===p.type&&(n=C,a="throw",s=p.arg)}}}function f(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function d(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function h(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(f,this),this.reset(!0)}function m(e){if(e){var t=e[b];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function i(){for(;++r<e.length;)if(v.call(e,r))return i.value=e[r],i.done=!1,i;return i.value=g,i.done=!0,i};return n.next=n}}return{next:y}}function y(){return{value:g,done:!0}}var g,v=Object.prototype.hasOwnProperty,b="function"==typeof Symbol&&Symbol.iterator||"@@iterator",E="object"==typeof t,x=r.regeneratorRuntime;if(x)return void(E&&(t.exports=x));x=r.regeneratorRuntime=E?t.exports:{},x.wrap=n;var S="suspendedStart",A="suspendedYield",D="executing",C="completed",w={},I=o.prototype=a.prototype;s.prototype=I.constructor=o,o.constructor=s,s.displayName="GeneratorFunction",x.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return t?t===s||"GeneratorFunction"===(t.displayName||t.name):!1},x.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,o):e.__proto__=o,e.prototype=Object.create(I),e},x.awrap=function(e){return new p(e)},u(l.prototype),x.async=function(e,t,r,i){var a=new l(n(e,t,r,i));return x.isGeneratorFunction(t)?a:a.next().then(function(e){return e.done?e.value:a.next()})},u(I),I[b]=function(){return this},I.toString=function(){return"[object Generator]"},x.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},x.values=m,h.prototype={constructor:h,reset:function(e){if(this.prev=0,this.next=0,this.sent=g,this.done=!1,this.delegate=null,this.tryEntries.forEach(d),!e)for(var t in this)"t"===t.charAt(0)&&v.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=g)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,n){return a.type="throw",a.arg=e,r.next=t,!!n}if(this.done)throw e;for(var r=this,n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var s=v.call(i,"catchLoc"),o=v.call(i,"finallyLoc");if(s&&o){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!o)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&v.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?this.next=i.finallyLoc:this.complete(a),w},complete:function(e,t){if("throw"===e.type)throw e.arg;"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=e.arg,this.next="end"):"normal"===e.type&&t&&(this.next=t)},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),d(r),w}},"catch":function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;d(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:m(e),resultName:t,nextLoc:r},w}}}("object"==typeof r?r:"object"==typeof window?window:"object"==typeof self?self:this)}).call(this,e(10),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{10:10}],578:[function(e,t,r){var n=e(580);r.REGULAR={d:n().addRange(48,57),D:n().addRange(0,47).addRange(58,65535),s:n(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:n().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,65535),w:n(95).addRange(48,57).addRange(65,90).addRange(97,122),W:n(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,65535)},r.UNICODE={d:n().addRange(48,57),D:n().addRange(0,47).addRange(58,1114111),s:n(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:n().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:n(95).addRange(48,57).addRange(65,90).addRange(97,122),W:n(96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)},r.UNICODE_IGNORE_CASE={d:n().addRange(48,57),D:n().addRange(0,47).addRange(58,1114111),s:n(32,160,5760,6158,8239,8287,12288,65279).addRange(9,13).addRange(8192,8202).addRange(8232,8233),S:n().addRange(0,8).addRange(14,31).addRange(33,159).addRange(161,5759).addRange(5761,6157).addRange(6159,8191).addRange(8203,8231).addRange(8234,8238).addRange(8240,8286).addRange(8288,12287).addRange(12289,65278).addRange(65280,1114111),w:n(95,383,8490).addRange(48,57).addRange(65,90).addRange(97,122),W:n(75,83,96).addRange(0,47).addRange(58,64).addRange(91,94).addRange(123,1114111)}},{580:580}],579:[function(e,t,r){t.exports={75:8490,83:383,107:8490,115:383,181:924,197:8491,383:83,452:453,453:452,455:456,456:455,458:459,459:458,497:498,498:497,837:8126,914:976,917:1013,920:1012,921:8126,922:1008,924:181,928:982,929:1009,931:962,934:981,937:8486,962:931,976:914,977:1012,981:934,982:928,1008:922,1009:929,1012:[920,977],1013:917,7776:7835,7835:7776,8126:[837,921],8486:937,8490:75,8491:197,66560:66600,66561:66601,66562:66602,66563:66603,66564:66604,66565:66605,66566:66606,66567:66607,66568:66608,66569:66609,66570:66610,66571:66611,66572:66612,66573:66613,66574:66614,66575:66615,66576:66616,66577:66617,66578:66618,66579:66619,66580:66620,66581:66621,66582:66622,66583:66623,66584:66624,66585:66625,66586:66626,66587:66627,66588:66628,66589:66629,66590:66630,66591:66631,66592:66632,66593:66633,66594:66634,66595:66635,66596:66636,66597:66637,66598:66638,66599:66639,66600:66560,66601:66561,66602:66562,66603:66563,66604:66564,66605:66565,66606:66566,66607:66567,
66608:66568,66609:66569,66610:66570,66611:66571,66612:66572,66613:66573,66614:66574,66615:66575,66616:66576,66617:66577,66618:66578,66619:66579,66620:66580,66621:66581,66622:66582,66623:66583,66624:66584,66625:66585,66626:66586,66627:66587,66628:66588,66629:66589,66630:66590,66631:66591,66632:66592,66633:66593,66634:66594,66635:66595,66636:66596,66637:66597,66638:66598,66639:66599,68736:68800,68737:68801,68738:68802,68739:68803,68740:68804,68741:68805,68742:68806,68743:68807,68744:68808,68745:68809,68746:68810,68747:68811,68748:68812,68749:68813,68750:68814,68751:68815,68752:68816,68753:68817,68754:68818,68755:68819,68756:68820,68757:68821,68758:68822,68759:68823,68760:68824,68761:68825,68762:68826,68763:68827,68764:68828,68765:68829,68766:68830,68767:68831,68768:68832,68769:68833,68770:68834,68771:68835,68772:68836,68773:68837,68774:68838,68775:68839,68776:68840,68777:68841,68778:68842,68779:68843,68780:68844,68781:68845,68782:68846,68783:68847,68784:68848,68785:68849,68786:68850,68800:68736,68801:68737,68802:68738,68803:68739,68804:68740,68805:68741,68806:68742,68807:68743,68808:68744,68809:68745,68810:68746,68811:68747,68812:68748,68813:68749,68814:68750,68815:68751,68816:68752,68817:68753,68818:68754,68819:68755,68820:68756,68821:68757,68822:68758,68823:68759,68824:68760,68825:68761,68826:68762,68827:68763,68828:68764,68829:68765,68830:68766,68831:68767,68832:68768,68833:68769,68834:68770,68835:68771,68836:68772,68837:68773,68838:68774,68839:68775,68840:68776,68841:68777,68842:68778,68843:68779,68844:68780,68845:68781,68846:68782,68847:68783,68848:68784,68849:68785,68850:68786,71840:71872,71841:71873,71842:71874,71843:71875,71844:71876,71845:71877,71846:71878,71847:71879,71848:71880,71849:71881,71850:71882,71851:71883,71852:71884,71853:71885,71854:71886,71855:71887,71856:71888,71857:71889,71858:71890,71859:71891,71860:71892,71861:71893,71862:71894,71863:71895,71864:71896,71865:71897,71866:71898,71867:71899,71868:71900,71869:71901,71870:71902,71871:71903,71872:71840,71873:71841,71874:71842,71875:71843,71876:71844,71877:71845,71878:71846,71879:71847,71880:71848,71881:71849,71882:71850,71883:71851,71884:71852,71885:71853,71886:71854,71887:71855,71888:71856,71889:71857,71890:71858,71891:71859,71892:71860,71893:71861,71894:71862,71895:71863,71896:71864,71897:71865,71898:71866,71899:71867,71900:71868,71901:71869,71902:71870,71903:71871}},{}],580:[function(t,r,n){(function(t){!function(i){var a="object"==typeof n&&n,s="object"==typeof r&&r&&r.exports==a&&r,o="object"==typeof t&&t;(o.global===o||o.window===o)&&(i=o);var u={rangeOrder:"A range’s `stop` value must be greater than or equal to the `start` value.",codePointRange:"Invalid code point value. Code points range from U+000000 to U+10FFFF."},p=55296,l=56319,c=56320,f=57343,d=/\\x00([^0123456789]|$)/g,h={},m=h.hasOwnProperty,y=function(e,t){var r;for(r in t)m.call(t,r)&&(e[r]=t[r]);return e},g=function(e,t){for(var r=-1,n=e.length;++r<n;)t(e[r],r)},v=h.toString,b=function(e){return"[object Array]"==v.call(e)},E=function(e){return"number"==typeof e||"[object Number]"==v.call(e)},x="0000",S=function(e,t){var r=String(e);return r.length<t?(x+r).slice(-t):r},A=function(e){return Number(e).toString(16).toUpperCase()},D=[].slice,C=function(e){for(var t,r=-1,n=e.length,i=n-1,a=[],s=!0,o=0;++r<n;)if(t=e[r],s)a.push(t),o=t,s=!1;else if(t==o+1){if(r!=i){o=t;continue}s=!0,a.push(t+1)}else a.push(o+1,t),o=t;return s||a.push(t+1),a},w=function(e,t){for(var r,n,i=0,a=e.length;a>i;){if(r=e[i],n=e[i+1],t>=r&&n>t)return t==r?n==r+1?(e.splice(i,2),e):(e[i]=t+1,e):t==n-1?(e[i+1]=t,e):(e.splice(i,2,r,t,t+1,n),e);i+=2}return e},I=function(e,t,r){if(t>r)throw Error(u.rangeOrder);for(var n,i,a=0;a<e.length;){if(n=e[a],i=e[a+1]-1,n>r)return e;if(n>=t&&r>=i)e.splice(a,2);else{if(t>=n&&i>r)return t==n?(e[a]=r+1,e[a+1]=i+1,e):(e.splice(a,2,n,t,r+1,i+1),e);if(t>=n&&i>=t)e[a+1]=t;else if(r>=n&&i>=r)return e[a]=r+1,e;a+=2}}return e},_=function(e,t){var r,n,i=0,a=null,s=e.length;if(0>t||t>1114111)throw RangeError(u.codePointRange);for(;s>i;){if(r=e[i],n=e[i+1],t>=r&&n>t)return e;if(t==r-1)return e[i]=t,e;if(r>t)return e.splice(null!=a?a+2:0,0,t,t+1),e;if(t==n)return t+1==e[i+2]?(e.splice(i,4,r,e[i+3]),e):(e[i+1]=t+1,e);a=i,i+=2}return e.push(t,t+1),e},F=function(e,t){for(var r,n,i=0,a=e.slice(),s=t.length;s>i;)r=t[i],n=t[i+1]-1,a=r==n?_(a,r):P(a,r,n),i+=2;return a},k=function(e,t){for(var r,n,i=0,a=e.slice(),s=t.length;s>i;)r=t[i],n=t[i+1]-1,a=r==n?w(a,r):I(a,r,n),i+=2;return a},P=function(e,t,r){if(t>r)throw Error(u.rangeOrder);if(0>t||t>1114111||0>r||r>1114111)throw RangeError(u.codePointRange);for(var n,i,a=0,s=!1,o=e.length;o>a;){if(n=e[a],i=e[a+1],s){if(n==r+1)return e.splice(a-1,2),e;if(n>r)return e;n>=t&&r>=n&&(i>t&&r>=i-1?(e.splice(a,2),a-=2):(e.splice(a-1,2),a-=2))}else{if(n==r+1)return e[a]=t,e;if(n>r)return e.splice(a,0,t,r+1),e;if(t>=n&&i>t&&i>=r+1)return e;t>=n&&i>t||i==t?(e[a+1]=r+1,s=!0):n>=t&&r+1>=i&&(e[a]=t,e[a+1]=r+1,s=!0)}a+=2}return s||e.push(t,r+1),e},B=function(e,t){var r=0,n=e.length,i=e[r],a=e[n-1];if(n>=2&&(i>t||t>a))return!1;for(;n>r;){if(i=e[r],a=e[r+1],t>=i&&a>t)return!0;r+=2}return!1},T=function(e,t){for(var r,n=0,i=t.length,a=[];i>n;)r=t[n],B(e,r)&&a.push(r),++n;return C(a)},M=function(e){return!e.length},O=function(e){return 2==e.length&&e[0]+1==e[1]},j=function(e){for(var t,r,n=0,i=[],a=e.length;a>n;){for(t=e[n],r=e[n+1];r>t;)i.push(t),++t;n+=2}return i},L=Math.floor,N=function(e){return parseInt(L((e-65536)/1024)+p,10)},R=function(e){return parseInt((e-65536)%1024+c,10)},V=String.fromCharCode,U=function(e){var t;return t=9==e?"\\t":10==e?"\\n":12==e?"\\f":13==e?"\\r":92==e?"\\\\":36==e||e>=40&&43>=e||45==e||46==e||63==e||e>=91&&94>=e||e>=123&&125>=e?"\\"+V(e):e>=32&&126>=e?V(e):255>=e?"\\x"+S(A(e),2):"\\u"+S(A(e),4)},q=function(e){var t,r=e.length,n=e.charCodeAt(0);return n>=p&&l>=n&&r>1?(t=e.charCodeAt(1),1024*(n-p)+t-c+65536):n},G=function(e){var t,r,n="",i=0,a=e.length;if(O(e))return U(e[0]);for(;a>i;)t=e[i],r=e[i+1]-1,n+=t==r?U(t):t+1==r?U(t)+U(r):U(t)+"-"+U(r),i+=2;return"["+n+"]"},H=function(e){for(var t,r,n=[],i=[],a=[],s=[],o=0,u=e.length;u>o;)t=e[o],r=e[o+1]-1,p>t?(p>r&&a.push(t,r+1),r>=p&&l>=r&&(a.push(t,p),n.push(p,r+1)),r>=c&&f>=r&&(a.push(t,p),n.push(p,l+1),i.push(c,r+1)),r>f&&(a.push(t,p),n.push(p,l+1),i.push(c,f+1),65535>=r?a.push(f+1,r+1):(a.push(f+1,65536),s.push(65536,r+1)))):t>=p&&l>=t?(r>=p&&l>=r&&n.push(t,r+1),r>=c&&f>=r&&(n.push(t,l+1),i.push(c,r+1)),r>f&&(n.push(t,l+1),i.push(c,f+1),65535>=r?a.push(f+1,r+1):(a.push(f+1,65536),s.push(65536,r+1)))):t>=c&&f>=t?(r>=c&&f>=r&&i.push(t,r+1),r>f&&(i.push(t,f+1),65535>=r?a.push(f+1,r+1):(a.push(f+1,65536),s.push(65536,r+1)))):t>f&&65535>=t?65535>=r?a.push(t,r+1):(a.push(t,65536),s.push(65536,r+1)):s.push(t,r+1),o+=2;return{loneHighSurrogates:n,loneLowSurrogates:i,bmp:a,astral:s}},W=function(e){for(var t,r,n,i,a,s,o=[],u=[],p=!1,l=-1,c=e.length;++l<c;)if(t=e[l],r=e[l+1]){for(n=t[0],i=t[1],a=r[0],s=r[1],u=i;a&&n[0]==a[0]&&n[1]==a[1];)u=O(s)?_(u,s[0]):P(u,s[0],s[1]-1),++l,t=e[l],n=t[0],i=t[1],r=e[l+1],a=r&&r[0],s=r&&r[1],p=!0;o.push([n,p?u:i]),p=!1}else o.push(t);return X(o)},X=function(e){if(1==e.length)return e;for(var t=-1,r=-1;++t<e.length;){var n=e[t],i=n[1],a=i[0],s=i[1];for(r=t;++r<e.length;){var o=e[r],u=o[1],p=u[0],l=u[1];a==p&&s==l&&(O(o[0])?n[0]=_(n[0],o[0][0]):n[0]=P(n[0],o[0][0],o[0][1]-1),e.splice(r,1),--r)}}return e},Y=function(e){if(!e.length)return[];for(var t,r,n,i,a,s,o=0,u=0,p=0,l=[],d=e.length;d>o;){t=e[o],r=e[o+1]-1,n=N(t),i=R(t),a=N(r),s=R(r);var h=i==c,m=s==f,y=!1;n==a||h&&m?(l.push([[n,a+1],[i,s+1]]),y=!0):l.push([[n,n+1],[i,f+1]]),!y&&a>n+1&&(m?(l.push([[n+1,a+1],[c,s+1]]),y=!0):l.push([[n+1,a],[c,f+1]])),y||l.push([[a,a+1],[c,s+1]]),u=n,p=a,o+=2}return W(l)},J=function(e){var t=[];return g(e,function(e){var r=e[0],n=e[1];t.push(G(r)+G(n))}),t.join("|")},z=function(e,t){var r=[],n=H(e),i=n.loneHighSurrogates,a=n.loneLowSurrogates,s=n.bmp,o=n.astral,u=(!M(n.astral),!M(i)),p=!M(a),l=Y(o);return t&&(s=F(s,i),u=!1,s=F(s,a),p=!1),M(s)||r.push(G(s)),l.length&&r.push(J(l)),u&&r.push(G(i)+"(?![\\uDC00-\\uDFFF])"),p&&r.push("(?:[^\\uD800-\\uDBFF]|^)"+G(a)),r.join("|")},K=function(e){return arguments.length>1&&(e=D.call(arguments)),this instanceof K?(this.data=[],e?this.add(e):this):(new K).add(e)};K.version="1.2.0";var $=K.prototype;y($,{add:function(e){var t=this;return null==e?t:e instanceof K?(t.data=F(t.data,e.data),t):(arguments.length>1&&(e=D.call(arguments)),b(e)?(g(e,function(e){t.add(e)}),t):(t.data=_(t.data,E(e)?e:q(e)),t))},remove:function(e){var t=this;return null==e?t:e instanceof K?(t.data=k(t.data,e.data),t):(arguments.length>1&&(e=D.call(arguments)),b(e)?(g(e,function(e){t.remove(e)}),t):(t.data=w(t.data,E(e)?e:q(e)),t))},addRange:function(e,t){var r=this;return r.data=P(r.data,E(e)?e:q(e),E(t)?t:q(t)),r},removeRange:function(e,t){var r=this,n=E(e)?e:q(e),i=E(t)?t:q(t);return r.data=I(r.data,n,i),r},intersection:function(e){var t=this,r=e instanceof K?j(e.data):e;return t.data=T(t.data,r),t},contains:function(e){return B(this.data,E(e)?e:q(e))},clone:function(){var e=new K;return e.data=this.data.slice(0),e},toString:function(e){var t=z(this.data,e?e.bmpOnly:!1);return t.replace(d,"\\0$1")},toRegExp:function(e){return RegExp(this.toString(),e||"")},valueOf:function(){return j(this.data)}}),$.toArray=$.valueOf,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return K}):a&&!a.nodeType?s?s.exports=K:a.regenerate=K:i.regenerate=K}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],581:[function(t,r,n){(function(t){(function(){"use strict";function i(){var e,t,r=16384,n=[],i=-1,a=arguments.length;if(!a)return"";for(var s="";++i<a;){var o=Number(arguments[i]);if(!isFinite(o)||0>o||o>1114111||I(o)!=o)throw RangeError("Invalid code point: "+o);65535>=o?n.push(o):(o-=65536,e=(o>>10)+55296,t=o%1024+56320,n.push(e,t)),(i+1==a||n.length>r)&&(s+=w.apply(null,n),n.length=0)}return s}function a(e,t){if(-1==t.indexOf("|")){if(e==t)return;throw Error("Invalid node type: "+e)}if(t=a.hasOwnProperty(t)?a[t]:a[t]=RegExp("^(?:"+t+")$"),!t.test(e))throw Error("Invalid node type: "+e)}function s(e){var t=e.type;if(s.hasOwnProperty(t)&&"function"==typeof s[t])return s[t](e);throw Error("Invalid node type: "+t)}function o(e){a(e.type,"alternative");var t=e.body,r=t?t.length:0;if(1==r)return b(t[0]);for(var n=-1,i="";++n<r;)i+=b(t[n]);return i}function u(e){switch(a(e.type,"anchor"),e.kind){case"start":return"^";case"end":return"$";case"boundary":return"\\b";case"not-boundary":return"\\B";default:throw Error("Invalid assertion")}}function p(e){return a(e.type,"anchor|characterClass|characterClassEscape|dot|group|reference|value"),s(e)}function l(e){a(e.type,"characterClass");var t=e.body,r=t?t.length:0,n=-1,i="[";for(e.negative&&(i+="^");++n<r;)i+=d(t[n]);return i+="]"}function c(e){return a(e.type,"characterClassEscape"),"\\"+e.value}function f(e){a(e.type,"characterClassRange");var t=e.min,r=e.max;if("characterClassRange"==t.type||"characterClassRange"==r.type)throw Error("Invalid character class range");return d(t)+"-"+d(r)}function d(e){return a(e.type,"anchor|characterClassEscape|characterClassRange|dot|value"),s(e)}function h(e){a(e.type,"disjunction");var t=e.body,r=t?t.length:0;if(0==r)throw Error("No body");if(1==r)return s(t[0]);for(var n=-1,i="";++n<r;)0!=n&&(i+="|"),i+=s(t[n]);return i}function m(e){return a(e.type,"dot"),"."}function y(e){a(e.type,"group");var t="(";switch(e.behavior){case"normal":break;case"ignore":t+="?:";break;case"lookahead":t+="?=";break;case"negativeLookahead":t+="?!";break;default:throw Error("Invalid behaviour: "+e.behaviour)}var r=e.body,n=r?r.length:0;if(1==n)t+=s(r[0]);else for(var i=-1;++i<n;)t+=s(r[i]);return t+=")"}function g(e){a(e.type,"quantifier");var t="",r=e.min,n=e.max;switch(n){case void 0:case null:switch(r){case 0:t="*";break;case 1:t="+";break;default:t="{"+r+",}"}break;default:t=r==n?"{"+r+"}":0==r&&1==n?"?":"{"+r+","+n+"}"}return e.greedy||(t+="?"),p(e.body[0])+t}function v(e){return a(e.type,"reference"),"\\"+e.matchIndex}function b(e){return a(e.type,"anchor|characterClass|characterClassEscape|empty|group|quantifier|reference|value"),s(e)}function E(e){a(e.type,"value");var t=e.kind,r=e.codePoint;switch(t){case"controlLetter":return"\\c"+i(r+64);case"hexadecimalEscape":return"\\x"+("00"+r.toString(16).toUpperCase()).slice(-2);case"identifier":return"\\"+i(r);case"null":return"\\"+r;case"octal":return"\\"+r.toString(8);case"singleEscape":switch(r){case 8:return"\\b";case 9:return"\\t";case 10:return"\\n";case 11:return"\\v";case 12:return"\\f";case 13:return"\\r";default:throw Error("Invalid codepoint: "+r)}case"symbol":return i(r);case"unicodeEscape":return"\\u"+("0000"+r.toString(16).toUpperCase()).slice(-4);case"unicodeCodePointEscape":return"\\u{"+r.toString(16).toUpperCase()+"}";default:throw Error("Unsupported node kind: "+t)}}var x={"function":!0,object:!0},S=x[typeof window]&&window||this,A=x[typeof n]&&n,D=x[typeof r]&&r&&!r.nodeType&&r,C=A&&D&&"object"==typeof t&&t;!C||C.global!==C&&C.window!==C&&C.self!==C||(S=C);var w=String.fromCharCode,I=Math.floor;s.alternative=o,s.anchor=u,s.characterClass=l,s.characterClassEscape=c,s.characterClassRange=f,s.disjunction=h,s.dot=m,s.group=y,s.quantifier=g,s.reference=v,s.value=E,"function"==typeof e&&"object"==typeof e.amd&&e.amd?e(function(){return{generate:s}}):A&&D?A.generate=s:S.regjsgen={generate:s}}).call(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],582:[function(e,t,r){!function(){function e(e,t){function r(t){return t.raw=e.substring(t.range[0],t.range[1]),t}function n(e,t){return e.range[0]=t,r(e)}function i(e,t){return r({type:"anchor",kind:e,range:[$-t,$]})}function a(e,t,n,i){return r({type:"value",kind:e,codePoint:t,range:[n,i]})}function s(e,t,r,n){return n=n||0,a(e,t,$-(r.length+n),$)}function o(e){var t=e[0],r=t.charCodeAt(0);if(K){var n;if(1===t.length&&r>=55296&&56319>=r&&(n=x().charCodeAt(0),n>=56320&&57343>=n))return $++,a("symbol",1024*(r-55296)+n-56320+65536,$-2,$)}return a("symbol",r,$-1,$)}function u(e,t,n){return r({type:"disjunction",body:e,range:[t,n]})}function p(){return r({type:"dot",range:[$-1,$]})}function l(e){return r({type:"characterClassEscape",value:e,range:[$-2,$]})}function c(e){return r({type:"reference",matchIndex:parseInt(e,10),range:[$-1-e.length,$]})}function f(e,t,n,i){return r({type:"group",behavior:e,body:t,range:[n,i]})}function d(e,t,n,i){return null==i&&(n=$-1,i=$),r({type:"quantifier",min:e,max:t,greedy:!0,body:null,range:[n,i]})}function h(e,t,n){return r({type:"alternative",body:e,range:[t,n]})}function m(e,t,n,i){return r({type:"characterClass",body:e,negative:t,range:[n,i]})}function y(e,t,n,i){return e.codePoint>t.codePoint&&X("invalid range in character class",e.raw+"-"+t.raw,n,i),r({type:"characterClassRange",min:e,max:t,range:[n,i]})}function g(e){return"alternative"===e.type?e.body:[e]}function v(t){t=t||1;var r=e.substring($,$+t);return $+=t||1,r}function b(e){E(e)||X("character",e)}function E(t){return e.indexOf(t,$)===$?v(t.length):void 0}function x(){return e[$]}function S(t){return e.indexOf(t,$)===$}function A(t){return e[$+1]===t}function D(t){var r=e.substring($),n=r.match(t);return n&&(n.range=[],n.range[0]=$,v(n[0].length),n.range[1]=$),n}function C(){var e=[],t=$;for(e.push(w());E("|");)e.push(w());return 1===e.length?e[0]:u(e,t,$)}function w(){for(var e,t=[],r=$;e=I();)t.push(e);return 1===t.length?t[0]:h(t,r,$)}function I(){if($>=e.length||S("|")||S(")"))return null;var t=F();if(t)return t;var r=P();r||X("Expected atom");var i=k()||!1;return i?(i.body=g(r),n(i,r.range[0]),i):r}function _(e,t,r,n){var i=null,a=$;if(E(e))i=t;else{if(!E(r))return!1;i=n}var s=C();s||X("Expected disjunction"),b(")");var o=f(i,g(s),a,$);return"normal"==i&&z&&J++,o}function F(){return E("^")?i("start",1):E("$")?i("end",1):E("\\b")?i("boundary",2):E("\\B")?i("not-boundary",2):_("(?=","lookahead","(?!","negativeLookahead")}function k(){var e,t,r,n,i=$;return E("*")?t=d(0):E("+")?t=d(1):E("?")?t=d(0,1):(e=D(/^\{([0-9]+)\}/))?(r=parseInt(e[1],10),t=d(r,r,e.range[0],e.range[1])):(e=D(/^\{([0-9]+),\}/))?(r=parseInt(e[1],10),t=d(r,void 0,e.range[0],e.range[1])):(e=D(/^\{([0-9]+),([0-9]+)\}/))&&(r=parseInt(e[1],10),n=parseInt(e[2],10),r>n&&X("numbers out of order in {} quantifier","",i,$),t=d(r,n,e.range[0],e.range[1])),t&&E("?")&&(t.greedy=!1,t.range[1]+=1),t}function P(){var e;return(e=D(/^[^^$\\.*+?(){[|]/))?o(e):E(".")?p():E("\\")?(e=M(),e||X("atomEscape"),e):(e=R())?e:_("(?:","ignore","(","normal")}function B(e){if(K){var t,n;if("unicodeEscape"==e.kind&&(t=e.codePoint)>=55296&&56319>=t&&S("\\")&&A("u")){var i=$;$++;var a=T();"unicodeEscape"==a.kind&&(n=a.codePoint)>=56320&&57343>=n?(e.range[1]=a.range[1],e.codePoint=1024*(t-55296)+n-56320+65536,e.type="value",e.kind="unicodeCodePointEscape",r(e)):$=i}}return e}function T(){return M(!0)}function M(e){var t,r=$;if(t=O())return t;if(e){if(E("b"))return s("singleEscape",8,"\\b");E("B")&&X("\\B not possible inside of CharacterClass","",r)}return t=j()}function O(){var e,t;if(e=D(/^(?!0)\d+/)){t=e[0];var r=parseInt(e[0],10);return J>=r?c(e[0]):(Y.push(r),v(-e[0].length),(e=D(/^[0-7]{1,3}/))?s("octal",parseInt(e[0],8),e[0],1):(e=o(D(/^[89]/)),n(e,e.range[0]-1)))}return(e=D(/^[0-7]{1,3}/))?(t=e[0],/^0{1,3}$/.test(t)?s("null",0,"0",t.length+1):s("octal",parseInt(t,8),t,1)):(e=D(/^[dDsSwW]/))?l(e[0]):!1}function j(){var e;if(e=D(/^[fnrtv]/)){var t=0;switch(e[0]){case"t":t=9;break;case"n":t=10;break;case"v":t=11;break;case"f":t=12;break;case"r":t=13}return s("singleEscape",t,"\\"+e[0])}return(e=D(/^c([a-zA-Z])/))?s("controlLetter",e[1].charCodeAt(0)%32,e[1],2):(e=D(/^x([0-9a-fA-F]{2})/))?s("hexadecimalEscape",parseInt(e[1],16),e[1],2):(e=D(/^u([0-9a-fA-F]{4})/))?B(s("unicodeEscape",parseInt(e[1],16),e[1],2)):K&&(e=D(/^u\{([0-9a-fA-F]+)\}/))?s("unicodeCodePointEscape",parseInt(e[1],16),e[1],4):N()}function L(e){var t=new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԯԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠ-ࢲࣤ-ॣ०-९ॱ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఀ-ఃఅ-ఌఎ-ఐఒ-నప-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಁ-ಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲഁ-ഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟ෦-෯ෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧ᪰-᪽ᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶ᳸᳹ᴀ-᷵᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚝꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꧠ-ꧾꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︭︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]");return 36===e||95===e||e>=65&&90>=e||e>=97&&122>=e||e>=48&&57>=e||92===e||e>=128&&t.test(String.fromCharCode(e))}function N(){var e,t="",r="";return L(x())?E(t)?s("identifier",8204,t):E(r)?s("identifier",8205,r):null:(e=v(),s("identifier",e.charCodeAt(0),e,1))}function R(){var e,t=$;return(e=D(/^\[\^/))?(e=V(),b("]"),m(e,!0,t,$)):E("[")?(e=V(),b("]"),m(e,!1,t,$)):null}function V(){var e;return S("]")?[]:(e=q(),e||X("nonEmptyClassRanges"),e)}function U(e){var t,r,n;if(S("-")&&!A("]")){b("-"),n=H(),n||X("classAtom"),r=$;var i=V();return i||X("classRanges"),t=e.range[0],"empty"===i.type?[y(e,n,t,r)]:[y(e,n,t,r)].concat(i)}return n=G(),n||X("nonEmptyClassRangesNoDash"),[e].concat(n)}function q(){var e=H();return e||X("classAtom"),S("]")?[e]:U(e)}function G(){var e=H();return e||X("classAtom"),S("]")?e:U(e)}function H(){return E("-")?o("-"):W()}function W(){var e;return(e=D(/^[^\\\]-]/))?o(e[0]):E("\\")?(e=T(),e||X("classEscape"),B(e)):void 0}function X(t,r,n,i){n=null==n?$:n,i=null==i?n:i;var a=Math.max(0,n-10),s=Math.min(i+10,e.length),o=" "+e.substring(a,s),u=" "+new Array(n-a+1).join(" ")+"^";throw SyntaxError(t+" at position "+n+(r?": "+r:"")+"\n"+o+"\n"+u)}var Y=[],J=0,z=!0,K=-1!==(t||"").indexOf("u"),$=0;e=String(e),""===e&&(e="(?:)");var Q=C();Q.range[1]!==e.length&&X("Could not parse entire input - got stuck","",Q.range[1]);for(var Z=0;Z<Y.length;Z++)if(Y[Z]<=J)return $=0,z=!1,C();return Q}var r={parse:e};"undefined"!=typeof t&&t.exports?t.exports=r:window.regjsparser=r}()},{}],583:[function(e,t,r){function n(e){return A?S?m.UNICODE_IGNORE_CASE[e]:m.UNICODE[e]:m.REGULAR[e]}function i(e,t){return g.call(e,t)}function a(e,t){for(var r in t)e[r]=t[r]}function s(e,t){if(t){var r=f(t,"");switch(r.type){case"characterClass":case"group":case"value":break;default:r=o(r,t)}a(e,r)}}function o(e,t){return{type:"group",behavior:"ignore",body:[e],raw:"(?:"+t+")"}}function u(e){return i(h,e)?h[e]:!1}function p(e){var t=d();e.body.forEach(function(e){switch(e.type){case"value":if(t.add(e.codePoint),S&&A){var r=u(e.codePoint);r&&t.add(r)}break;case"characterClassRange":var i=e.min.codePoint,a=e.max.codePoint;t.addRange(i,a),S&&A&&t.iuAddRange(i,a);break;case"characterClassEscape":t.add(n(e.value));break;default:throw Error("Unknown term type: "+e.type)}});return e.negative&&(t=(A?v:b).clone().remove(t)),s(e,t.toString()),e}function l(e){switch(e.type){case"dot":s(e,(A?E:x).toString());break;case"characterClass":e=p(e);break;case"characterClassEscape":s(e,n(e.value).toString());break;case"alternative":case"disjunction":case"group":case"quantifier":e.body=e.body.map(l);break;case"value":var t=e.codePoint,r=d(t);if(S&&A){var i=u(t);i&&r.add(i)}s(e,r.toString());break;case"anchor":case"empty":case"group":case"reference":break;default:throw Error("Unknown term type: "+e.type)}return e}var c=e(581).generate,f=e(582).parse,d=e(580),h=e(579),m=e(578),y={},g=y.hasOwnProperty,v=d().addRange(0,1114111),b=d().addRange(0,65535),E=v.clone().remove(10,13,8232,8233),x=E.clone().intersection(b);d.prototype.iuAddRange=function(e,t){var r=this;do{var n=u(e);n&&r.add(n)}while(++e<=t);return r};var S=!1,A=!1;t.exports=function(e,t){var r=f(e,t);return S=t?t.indexOf("i")>-1:!1,A=t?t.indexOf("u")>-1:!1,a(r,l(r)),c(r)}},{578:578,579:579,580:580,581:581,582:582}],584:[function(e,t,r){"use strict";var n=e(585);t.exports=function(e,t){if("string"!=typeof e)throw new TypeError("Expected a string as the first argument");if(0>t||!n(t))throw new TypeError("Expected a finite positive number");var r="";do 1&t&&(r+=e),e+=e;while(t>>=1);return r}},{585:585}],585:[function(e,t,r){arguments[4][399][0].apply(r,arguments)},{399:399,586:586}],586:[function(e,t,r){arguments[4][400][0].apply(r,arguments)},{400:400}],587:[function(e,t,r){"use strict";t.exports=/^#!.*/},{}],588:[function(e,t,r){"use strict";t.exports=function(e){var t=/^\\\\\?\\/.test(e),r=/[^\x00-\x80]+/.test(e);return t||r?e:e.replace(/\\/g,"/")}},{}],589:[function(e,t,r){function n(){this._array=[],this._set={}}var i=e(598);n.fromArray=function(e,t){for(var r=new n,i=0,a=e.length;a>i;i++)r.add(e[i],t);return r},n.prototype.size=function(){return Object.getOwnPropertyNames(this._set).length},n.prototype.add=function(e,t){var r=i.toSetString(e),n=this._set.hasOwnProperty(r),a=this._array.length;(!n||t)&&this._array.push(e),n||(this._set[r]=a)},n.prototype.has=function(e){var t=i.toSetString(e);return this._set.hasOwnProperty(t)},n.prototype.indexOf=function(e){var t=i.toSetString(e);if(this._set.hasOwnProperty(t))return this._set[t];throw new Error('"'+e+'" is not in the set.')},n.prototype.at=function(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)},n.prototype.toArray=function(){return this._array.slice()},r.ArraySet=n},{598:598}],590:[function(e,t,r){function n(e){return 0>e?(-e<<1)+1:(e<<1)+0}function i(e){var t=1===(1&e),r=e>>1;return t?-r:r}var a=e(591),s=5,o=1<<s,u=o-1,p=o;r.encode=function(e){var t,r="",i=n(e);do t=i&u,i>>>=s,i>0&&(t|=p),r+=a.encode(t);while(i>0);return r},r.decode=function(e,t,r){var n,o,l=e.length,c=0,f=0;do{if(t>=l)throw new Error("Expected more digits in base 64 VLQ value.");if(o=a.decode(e.charCodeAt(t++)),-1===o)throw new Error("Invalid base64 digit: "+e.charAt(t-1));n=!!(o&p),o&=u,c+=o<<f,f+=s}while(n);r.value=i(c),r.rest=t}},{591:591}],591:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");r.encode=function(e){if(e>=0&&e<n.length)return n[e];throw new TypeError("Must be between 0 and 63: "+e)},r.decode=function(e){var t=65,r=90,n=97,i=122,a=48,s=57,o=43,u=47,p=26,l=52;return e>=t&&r>=e?e-t:e>=n&&i>=e?e-n+p:e>=a&&s>=e?e-a+l:e==o?62:e==u?63:-1}},{}],592:[function(e,t,r){function n(e,t,i,a,s,o){var u=Math.floor((t-e)/2)+e,p=s(i,a[u],!0);return 0===p?u:p>0?t-u>1?n(u,t,i,a,s,o):o==r.LEAST_UPPER_BOUND?t<a.length?t:-1:u:u-e>1?n(e,u,i,a,s,o):o==r.LEAST_UPPER_BOUND?u:0>e?-1:e}r.GREATEST_LOWER_BOUND=1,r.LEAST_UPPER_BOUND=2,r.search=function(e,t,i,a){if(0===t.length)return-1;var s=n(-1,t.length,e,t,i,a||r.GREATEST_LOWER_BOUND);if(0>s)return-1;for(;s-1>=0&&0===i(t[s],t[s-1],!0);)--s;return s}},{}],593:[function(e,t,r){function n(e,t){var r=e.generatedLine,n=t.generatedLine,i=e.generatedColumn,s=t.generatedColumn;return n>r||n==r&&s>=i||a.compareByGeneratedPositionsInflated(e,t)<=0}function i(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}var a=e(598);i.prototype.unsortedForEach=function(e,t){this._array.forEach(e,t)},i.prototype.add=function(e){n(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))},i.prototype.toArray=function(){return this._sorted||(this._array.sort(a.compareByGeneratedPositionsInflated),this._sorted=!0),this._array},r.MappingList=i},{598:598}],594:[function(e,t,r){function n(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function i(e,t){return Math.round(e+Math.random()*(t-e))}function a(e,t,r,s){if(s>r){var o=i(r,s),u=r-1;n(e,o,s);for(var p=e[s],l=r;s>l;l++)t(e[l],p)<=0&&(u+=1,n(e,u,l));n(e,u+1,l);var c=u+1;a(e,t,r,c-1),a(e,t,c+1,s)}}r.quickSort=function(e,t){a(e,t,0,e.length-1)}},{}],595:[function(e,t,r){function n(e){var t=e;return"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,""))),null!=t.sections?new s(t):new i(t)}function i(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=o.getArg(t,"version"),n=o.getArg(t,"sources"),i=o.getArg(t,"names",[]),a=o.getArg(t,"sourceRoot",null),s=o.getArg(t,"sourcesContent",null),u=o.getArg(t,"mappings"),l=o.getArg(t,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);n=n.map(o.normalize).map(function(e){return a&&o.isAbsolute(a)&&o.isAbsolute(e)?o.relative(a,e):e}),this._names=p.fromArray(i,!0),this._sources=p.fromArray(n,!0),this.sourceRoot=a,this.sourcesContent=s,this._mappings=u,this.file=l}function a(){this.generatedLine=0,this.generatedColumn=0,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}function s(e){var t=e;"string"==typeof e&&(t=JSON.parse(e.replace(/^\)\]\}'/,"")));var r=o.getArg(t,"version"),i=o.getArg(t,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new p,this._names=new p;var a={line:-1,column:0};this._sections=i.map(function(e){if(e.url)throw new Error("Support for url field in sections not implemented.");var t=o.getArg(e,"offset"),r=o.getArg(t,"line"),i=o.getArg(t,"column");if(r<a.line||r===a.line&&i<a.column)throw new Error("Section offsets must be ordered and non-overlapping.");return a=t,{generatedOffset:{generatedLine:r+1,generatedColumn:i+1},consumer:new n(o.getArg(e,"map"))}})}var o=e(598),u=e(592),p=e(589).ArraySet,l=e(590),c=e(594).quickSort;n.fromSourceMap=function(e){return i.fromSourceMap(e)},n.prototype._version=3,n.prototype.__generatedMappings=null,Object.defineProperty(n.prototype,"_generatedMappings",{get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}}),n.prototype.__originalMappings=null,Object.defineProperty(n.prototype,"_originalMappings",{get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}}),n.prototype._charIsMappingSeparator=function(e,t){var r=e.charAt(t);return";"===r||","===r},n.prototype._parseMappings=function(e,t){throw new Error("Subclasses must implement _parseMappings")},n.GENERATED_ORDER=1,n.ORIGINAL_ORDER=2,n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.prototype.eachMapping=function(e,t,r){var i,a=t||null,s=r||n.GENERATED_ORDER;switch(s){case n.GENERATED_ORDER:i=this._generatedMappings;break;case n.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var u=this.sourceRoot;i.map(function(e){var t=null===e.source?null:this._sources.at(e.source);return null!=t&&null!=u&&(t=o.join(u,t)),{source:t,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}},this).forEach(e,a)},n.prototype.allGeneratedPositionsFor=function(e){var t=o.getArg(e,"line"),r={source:o.getArg(e,"source"),originalLine:t,originalColumn:o.getArg(e,"column",0)};if(null!=this.sourceRoot&&(r.source=o.relative(this.sourceRoot,r.source)),!this._sources.has(r.source))return[];r.source=this._sources.indexOf(r.source);var n=[],i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,u.LEAST_UPPER_BOUND);if(i>=0){var a=this._originalMappings[i];if(void 0===e.column)for(var s=a.originalLine;a&&a.originalLine===s;)n.push({line:o.getArg(a,"generatedLine",null),column:o.getArg(a,"generatedColumn",null),lastColumn:o.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++i];else for(var p=a.originalColumn;a&&a.originalLine===t&&a.originalColumn==p;)n.push({line:o.getArg(a,"generatedLine",null),column:o.getArg(a,"generatedColumn",null),lastColumn:o.getArg(a,"lastGeneratedColumn",null)}),a=this._originalMappings[++i]}return n},r.SourceMapConsumer=n,i.prototype=Object.create(n.prototype),i.prototype.consumer=n,i.fromSourceMap=function(e){var t=Object.create(i.prototype),r=t._names=p.fromArray(e._names.toArray(),!0),n=t._sources=p.fromArray(e._sources.toArray(),!0);t.sourceRoot=e._sourceRoot,t.sourcesContent=e._generateSourcesContent(t._sources.toArray(),t.sourceRoot),t.file=e._file;for(var s=e._mappings.toArray().slice(),u=t.__generatedMappings=[],l=t.__originalMappings=[],f=0,d=s.length;d>f;f++){var h=s[f],m=new a;m.generatedLine=h.generatedLine,m.generatedColumn=h.generatedColumn,h.source&&(m.source=n.indexOf(h.source),m.originalLine=h.originalLine,m.originalColumn=h.originalColumn,h.name&&(m.name=r.indexOf(h.name)),l.push(m)),u.push(m)}return c(t.__originalMappings,o.compareByOriginalPositions),t},i.prototype._version=3,Object.defineProperty(i.prototype,"sources",{get:function(){return this._sources.toArray().map(function(e){return null!=this.sourceRoot?o.join(this.sourceRoot,e):e},this)}}),i.prototype._parseMappings=function(e,t){for(var r,n,i,s,u,p=1,f=0,d=0,h=0,m=0,y=0,g=e.length,v=0,b={},E={},x=[],S=[];g>v;)if(";"===e.charAt(v))p++,v++,f=0;else if(","===e.charAt(v))v++;else{for(r=new a,r.generatedLine=p,s=v;g>s&&!this._charIsMappingSeparator(e,s);s++);if(n=e.slice(v,s),i=b[n])v+=n.length;else{for(i=[];s>v;)l.decode(e,v,E),u=E.value,v=E.rest,i.push(u);if(2===i.length)throw new Error("Found a source, but no line and column");if(3===i.length)throw new Error("Found a source and line, but no column");b[n]=i}r.generatedColumn=f+i[0],f=r.generatedColumn,i.length>1&&(r.source=m+i[1],m+=i[1],r.originalLine=d+i[2],d=r.originalLine,r.originalLine+=1,r.originalColumn=h+i[3],h=r.originalColumn,i.length>4&&(r.name=y+i[4],y+=i[4])),S.push(r),"number"==typeof r.originalLine&&x.push(r);
}c(S,o.compareByGeneratedPositionsDeflated),this.__generatedMappings=S,c(x,o.compareByOriginalPositions),this.__originalMappings=x},i.prototype._findMapping=function(e,t,r,n,i,a){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[n]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[n]);return u.search(e,t,i,a)},i.prototype.computeColumnSpans=function(){for(var e=0;e<this._generatedMappings.length;++e){var t=this._generatedMappings[e];if(e+1<this._generatedMappings.length){var r=this._generatedMappings[e+1];if(t.generatedLine===r.generatedLine){t.lastGeneratedColumn=r.generatedColumn-1;continue}}t.lastGeneratedColumn=1/0}},i.prototype.originalPositionFor=function(e){var t={generatedLine:o.getArg(e,"line"),generatedColumn:o.getArg(e,"column")},r=this._findMapping(t,this._generatedMappings,"generatedLine","generatedColumn",o.compareByGeneratedPositionsDeflated,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(r>=0){var i=this._generatedMappings[r];if(i.generatedLine===t.generatedLine){var a=o.getArg(i,"source",null);null!==a&&(a=this._sources.at(a),null!=this.sourceRoot&&(a=o.join(this.sourceRoot,a)));var s=o.getArg(i,"name",null);return null!==s&&(s=this._names.at(s)),{source:a,line:o.getArg(i,"originalLine",null),column:o.getArg(i,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}},i.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return null==e}):!1},i.prototype.sourceContentFor=function(e,t){if(!this.sourcesContent)return null;if(null!=this.sourceRoot&&(e=o.relative(this.sourceRoot,e)),this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];var r;if(null!=this.sourceRoot&&(r=o.urlParse(this.sourceRoot))){var n=e.replace(/^file:\/\//,"");if("file"==r.scheme&&this._sources.has(n))return this.sourcesContent[this._sources.indexOf(n)];if((!r.path||"/"==r.path)&&this._sources.has("/"+e))return this.sourcesContent[this._sources.indexOf("/"+e)]}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},i.prototype.generatedPositionFor=function(e){var t=o.getArg(e,"source");if(null!=this.sourceRoot&&(t=o.relative(this.sourceRoot,t)),!this._sources.has(t))return{line:null,column:null,lastColumn:null};t=this._sources.indexOf(t);var r={source:t,originalLine:o.getArg(e,"line"),originalColumn:o.getArg(e,"column")},i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",o.compareByOriginalPositions,o.getArg(e,"bias",n.GREATEST_LOWER_BOUND));if(i>=0){var a=this._originalMappings[i];if(a.source===r.source)return{line:o.getArg(a,"generatedLine",null),column:o.getArg(a,"generatedColumn",null),lastColumn:o.getArg(a,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}},r.BasicSourceMapConsumer=i,s.prototype=Object.create(n.prototype),s.prototype.constructor=n,s.prototype._version=3,Object.defineProperty(s.prototype,"sources",{get:function(){for(var e=[],t=0;t<this._sections.length;t++)for(var r=0;r<this._sections[t].consumer.sources.length;r++)e.push(this._sections[t].consumer.sources[r]);return e}}),s.prototype.originalPositionFor=function(e){var t={generatedLine:o.getArg(e,"line"),generatedColumn:o.getArg(e,"column")},r=u.search(t,this._sections,function(e,t){var r=e.generatedLine-t.generatedOffset.generatedLine;return r?r:e.generatedColumn-t.generatedOffset.generatedColumn}),n=this._sections[r];return n?n.consumer.originalPositionFor({line:t.generatedLine-(n.generatedOffset.generatedLine-1),column:t.generatedColumn-(n.generatedOffset.generatedLine===t.generatedLine?n.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}},s.prototype.hasContentsOfAllSources=function(){return this._sections.every(function(e){return e.consumer.hasContentsOfAllSources()})},s.prototype.sourceContentFor=function(e,t){for(var r=0;r<this._sections.length;r++){var n=this._sections[r],i=n.consumer.sourceContentFor(e,!0);if(i)return i}if(t)return null;throw new Error('"'+e+'" is not in the SourceMap.')},s.prototype.generatedPositionFor=function(e){for(var t=0;t<this._sections.length;t++){var r=this._sections[t];if(-1!==r.consumer.sources.indexOf(o.getArg(e,"source"))){var n=r.consumer.generatedPositionFor(e);if(n){var i={line:n.line+(r.generatedOffset.generatedLine-1),column:n.column+(r.generatedOffset.generatedLine===n.line?r.generatedOffset.generatedColumn-1:0)};return i}}}return{line:null,column:null}},s.prototype._parseMappings=function(e,t){this.__generatedMappings=[],this.__originalMappings=[];for(var r=0;r<this._sections.length;r++)for(var n=this._sections[r],i=n.consumer._generatedMappings,a=0;a<i.length;a++){var s=i[a],u=n.consumer._sources.at(s.source);null!==n.consumer.sourceRoot&&(u=o.join(n.consumer.sourceRoot,u)),this._sources.add(u),u=this._sources.indexOf(u);var p=n.consumer._names.at(s.name);this._names.add(p),p=this._names.indexOf(p);var l={source:u,generatedLine:s.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:s.generatedColumn+(n.generatedOffset.generatedLine===s.generatedLine?n.generatedOffset.generatedColumn-1:0),originalLine:s.originalLine,originalColumn:s.originalColumn,name:p};this.__generatedMappings.push(l),"number"==typeof l.originalLine&&this.__originalMappings.push(l)}c(this.__generatedMappings,o.compareByGeneratedPositionsDeflated),c(this.__originalMappings,o.compareByOriginalPositions)},r.IndexedSourceMapConsumer=s},{589:589,590:590,592:592,594:594,598:598}],596:[function(e,t,r){function n(e){e||(e={}),this._file=a.getArg(e,"file",null),this._sourceRoot=a.getArg(e,"sourceRoot",null),this._skipValidation=a.getArg(e,"skipValidation",!1),this._sources=new s,this._names=new s,this._mappings=new o,this._sourcesContents=null}var i=e(590),a=e(598),s=e(589).ArraySet,o=e(593).MappingList;n.prototype._version=3,n.fromSourceMap=function(e){var t=e.sourceRoot,r=new n({file:e.file,sourceRoot:t});return e.eachMapping(function(e){var n={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(n.source=e.source,null!=t&&(n.source=a.relative(t,n.source)),n.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(n.name=e.name)),r.addMapping(n)}),e.sources.forEach(function(t){var n=e.sourceContentFor(t);null!=n&&r.setSourceContent(t,n)}),r},n.prototype.addMapping=function(e){var t=a.getArg(e,"generated"),r=a.getArg(e,"original",null),n=a.getArg(e,"source",null),i=a.getArg(e,"name",null);this._skipValidation||this._validateMapping(t,r,n,i),null==n||this._sources.has(n)||this._sources.add(n),null==i||this._names.has(i)||this._names.add(i),this._mappings.add({generatedLine:t.line,generatedColumn:t.column,originalLine:null!=r&&r.line,originalColumn:null!=r&&r.column,source:n,name:i})},n.prototype.setSourceContent=function(e,t){var r=e;null!=this._sourceRoot&&(r=a.relative(this._sourceRoot,r)),null!=t?(this._sourcesContents||(this._sourcesContents={}),this._sourcesContents[a.toSetString(r)]=t):this._sourcesContents&&(delete this._sourcesContents[a.toSetString(r)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))},n.prototype.applySourceMap=function(e,t,r){var n=t;if(null==t){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');n=e.file}var i=this._sourceRoot;null!=i&&(n=a.relative(i,n));var o=new s,u=new s;this._mappings.unsortedForEach(function(t){if(t.source===n&&null!=t.originalLine){var s=e.originalPositionFor({line:t.originalLine,column:t.originalColumn});null!=s.source&&(t.source=s.source,null!=r&&(t.source=a.join(r,t.source)),null!=i&&(t.source=a.relative(i,t.source)),t.originalLine=s.line,t.originalColumn=s.column,null!=s.name&&(t.name=s.name))}var p=t.source;null==p||o.has(p)||o.add(p);var l=t.name;null==l||u.has(l)||u.add(l)},this),this._sources=o,this._names=u,e.sources.forEach(function(t){var n=e.sourceContentFor(t);null!=n&&(null!=r&&(t=a.join(r,t)),null!=i&&(t=a.relative(i,t)),this.setSourceContent(t,n))},this)},n.prototype._validateMapping=function(e,t,r,n){if((!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0)||t||r||n)&&!(e&&"line"in e&&"column"in e&&t&&"line"in t&&"column"in t&&e.line>0&&e.column>=0&&t.line>0&&t.column>=0&&r))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:t,name:n}))},n.prototype._serializeMappings=function(){for(var e,t,r,n=0,s=1,o=0,u=0,p=0,l=0,c="",f=this._mappings.toArray(),d=0,h=f.length;h>d;d++){if(e=f[d],e.generatedLine!==s)for(n=0;e.generatedLine!==s;)c+=";",s++;else if(d>0){if(!a.compareByGeneratedPositionsInflated(e,f[d-1]))continue;c+=","}c+=i.encode(e.generatedColumn-n),n=e.generatedColumn,null!=e.source&&(r=this._sources.indexOf(e.source),c+=i.encode(r-l),l=r,c+=i.encode(e.originalLine-1-u),u=e.originalLine-1,c+=i.encode(e.originalColumn-o),o=e.originalColumn,null!=e.name&&(t=this._names.indexOf(e.name),c+=i.encode(t-p),p=t))}return c},n.prototype._generateSourcesContent=function(e,t){return e.map(function(e){if(!this._sourcesContents)return null;null!=t&&(e=a.relative(t,e));var r=a.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,r)?this._sourcesContents[r]:null},this)},n.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e},n.prototype.toString=function(){return JSON.stringify(this.toJSON())},r.SourceMapGenerator=n},{589:589,590:590,593:593,598:598}],597:[function(e,t,r){function n(e,t,r,n,i){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==t?null:t,this.source=null==r?null:r,this.name=null==i?null:i,this[u]=!0,null!=n&&this.add(n)}var i=e(596).SourceMapGenerator,a=e(598),s=/(\r?\n)/,o=10,u="$$$isSourceNode$$$";n.fromStringWithSourceMap=function(e,t,r){function i(e,t){if(null===e||void 0===e.source)o.add(t);else{var i=r?a.join(r,e.source):e.source;o.add(new n(e.originalLine,e.originalColumn,i,t,e.name))}}var o=new n,u=e.split(s),p=function(){var e=u.shift(),t=u.shift()||"";return e+t},l=1,c=0,f=null;return t.eachMapping(function(e){if(null!==f){if(!(l<e.generatedLine)){var t=u[0],r=t.substr(0,e.generatedColumn-c);return u[0]=t.substr(e.generatedColumn-c),c=e.generatedColumn,i(f,r),void(f=e)}i(f,p()),l++,c=0}for(;l<e.generatedLine;)o.add(p()),l++;if(c<e.generatedColumn){var t=u[0];o.add(t.substr(0,e.generatedColumn)),u[0]=t.substr(e.generatedColumn),c=e.generatedColumn}f=e},this),u.length>0&&(f&&i(f,p()),o.add(u.join(""))),t.sources.forEach(function(e){var n=t.sourceContentFor(e);null!=n&&(null!=r&&(e=a.join(r,e)),o.setSourceContent(e,n))}),o},n.prototype.add=function(e){if(Array.isArray(e))e.forEach(function(e){this.add(e)},this);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this},n.prototype.prepend=function(e){if(Array.isArray(e))for(var t=e.length-1;t>=0;t--)this.prepend(e[t]);else{if(!e[u]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this},n.prototype.walk=function(e){for(var t,r=0,n=this.children.length;n>r;r++)t=this.children[r],t[u]?t.walk(e):""!==t&&e(t,{source:this.source,line:this.line,column:this.column,name:this.name})},n.prototype.join=function(e){var t,r,n=this.children.length;if(n>0){for(t=[],r=0;n-1>r;r++)t.push(this.children[r]),t.push(e);t.push(this.children[r]),this.children=t}return this},n.prototype.replaceRight=function(e,t){var r=this.children[this.children.length-1];return r[u]?r.replaceRight(e,t):"string"==typeof r?this.children[this.children.length-1]=r.replace(e,t):this.children.push("".replace(e,t)),this},n.prototype.setSourceContent=function(e,t){this.sourceContents[a.toSetString(e)]=t},n.prototype.walkSourceContents=function(e){for(var t=0,r=this.children.length;r>t;t++)this.children[t][u]&&this.children[t].walkSourceContents(e);for(var n=Object.keys(this.sourceContents),t=0,r=n.length;r>t;t++)e(a.fromSetString(n[t]),this.sourceContents[n[t]])},n.prototype.toString=function(){var e="";return this.walk(function(t){e+=t}),e},n.prototype.toStringWithSourceMap=function(e){var t={code:"",line:1,column:0},r=new i(e),n=!1,a=null,s=null,u=null,p=null;return this.walk(function(e,i){t.code+=e,null!==i.source&&null!==i.line&&null!==i.column?((a!==i.source||s!==i.line||u!==i.column||p!==i.name)&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name}),a=i.source,s=i.line,u=i.column,p=i.name,n=!0):n&&(r.addMapping({generated:{line:t.line,column:t.column}}),a=null,n=!1);for(var l=0,c=e.length;c>l;l++)e.charCodeAt(l)===o?(t.line++,t.column=0,l+1===c?(a=null,n=!1):n&&r.addMapping({source:i.source,original:{line:i.line,column:i.column},generated:{line:t.line,column:t.column},name:i.name})):t.column++}),this.walkSourceContents(function(e,t){r.setSourceContent(e,t)}),{code:t.code,map:r}},r.SourceNode=n},{596:596,598:598}],598:[function(e,t,r){function n(e,t,r){if(t in e)return e[t];if(3===arguments.length)return r;throw new Error('"'+t+'" is a required argument.')}function i(e){var t=e.match(m);return t?{scheme:t[1],auth:t[2],host:t[3],port:t[4],path:t[5]}:null}function a(e){var t="";return e.scheme&&(t+=e.scheme+":"),t+="//",e.auth&&(t+=e.auth+"@"),e.host&&(t+=e.host),e.port&&(t+=":"+e.port),e.path&&(t+=e.path),t}function s(e){var t=e,n=i(e);if(n){if(!n.path)return e;t=n.path}for(var s,o=r.isAbsolute(t),u=t.split(/\/+/),p=0,l=u.length-1;l>=0;l--)s=u[l],"."===s?u.splice(l,1):".."===s?p++:p>0&&(""===s?(u.splice(l+1,p),p=0):(u.splice(l,2),p--));return t=u.join("/"),""===t&&(t=o?"/":"."),n?(n.path=t,a(n)):t}function o(e,t){""===e&&(e="."),""===t&&(t=".");var r=i(t),n=i(e);if(n&&(e=n.path||"/"),r&&!r.scheme)return n&&(r.scheme=n.scheme),a(r);if(r||t.match(y))return t;if(n&&!n.host&&!n.path)return n.host=t,a(n);var o="/"===t.charAt(0)?t:s(e.replace(/\/+$/,"")+"/"+t);return n?(n.path=o,a(n)):o}function u(e,t){""===e&&(e="."),e=e.replace(/\/$/,"");for(var r=0;0!==t.indexOf(e+"/");){var n=e.lastIndexOf("/");if(0>n)return t;if(e=e.slice(0,n),e.match(/^([^\/]+:\/)?\/*$/))return t;++r}return Array(r+1).join("../")+t.substr(e.length+1)}function p(e){return"$"+e}function l(e){return e.substr(1)}function c(e,t,r){var n=e.source-t.source;return 0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n||r?n:(n=e.generatedColumn-t.generatedColumn,0!==n?n:(n=e.generatedLine-t.generatedLine,0!==n?n:e.name-t.name))))}function f(e,t,r){var n=e.generatedLine-t.generatedLine;return 0!==n?n:(n=e.generatedColumn-t.generatedColumn,0!==n||r?n:(n=e.source-t.source,0!==n?n:(n=e.originalLine-t.originalLine,0!==n?n:(n=e.originalColumn-t.originalColumn,0!==n?n:e.name-t.name))))}function d(e,t){return e===t?0:e>t?1:-1}function h(e,t){var r=e.generatedLine-t.generatedLine;return 0!==r?r:(r=e.generatedColumn-t.generatedColumn,0!==r?r:(r=d(e.source,t.source),0!==r?r:(r=e.originalLine-t.originalLine,0!==r?r:(r=e.originalColumn-t.originalColumn,0!==r?r:d(e.name,t.name)))))}r.getArg=n;var m=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/,y=/^data:.+\,.+$/;r.urlParse=i,r.urlGenerate=a,r.normalize=s,r.join=o,r.isAbsolute=function(e){return"/"===e.charAt(0)||!!e.match(m)},r.relative=u,r.toSetString=p,r.fromSetString=l,r.compareByOriginalPositions=c,r.compareByGeneratedPositionsDeflated=f,r.compareByGeneratedPositionsInflated=h},{}],599:[function(e,t,r){r.SourceMapGenerator=e(596).SourceMapGenerator,r.SourceMapConsumer=e(595).SourceMapConsumer,r.SourceNode=e(597).SourceNode},{595:595,596:596,597:597}],600:[function(e,t,r){"use strict";t.exports=function n(e){function t(){}t.prototype=e,new t}},{}],601:[function(e,t,r){"use strict";t.exports=function(e){for(var t=e.length;/[\s\uFEFF\u00A0]/.test(e[t-1]);)t--;return e.slice(0,t)}},{}],602:[function(e,t,r){(function(r){var n,i=e(1),a=t.exports=function(t,r){try{return(r||e).resolve(t)}catch(n){return null}};a.relative=function(e){if("object"==typeof i)return null;n||(n=new i,n.paths=i._nodeModulePaths(r.cwd()));try{return i._resolveFilename(e,n)}catch(t){return null}}}).call(this,e(10))},{1:1,10:10}],603:[function(e,t,r){t.exports={name:"babel-core",version:"5.8.29",description:"A compiler for writing next generation JavaScript",author:"Sebastian McKenzie <sebmck@gmail.com>",homepage:"https://babeljs.io/",license:"MIT",repository:"babel/babel",browser:{"./lib/api/register/node.js":"./lib/api/register/browser.js"},keywords:["6to5","babel","classes","const","es6","harmony","let","modules","transpile","transpiler","var"],scripts:{bench:"make bench",test:"make test"},dependencies:{"babel-plugin-constant-folding":"^1.0.1","babel-plugin-dead-code-elimination":"^1.0.2","babel-plugin-eval":"^1.0.1","babel-plugin-inline-environment-variables":"^1.0.1","babel-plugin-jscript":"^1.0.4","babel-plugin-member-expression-literals":"^1.0.1","babel-plugin-property-literals":"^1.0.1","babel-plugin-proto-to-assign":"^1.0.3","babel-plugin-react-constant-elements":"^1.0.3","babel-plugin-react-display-name":"^1.0.3","babel-plugin-remove-console":"^1.0.1","babel-plugin-remove-debugger":"^1.0.1","babel-plugin-runtime":"^1.0.7","babel-plugin-undeclared-variables-check":"^1.0.2","babel-plugin-undefined-to-void":"^1.1.6",babylon:"^5.8.29",bluebird:"^2.9.33",chalk:"^1.0.0","convert-source-map":"^1.1.0","core-js":"^1.0.0",debug:"^2.1.1","detect-indent":"^3.0.0",esutils:"^2.0.0","fs-readdir-recursive":"^0.1.0",globals:"^6.4.0","home-or-tmp":"^1.0.0","is-integer":"^1.0.4","js-tokens":"1.0.1",json5:"^0.4.0","line-numbers":"0.2.0",lodash:"^3.10.0",minimatch:"^2.0.3","output-file-sync":"^1.1.0","path-exists":"^1.0.0","path-is-absolute":"^1.0.0","private":"^0.1.6",regenerator:"0.8.40",regexpu:"^1.3.0",repeating:"^1.1.2",resolve:"^1.1.6","shebang-regex":"^1.0.0",slash:"^1.0.0","source-map":"^0.5.0","source-map-support":"^0.2.10","to-fast-properties":"^1.0.0","trim-right":"^1.0.0","try-resolve":"^1.0.0"}}},{}],604:[function(e,t,r){t.exports={"abstract-expression-call":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"}]},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-delete":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceDelete"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-get":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceGet"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"}]}}]},"abstract-expression-set":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"PROPERTY"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"referenceSet"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"OBJECT"},{type:"Identifier",name:"VALUE"}]}}]},"array-comprehension-container":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"Identifier",name:"KEY"}}]},parenthesizedExpression:!0},arguments:[]}}]},"array-from":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:!1},arguments:[{type:"Identifier",name:"VALUE"}]}}]},"array-push":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"KEY"},property:{type:"Identifier",name:"push"},computed:!1},arguments:[{type:"Identifier",name:"STATEMENT"}]}}]},call:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"CONTEXT"}]}}]},"class-decorator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"CLASS_REF"},right:{type:"LogicalExpression",left:{type:"CallExpression",callee:{type:"Identifier",name:"DECORATOR"},arguments:[{type:"Identifier",name:"CLASS_REF"}]},operator:"||",right:{type:"Identifier",name:"CLASS_REF"}}}}]},"class-derived-default-constructor":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Super"},arguments:[{type:"SpreadElement",argument:{type:"Identifier",name:"arguments"}}]}}]},parenthesizedExpression:!0}}]},"default-parameter-assign":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"VARIABLE_NAME"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"VARIABLE_NAME"},right:{type:"Identifier",name:"DEFAULT_VALUE"}}},alternate:null}]},"default-parameter":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"length"},computed:!1},operator:"<=",right:{type:"Identifier",name:"ARGUMENT_KEY"}},operator:"||",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"ARGUMENT_KEY"},computed:!0},operator:"===",right:{type:"Identifier",name:"undefined"}}},consequent:{type:"Identifier",name:"DEFAULT_VALUE"},alternate:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"ARGUMENT_KEY"},computed:!0}}}],kind:"let"}]},"exports-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"KEY"},computed:!1},right:{type:"Identifier",name:"VALUE"}}}]},"exports-default-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"module"},property:{type:"Identifier",name:"exports"},computed:!1},right:{type:"Identifier",name:"VALUE"}}}]},"exports-from-assign":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"exports"},{type:"Identifier",name:"ID"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"get"},value:{type:"FunctionExpression",id:{type:"Identifier",name:"get"},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"INIT"}}]}},kind:"init"}]}]}}]},"exports-module-declaration-loose":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"__esModule"},computed:!1},right:{type:"Literal",value:!0}}}]},"exports-module-declaration":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"exports"},{type:"Literal",value:"__esModule"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"Literal",value:!0},kind:"init"}]}]}}]},"for-of-array":{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"KEY"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"ARR"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"KEY"}},body:{type:"ExpressionStatement",expression:{type:"Identifier",name:"BODY"}}}]},"for-of-loose":{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"LOOP_OBJECT"},init:{type:"Identifier",name:"OBJECT"}},{type:"VariableDeclarator",id:{type:"Identifier",name:"IS_ARRAY"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"LOOP_OBJECT"}]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"INDEX"},init:{type:"Literal",value:0}},{type:"VariableDeclarator",id:{type:"Identifier",name:"LOOP_OBJECT"},init:{type:"ConditionalExpression",test:{type:"Identifier",name:"IS_ARRAY"},consequent:{type:"Identifier",name:"LOOP_OBJECT"},alternate:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}}}],kind:"var"},test:null,update:null,body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ID"},init:null}],kind:"var"},{type:"IfStatement",test:{type:"Identifier",name:"IS_ARRAY"},consequent:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"INDEX"},operator:">=",right:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"Identifier",name:"length"},computed:!1}},consequent:{type:"BreakStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ID"},right:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"INDEX"}},computed:!0}}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"INDEX"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"LOOP_OBJECT"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]}}},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"INDEX"},property:{type:"Identifier",name:"done"},computed:!1},consequent:{type:"BreakStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ID"},right:{type:"MemberExpression",object:{type:"Identifier",name:"INDEX"},property:{type:"Identifier",name:"value"},computed:!1}}}]}}]}}]},"for-of":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_COMPLETION"},init:{type:"Literal",value:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_HAD_ERROR_KEY"},init:{type:"Literal",value:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_ERROR_KEY"},init:{type:"Identifier",name:"undefined"}}],kind:"var"},{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"ITERATOR_KEY"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"OBJECT"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"STEP_KEY"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_COMPLETION"},right:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"STEP_KEY"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]},parenthesizedExpression:!0},property:{type:"Identifier",name:"done"},computed:!1},parenthesizedExpression:!0}},update:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_COMPLETION"},right:{type:"Literal",value:!0}},body:{type:"BlockStatement",body:[]}}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"err"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_HAD_ERROR_KEY"},right:{type:"Literal",value:!0}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"ITERATOR_ERROR_KEY"},right:{type:"Identifier",name:"err"}}}]}},guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"Identifier",name:"ITERATOR_COMPLETION"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{type:"Literal",value:"return"},computed:!0}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"ITERATOR_KEY"},property:{
type:"Literal",value:"return"},computed:!0},arguments:[]}}]},alternate:null}]},handler:null,guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"ITERATOR_HAD_ERROR_KEY"},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"Identifier",name:"ITERATOR_ERROR_KEY"}}]},alternate:null}]}}]}}]},"helper-async-to-generator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"fn"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"gen"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"fn"},property:{type:"Identifier",name:"apply"},computed:!1},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}],kind:"var"},{type:"ReturnStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"Promise"},arguments:[{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"resolve"},{type:"Identifier",name:"reject"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"callNext"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"step"},property:{type:"Identifier",name:"bind"},computed:!1},arguments:[{type:"Literal",value:null,rawValue:null},{type:"Literal",value:"next"}]}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"callThrow"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"step"},property:{type:"Identifier",name:"bind"},computed:!1},arguments:[{type:"Literal",value:null,rawValue:null},{type:"Literal",value:"throw"}]}}],kind:"var"},{type:"FunctionDeclaration",id:{type:"Identifier",name:"step"},generator:!1,expression:!1,params:[{type:"Identifier",name:"key"},{type:"Identifier",name:"arg"}],body:{type:"BlockStatement",body:[{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"info"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"gen"},property:{type:"Identifier",name:"key"},computed:!0},arguments:[{type:"Identifier",name:"arg"}]}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"value"},init:{type:"MemberExpression",object:{type:"Identifier",name:"info"},property:{type:"Identifier",name:"value"},computed:!1}}],kind:"var"}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"error"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"reject"},arguments:[{type:"Identifier",name:"error"}]}},{type:"ReturnStatement",argument:null}]}},guardedHandlers:[],finalizer:null},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"info"},property:{type:"Identifier",name:"done"},computed:!1},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"resolve"},arguments:[{type:"Identifier",name:"value"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Promise"},property:{type:"Identifier",name:"resolve"},computed:!1},arguments:[{type:"Identifier",name:"value"}]},property:{type:"Identifier",name:"then"},computed:!1},arguments:[{type:"Identifier",name:"callNext"},{type:"Identifier",name:"callThrow"}]}}]}}]}},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"callNext"},arguments:[]}}]}}]}}]}}}]},parenthesizedExpression:!0}}]},"helper-bind":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Function"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"bind"},computed:!1}}]},"helper-class-call-check":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"instance"},{type:"Identifier",name:"Constructor"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"BinaryExpression",left:{type:"Identifier",name:"instance"},operator:"instanceof",right:{type:"Identifier",name:"Constructor"},parenthesizedExpression:!0}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Cannot call a class as a function"}]}}]},alternate:null}]},parenthesizedExpression:!0}}]},"helper-create-class":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"defineProperties"},generator:!1,expression:!1,params:[{type:"Identifier",name:"target"},{type:"Identifier",name:"props"}],body:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},right:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},operator:"||",right:{type:"Literal",value:!1}}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"configurable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"descriptor"}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"writable"},computed:!1},right:{type:"Literal",value:!0}}},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1},{type:"Identifier",name:"descriptor"}]}}]}}]}},{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"protoProps"},{type:"Identifier",name:"staticProps"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"protoProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"prototype"},computed:!1},{type:"Identifier",name:"protoProps"}]}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"staticProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"staticProps"}]}},alternate:null},{type:"ReturnStatement",argument:{type:"Identifier",name:"Constructor"}}]}}}]},parenthesizedExpression:!0},arguments:[]}}]},"helper-create-decorated-class":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"defineProperties"},generator:!1,expression:!1,params:[{type:"Identifier",name:"target"},{type:"Identifier",name:"descriptors"},{type:"Identifier",name:"initializers"}],body:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorators"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor",leadingComments:null},property:{type:"Identifier",name:"key"},computed:!1,leadingComments:null},leadingComments:null}},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},right:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},operator:"||",right:{type:"Literal",value:!1}}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"configurable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"descriptor"}},operator:"||",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"writable"},computed:!1},right:{type:"Literal",value:!0}}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"decorators"},consequent:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"f"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"f"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"f"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorator"},init:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"f"},computed:!0}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}},operator:"===",right:{type:"Literal",value:"function"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"descriptor"},right:{type:"LogicalExpression",left:{type:"CallExpression",callee:{type:"Identifier",name:"decorator"},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]},operator:"||",right:{type:"Identifier",name:"descriptor"}}}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"The decorator for method "},operator:"+",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}},operator:"+",right:{type:"Literal",value:" is of the invalid type "}},operator:"+",right:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}}}]}}]}}]}},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},operator:"!==",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"initializers"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"Identifier",name:"descriptor"}}},{type:"ContinueStatement",label:null}]},alternate:null}]},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]}}]}}]}},{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"protoProps"},{type:"Identifier",name:"staticProps"},{type:"Identifier",name:"protoInitializers"},{type:"Identifier",name:"staticInitializers"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"protoProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"Constructor"},property:{type:"Identifier",name:"prototype"},computed:!1},{type:"Identifier",name:"protoProps"},{type:"Identifier",name:"protoInitializers"}]}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"staticProps"},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"defineProperties"},arguments:[{type:"Identifier",name:"Constructor"},{type:"Identifier",name:"staticProps"},{type:"Identifier",name:"staticInitializers"}]}},alternate:null},{type:"ReturnStatement",argument:{type:"Identifier",name:"Constructor"}}]}}}]},parenthesizedExpression:!0},arguments:[]}}]},"helper-create-decorated-object":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"descriptors"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"target"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorators"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor",leadingComments:null},property:{type:"Identifier",name:"key"},computed:!1,leadingComments:null},leadingComments:null}},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"decorators"},computed:!1}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"enumerable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"configurable"},computed:!1},right:{type:"Literal",value:!0}}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"descriptor"}},operator:"||",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"writable"},computed:!1},right:{type:"Literal",value:!0}}},alternate:null},{type:"IfStatement",test:{type:"Identifier",name:"decorators"},consequent:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"f"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"f"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"f"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"decorator"},init:{type:"MemberExpression",object:{type:"Identifier",name:"decorators"},property:{type:"Identifier",name:"f"},computed:!0}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}},operator:"===",right:{type:"Literal",value:"function"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"descriptor"},right:{type:"LogicalExpression",left:{type:"CallExpression",callee:{type:"Identifier",name:"decorator"},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]},operator:"||",right:{type:"Identifier",name:"descriptor"}}}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"The decorator for method "},operator:"+",right:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"key"},computed:!1}},operator:"+",right:{type:"Literal",value:" is of the invalid type "}},operator:"+",right:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"decorator"}}}]}}]}}]}}]},alternate:null},{type:"IfStatement",test:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"value"},computed:!1},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"target"}]}}}]},alternate:null},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]},parenthesizedExpression:!0}}]},"helper-default-props":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"defaultProps"},{type:"Identifier",name:"props"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"defaultProps"},consequent:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"propName"},init:null}],kind:"var"},right:{type:"Identifier",name:"defaultProps"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"propName"},computed:!0}},operator:"===",right:{type:"Literal",value:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"props"},property:{type:"Identifier",name:"propName"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"defaultProps"},property:{type:"Identifier",name:"propName"},computed:!0}}}]},alternate:null}]}}]},alternate:null},{type:"ReturnStatement",argument:{type:"Identifier",name:"props"}}]},parenthesizedExpression:!0}}]},"helper-defaults":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"defaults"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"keys"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyNames"},computed:!1},arguments:[{type:"Identifier",name:"defaults"}]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"value"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyDescriptor"},computed:!1},arguments:[{type:"Identifier",name:"defaults"},{type:"Identifier",name:"key"}]}}],kind:"var"},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"Identifier",name:"value"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"value"},property:{type:"Identifier",name:"configurable"},computed:!1}},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:!0},operator:"===",right:{type:"Identifier",name:"undefined"}}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"Identifier",name:"value"}]}}]},alternate:null}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},parenthesizedExpression:!0}}]},"helper-define-decorated-property-descriptor":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptors"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_descriptor"},init:{type:"MemberExpression",object:{type:"Identifier",name:"descriptors"},property:{type:"Identifier",name:"key"},computed:!0}}],kind:"var"},{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"Identifier",name:"_descriptor"}},consequent:{type:"ReturnStatement",argument:null,leadingComments:null,trailingComments:null},alternate:null},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"descriptor",leadingComments:null},init:{type:"ObjectExpression",properties:[]},leadingComments:null}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_key"},init:null}],kind:"var"},right:{type:"Identifier",name:"_descriptor"},body:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"_key"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"_descriptor"},property:{type:"Identifier",name:"_key"},computed:!0}},trailingComments:null}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor",leadingComments:null},property:{type:"Identifier",name:"value"},computed:!1,leadingComments:null},right:{type:"ConditionalExpression",test:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},consequent:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"descriptor"},property:{type:"Identifier",name:"initializer"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"target"}]},alternate:{type:"Identifier",name:"undefined"}},leadingComments:null}},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"target"},{type:"Identifier",name:"key"},{type:"Identifier",name:"descriptor"}]}}]},parenthesizedExpression:!0}}]},"helper-define-property":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"Identifier",name:"value"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"key",leadingComments:null},operator:"in",right:{type:"Identifier",name:"obj"},leadingComments:null},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperty"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"value"},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:!0},kind:"init"}]}]}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"Identifier",name:"value"
}}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},parenthesizedExpression:!0}}]},"helper-extends":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"LogicalExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"assign"},computed:!1},operator:"||",right:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"target"}],body:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:1}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"arguments"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"source"},init:{type:"MemberExpression",object:{type:"Identifier",name:"arguments"},property:{type:"Identifier",name:"i"},computed:!0}}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:null}],kind:"var"},right:{type:"Identifier",name:"source"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"source"},{type:"Identifier",name:"key"}]},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"target"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"source"},property:{type:"Identifier",name:"key"},computed:!0}}}]},alternate:null}]}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]}}}}]},"helper-get":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:{type:"Identifier",name:"get"},generator:!1,expression:!1,params:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"},{type:"Identifier",name:"receiver"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"object"},operator:"===",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"object"},right:{type:"MemberExpression",object:{type:"Identifier",name:"Function"},property:{type:"Identifier",name:"prototype"},computed:!1}}},alternate:null},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"desc"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyDescriptor"},computed:!1},arguments:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"desc"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"parent"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getPrototypeOf"},computed:!1},arguments:[{type:"Identifier",name:"object"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"parent"},operator:"===",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"undefined"}}]},alternate:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"Identifier",name:"get"},arguments:[{type:"Identifier",name:"parent"},{type:"Identifier",name:"property"},{type:"Identifier",name:"receiver"}]}}]}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"desc"}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"value"},computed:!1}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"getter"},init:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"get"},computed:!1}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"getter"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"undefined"}}]},alternate:null},{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"getter"},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"receiver"}]}}]}}}]},parenthesizedExpression:!0}}]},"helper-has-own":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1}}]},"helper-inherits":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"subClass"},{type:"Identifier",name:"superClass"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"superClass"}},operator:"!==",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"BinaryExpression",left:{type:"Identifier",name:"superClass"},operator:"!==",right:{type:"Literal",value:null,rawValue:null}}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"BinaryExpression",left:{type:"Literal",value:"Super expression must either be null or a function, not "},operator:"+",right:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"superClass"}}}]}}]},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"subClass"},property:{type:"Identifier",name:"prototype"},computed:!1},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"create"},computed:!1},arguments:[{type:"LogicalExpression",left:{type:"Identifier",name:"superClass"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"superClass"},property:{type:"Identifier",name:"prototype"},computed:!1}},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"constructor"},value:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"Identifier",name:"subClass"},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"enumerable"},value:{type:"Literal",value:!1},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"writable"},value:{type:"Literal",value:!0},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"configurable"},value:{type:"Literal",value:!0},kind:"init"}]},kind:"init"}]}]}}},{type:"IfStatement",test:{type:"Identifier",name:"superClass"},consequent:{type:"ExpressionStatement",expression:{type:"ConditionalExpression",test:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"setPrototypeOf"},computed:!1},consequent:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"setPrototypeOf"},computed:!1},arguments:[{type:"Identifier",name:"subClass"},{type:"Identifier",name:"superClass"}]},alternate:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"subClass"},property:{type:"Identifier",name:"__proto__"},computed:!1},right:{type:"Identifier",name:"superClass"}}}},alternate:null}]},parenthesizedExpression:!0}}]},"helper-instanceof":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"left"},{type:"Identifier",name:"right"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Identifier",name:"right"},operator:"!=",right:{type:"Literal",value:null,rawValue:null}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"right"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"hasInstance"},computed:!1},computed:!0}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"right"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"hasInstance"},computed:!1},computed:!0},arguments:[{type:"Identifier",name:"left"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"BinaryExpression",left:{type:"Identifier",name:"left"},operator:"instanceof",right:{type:"Identifier",name:"right"}}}]}}]},parenthesizedExpression:!0}}]},"helper-interop-export-wildcard":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"defaults"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"newObj"},init:{type:"CallExpression",callee:{type:"Identifier",name:"defaults"},arguments:[{type:"ObjectExpression",properties:[]},{type:"Identifier",name:"obj"}]}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"UnaryExpression",operator:"delete",prefix:!0,argument:{type:"MemberExpression",object:{type:"Identifier",name:"newObj"},property:{type:"Literal",value:"default"},computed:!0}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"newObj"}}]},parenthesizedExpression:!0}}]},"helper-interop-require-default":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"__esModule"},computed:!1}},consequent:{type:"Identifier",name:"obj"},alternate:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Literal",value:"default"},value:{type:"Identifier",name:"obj"},kind:"init"}]}}}]},parenthesizedExpression:!0}}]},"helper-interop-require-wildcard":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"__esModule"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"obj"}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"newObj"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"obj"},operator:"!=",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"BlockStatement",body:[{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"key"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"key"}]},consequent:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"newObj"},property:{type:"Identifier",name:"key"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"key"},computed:!0}}},alternate:null}]}}]},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"newObj"},property:{type:"Literal",value:"default"},computed:!0},right:{type:"Identifier",name:"obj"}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"newObj"}}]}}]},parenthesizedExpression:!0}}]},"helper-interop-require":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"__esModule"},computed:!1}},consequent:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Literal",value:"default"},computed:!0},alternate:{type:"Identifier",name:"obj"}}}]},parenthesizedExpression:!0}}]},"helper-new-arrow-check":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"innerThis"},{type:"Identifier",name:"boundThis"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"innerThis"},operator:"!==",right:{type:"Identifier",name:"boundThis"}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Cannot instantiate an arrow function"}]}}]},alternate:null}]},parenthesizedExpression:!0}}]},"helper-object-destructuring-empty":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"obj"},operator:"==",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Cannot destructure undefined"}]}},alternate:null}]},parenthesizedExpression:!0}}]},"helper-object-without-properties":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"keys"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"target"},init:{type:"ObjectExpression",properties:[]}}],kind:"var"},{type:"ForInStatement",left:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:null}],kind:"var"},right:{type:"Identifier",name:"obj"},body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"keys"},property:{type:"Identifier",name:"indexOf"},computed:!1},arguments:[{type:"Identifier",name:"i"}]},operator:">=",right:{type:"Literal",value:0}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"IfStatement",test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"hasOwnProperty"},computed:!1},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"obj"},{type:"Identifier",name:"i"}]}},consequent:{type:"ContinueStatement",label:null},alternate:null},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"target"},property:{type:"Identifier",name:"i"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"i"},computed:!0}}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"target"}}]},parenthesizedExpression:!0}}]},"helper-self-global":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ConditionalExpression",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"global"}},operator:"===",right:{type:"Literal",value:"undefined"}},consequent:{type:"Identifier",name:"self"},alternate:{type:"Identifier",name:"global"}}}]},"helper-set":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:{type:"Identifier",name:"set"},generator:!1,expression:!1,params:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"},{type:"Identifier",name:"value"},{type:"Identifier",name:"receiver"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"desc"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getOwnPropertyDescriptor"},computed:!1},arguments:[{type:"Identifier",name:"object"},{type:"Identifier",name:"property"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"desc"},operator:"===",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"parent"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"getPrototypeOf"},computed:!1},arguments:[{type:"Identifier",name:"object"}]}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"parent"},operator:"!==",right:{type:"Literal",value:null,rawValue:null}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"set"},arguments:[{type:"Identifier",name:"parent"},{type:"Identifier",name:"property"},{type:"Identifier",name:"value"},{type:"Identifier",name:"receiver"}]}}]},alternate:null}]},alternate:{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"Literal",value:"value"},operator:"in",right:{type:"Identifier",name:"desc"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"writable"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"value"},computed:!1},right:{type:"Identifier",name:"value"}}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"setter"},init:{type:"MemberExpression",object:{type:"Identifier",name:"desc"},property:{type:"Identifier",name:"set"},computed:!1}}],kind:"var"},{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"setter"},operator:"!==",right:{type:"Identifier",name:"undefined"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"setter"},property:{type:"Identifier",name:"call"},computed:!1},arguments:[{type:"Identifier",name:"receiver"},{type:"Identifier",name:"value"}]}}]},alternate:null}]}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"value"}}]},parenthesizedExpression:!0}}]},"helper-slice":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"prototype"},computed:!1},property:{type:"Identifier",name:"slice"},computed:!1}}]},"helper-sliced-to-array-loose":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"arr"}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},operator:"in",right:{type:"CallExpression",callee:{type:"Identifier",name:"Object"},arguments:[{type:"Identifier",name:"arr"}]}},consequent:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_arr"},init:{type:"ArrayExpression",elements:[]}}],kind:"var"},{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_iterator"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"_step"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_step"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_iterator"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]},parenthesizedExpression:!0},property:{type:"Identifier",name:"done"},computed:!1}},update:null,body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"push"},computed:!1},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"_step"},property:{type:"Identifier",name:"value"},computed:!1}]}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"i"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"length"},computed:!1},operator:"===",right:{type:"Identifier",name:"i"}}},consequent:{type:"BreakStatement",label:null},alternate:null}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"_arr"}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Invalid attempt to destructure non-iterable instance"}]}}]}}}]},parenthesizedExpression:!0}}]},"helper-sliced-to-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"sliceIterator",leadingComments:null},generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],body:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_arr",leadingComments:null},init:{type:"ArrayExpression",elements:[]},leadingComments:null}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_n"},init:{type:"Literal",value:!0}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_d"},init:{type:"Literal",value:!1}}],kind:"var"},{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_e"},init:{type:"Identifier",name:"undefined"}}],kind:"var"},{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"_i"},init:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},computed:!0},arguments:[]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"_s"},init:null}],kind:"var"},test:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_n"},right:{type:"MemberExpression",object:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_s"},right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_i"},property:{type:"Identifier",name:"next"},computed:!1},arguments:[]},parenthesizedExpression:!0},property:{type:"Identifier",name:"done"},computed:!1},parenthesizedExpression:!0}},update:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_n"},right:{type:"Literal",value:!0}},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"push"},computed:!1},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"_s"},property:{type:"Identifier",name:"value"},computed:!1}]}},{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"Identifier",name:"i"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"_arr"},property:{type:"Identifier",name:"length"},computed:!1},operator:"===",right:{type:"Identifier",name:"i"}}},consequent:{type:"BreakStatement",label:null},alternate:null}]}}]},handler:{type:"CatchClause",param:{type:"Identifier",name:"err"},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_d"},right:{type:"Literal",value:!0}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"Identifier",name:"_e"},right:{type:"Identifier",name:"err"}}}]}},guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"TryStatement",block:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"UnaryExpression",operator:"!",prefix:!0,argument:{type:"Identifier",name:"_n"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"_i"},property:{type:"Literal",value:"return"},computed:!0}},consequent:{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"_i"},property:{type:"Literal",value:"return"},computed:!0},arguments:[]}},alternate:null}]},handler:null,guardedHandlers:[],finalizer:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"Identifier",name:"_d"},consequent:{type:"ThrowStatement",argument:{type:"Identifier",name:"_e"}},alternate:null}]}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"_arr"}}]}},{type:"ReturnStatement",argument:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"arr"}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Identifier",name:"iterator"},computed:!1},operator:"in",right:{type:"CallExpression",callee:{type:"Identifier",name:"Object"},arguments:[{type:"Identifier",name:"arr"}]}},consequent:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"Identifier",name:"sliceIterator"},arguments:[{type:"Identifier",name:"arr"},{type:"Identifier",name:"i"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"TypeError"},arguments:[{type:"Literal",value:"Invalid attempt to destructure non-iterable instance"}]}}]}}}]}}}]},parenthesizedExpression:!0},arguments:[]}}]},"helper-tagged-template-literal-loose":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"strings"},{type:"Identifier",name:"raw"}],body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"strings"},property:{type:"Identifier",name:"raw"},computed:!1},right:{type:"Identifier",name:"raw"}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"strings"}}]},parenthesizedExpression:!0}}]},"helper-tagged-template-literal":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"strings"},{type:"Identifier",name:"raw"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",
argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"freeze"},computed:!1},arguments:[{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"defineProperties"},computed:!1},arguments:[{type:"Identifier",name:"strings"},{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"raw"},value:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"value"},value:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Object"},property:{type:"Identifier",name:"freeze"},computed:!1},arguments:[{type:"Identifier",name:"raw"}]},kind:"init"}]},kind:"init"}]}]}]}}]},parenthesizedExpression:!0}}]},"helper-temporal-assert-defined":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"val"},{type:"Identifier",name:"name"},{type:"Identifier",name:"undef"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"Identifier",name:"val"},operator:"===",right:{type:"Identifier",name:"undef"}},consequent:{type:"BlockStatement",body:[{type:"ThrowStatement",argument:{type:"NewExpression",callee:{type:"Identifier",name:"ReferenceError"},arguments:[{type:"BinaryExpression",left:{type:"Identifier",name:"name"},operator:"+",right:{type:"Literal",value:" is not defined - temporal dead zone"}}]}}]},alternate:null},{type:"ReturnStatement",argument:{type:"Literal",value:!0}}]},parenthesizedExpression:!0}}]},"helper-temporal-undefined":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"ObjectExpression",properties:[],parenthesizedExpression:!0}}]},"helper-to-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"Identifier",name:"arr"},alternate:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]}}}]},parenthesizedExpression:!0}}]},"helper-to-consumable-array":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"arr"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"isArray"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]},consequent:{type:"BlockStatement",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"i"},init:{type:"Literal",value:0}},{type:"VariableDeclarator",id:{type:"Identifier",name:"arr2"},init:{type:"CallExpression",callee:{type:"Identifier",name:"Array"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"Identifier",name:"length"},computed:!1}]}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"i"},operator:"<",right:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"Identifier",name:"length"},computed:!1}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"i"}},body:{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"arr2"},property:{type:"Identifier",name:"i"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"arr"},property:{type:"Identifier",name:"i"},computed:!0}}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"arr2"}}]},alternate:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Array"},property:{type:"Identifier",name:"from"},computed:!1},arguments:[{type:"Identifier",name:"arr"}]}}]}}]},parenthesizedExpression:!0}}]},"helper-typeof-react-element":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"Symbol"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Literal",value:"for"},computed:!0}},operator:"&&",right:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"Symbol"},property:{type:"Literal",value:"for"},computed:!0},arguments:[{type:"Literal",value:"react.element"}]}},operator:"||",right:{type:"Literal",value:60103}}}]},"helper-typeof":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"obj"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ConditionalExpression",test:{type:"LogicalExpression",left:{type:"Identifier",name:"obj"},operator:"&&",right:{type:"BinaryExpression",left:{type:"MemberExpression",object:{type:"Identifier",name:"obj"},property:{type:"Identifier",name:"constructor"},computed:!1},operator:"===",right:{type:"Identifier",name:"Symbol"}}},consequent:{type:"Literal",value:"symbol"},alternate:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"obj"}}}}]},parenthesizedExpression:!0}}]},"let-scoping-return":{type:"Program",body:[{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"RETURN"}},operator:"===",right:{type:"Literal",value:"object"}},consequent:{type:"ReturnStatement",argument:{type:"MemberExpression",object:{type:"Identifier",name:"RETURN"},property:{type:"Identifier",name:"v"},computed:!1}},alternate:null}]},"named-function":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"GET_OUTER_ID"},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION_ID"}}]}},{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION"}}]},parenthesizedExpression:!0},arguments:[]}}]},"property-method-assignment-wrapper-generator":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"FUNCTION_KEY"}],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"FUNCTION_ID"},generator:!0,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"YieldExpression",delegate:!0,argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"apply"},computed:!1},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}}]}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_ID"},property:{type:"Identifier",name:"toString"},computed:!1},right:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"toString"},computed:!1},arguments:[]}}]}}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION_ID"}}]},parenthesizedExpression:!0},arguments:[{type:"Identifier",name:"FUNCTION"}]}}]},"property-method-assignment-wrapper":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"FUNCTION_KEY"}],body:{type:"BlockStatement",body:[{type:"FunctionDeclaration",id:{type:"Identifier",name:"FUNCTION_ID"},generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"apply"},computed:!1},arguments:[{type:"ThisExpression"},{type:"Identifier",name:"arguments"}]}}]}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_ID"},property:{type:"Identifier",name:"toString"},computed:!1},right:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"FUNCTION_KEY"},property:{type:"Identifier",name:"toString"},computed:!1},arguments:[]}}]}}}},{type:"ReturnStatement",argument:{type:"Identifier",name:"FUNCTION_ID"}}]},parenthesizedExpression:!0},arguments:[{type:"Identifier",name:"FUNCTION"}]}}]},"prototype-identifier":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"MemberExpression",object:{type:"Identifier",name:"CLASS_NAME"},property:{type:"Identifier",name:"prototype"},computed:!1}}]},"require-assign-key":{type:"Program",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"VARIABLE_NAME"},init:{type:"MemberExpression",object:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]},property:{type:"Identifier",name:"KEY"},computed:!1}}],kind:"var"}]},require:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"require"},arguments:[{type:"Identifier",name:"MODULE_NAME"}]}}]},rest:{type:"Program",body:[{type:"ForStatement",init:{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"LEN"},init:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"length"},computed:!1}},{type:"VariableDeclarator",id:{type:"Identifier",name:"ARRAY"},init:{type:"CallExpression",callee:{type:"Identifier",name:"Array"},arguments:[{type:"Identifier",name:"ARRAY_LEN"}]}},{type:"VariableDeclarator",id:{type:"Identifier",name:"KEY"},init:{type:"Identifier",name:"START"}}],kind:"var"},test:{type:"BinaryExpression",left:{type:"Identifier",name:"KEY"},operator:"<",right:{type:"Identifier",name:"LEN"}},update:{type:"UpdateExpression",operator:"++",prefix:!1,argument:{type:"Identifier",name:"KEY"}},body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"ARRAY"},property:{type:"Identifier",name:"ARRAY_KEY"},computed:!0},right:{type:"MemberExpression",object:{type:"Identifier",name:"ARGUMENTS"},property:{type:"Identifier",name:"KEY"},computed:!0}}}]}}]},"self-contained-helpers-head":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Literal",value:"default"},computed:!0},right:{type:"Identifier",name:"HELPER"}}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"exports"},property:{type:"Identifier",name:"__esModule"},computed:!1},right:{type:"Literal",value:!0}}}]},system:{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"MemberExpression",object:{type:"Identifier",name:"System"},property:{type:"Identifier",name:"register"},computed:!1},arguments:[{type:"Identifier",name:"MODULE_NAME"},{type:"Identifier",name:"MODULE_DEPENDENCIES"},{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"EXPORT_IDENTIFIER"}],body:{type:"BlockStatement",body:[{type:"ReturnStatement",argument:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"setters"},value:{type:"Identifier",name:"SETTERS"},kind:"init"},{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"execute"},value:{type:"Identifier",name:"EXECUTE"},kind:"init"}]}}]}}]}}]},"tail-call-body":{type:"Program",body:[{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"AGAIN_ID"},init:{type:"Literal",value:!0}}],kind:"var"},{type:"LabeledStatement",body:{type:"WhileStatement",test:{type:"Identifier",name:"AGAIN_ID"},body:{type:"ExpressionStatement",expression:{type:"Identifier",name:"BLOCK"}}},label:{type:"Identifier",name:"FUNCTION_ID"}}]}]},"test-exports":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"exports"}},operator:"!==",right:{type:"Literal",value:"undefined"}}}]},"test-module":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"module"}},operator:"!==",right:{type:"Literal",value:"undefined"}}}]},"umd-commonjs-strict":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"root"},{type:"Identifier",name:"factory"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"define"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"define"},property:{type:"Identifier",name:"amd"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"define"},arguments:[{type:"Identifier",name:"AMD_ARGUMENTS"},{type:"Identifier",name:"factory"}]}}]},alternate:{type:"IfStatement",test:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"exports"}},operator:"===",right:{type:"Literal",value:"object"}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"COMMON_ARGUMENTS"}]}}]},alternate:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"BROWSER_ARGUMENTS"}]}}]}}}]},parenthesizedExpression:!0},arguments:[{type:"Identifier",name:"UMD_ROOT"},{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"FACTORY_PARAMETERS"}],body:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"Identifier",name:"FACTORY_BODY"}}]}}]}}]},"umd-runner-body":{type:"Program",body:[{type:"ExpressionStatement",expression:{type:"FunctionExpression",id:null,generator:!1,expression:!1,params:[{type:"Identifier",name:"global"},{type:"Identifier",name:"factory"}],body:{type:"BlockStatement",body:[{type:"IfStatement",test:{type:"LogicalExpression",left:{type:"BinaryExpression",left:{type:"UnaryExpression",operator:"typeof",prefix:!0,argument:{type:"Identifier",name:"define"}},operator:"===",right:{type:"Literal",value:"function"}},operator:"&&",right:{type:"MemberExpression",object:{type:"Identifier",name:"define"},property:{type:"Identifier",name:"amd"},computed:!1}},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"define"},arguments:[{type:"Identifier",name:"AMD_ARGUMENTS"},{type:"Identifier",name:"factory"}]}}]},alternate:{type:"IfStatement",test:{type:"Identifier",name:"COMMON_TEST"},consequent:{type:"BlockStatement",body:[{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"Identifier",name:"COMMON_ARGUMENTS"}]}}]},alternate:{type:"BlockStatement",body:[{type:"VariableDeclaration",declarations:[{type:"VariableDeclarator",id:{type:"Identifier",name:"mod"},init:{type:"ObjectExpression",properties:[{type:"Property",method:!1,shorthand:!1,computed:!1,key:{type:"Identifier",name:"exports"},value:{type:"ObjectExpression",properties:[]},kind:"init"}]}}],kind:"var"},{type:"ExpressionStatement",expression:{type:"CallExpression",callee:{type:"Identifier",name:"factory"},arguments:[{type:"MemberExpression",object:{type:"Identifier",name:"mod"},property:{type:"Identifier",name:"exports"},computed:!1},{type:"Identifier",name:"BROWSER_ARGUMENTS"}]}},{type:"ExpressionStatement",expression:{type:"AssignmentExpression",operator:"=",left:{type:"MemberExpression",object:{type:"Identifier",name:"global"},property:{type:"Identifier",name:"GLOBAL_ARG"},computed:!1},right:{type:"MemberExpression",object:{type:"Identifier",name:"mod"},property:{type:"Identifier",name:"exports"},computed:!1}}}]}}}]},parenthesizedExpression:!0}}]}}},{}],605:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){return new s["default"](t,e).parse()}r.__esModule=!0,r.parse=i;var a=e(609),s=n(a);e(614),e(613),e(611),e(608),e(612),e(610),e(607);var o=e(621);e(619),e(618);var u=e(615),p=n(u),l=e(616),c=n(l);a.plugins.flow=p["default"],a.plugins.jsx=c["default"],r.tokTypes=o.types},{607:607,608:608,609:609,610:610,611:611,612:612,613:613,614:614,615:615,616:616,618:618,619:619,621:621}],606:[function(e,t,r){"use strict";function n(e){var t={};for(var r in i)t[r]=e&&r in e?e[r]:i[r];return t}r.__esModule=!0,r.getOptions=n;var i={sourceType:"script",allowReserved:!0,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,plugins:{},features:{},strictMode:null};r.defaultOptions=i},{}],607:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return e[e.length-1]}var a=e(609),s=n(a),o=s["default"].prototype;o.addComment=function(e){this.state.trailingComments.push(e),this.state.leadingComments.push(e)},o.processComment=function(e){if(!("Program"===e.type&&e.body.length>0)){var t,r,n,a=this.state.commentStack;if(this.state.trailingComments.length>0)this.state.trailingComments[0].start>=e.end?(r=this.state.trailingComments,this.state.trailingComments=[]):this.state.trailingComments.length=0;else{var s=i(a);a.length>0&&s.trailingComments&&s.trailingComments[0].start>=e.end&&(r=s.trailingComments,s.trailingComments=null)}for(;a.length>0&&i(a).start>=e.start;)t=a.pop();if(t){if(t.leadingComments)if(t!==e&&i(t.leadingComments).end<=e.start)e.leadingComments=t.leadingComments,t.leadingComments=null;else for(n=t.leadingComments.length-2;n>=0;--n)if(t.leadingComments[n].end<=e.start){e.leadingComments=t.leadingComments.splice(0,n+1);break}}else if(this.state.leadingComments.length>0)if(i(this.state.leadingComments).end<=e.start)e.leadingComments=this.state.leadingComments,this.state.leadingComments=[];else{for(n=0;n<this.state.leadingComments.length&&!(this.state.leadingComments[n].end>e.start);n++);e.leadingComments=this.state.leadingComments.slice(0,n),0===e.leadingComments.length&&(e.leadingComments=null),r=this.state.leadingComments.slice(n),0===r.length&&(r=null)}r&&(r.length&&r[0].start>=e.start&&i(r).end<=e.end?e.innerComments=r:e.trailingComments=r),a.push(e)}}},{609:609}],608:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(621),a=e(609),s=n(a),o=e(622),u=s["default"].prototype;u.checkPropClash=function(e,t){if(!(e.computed||e.method||e.shorthand)){var r=e.key,n=void 0;switch(r.type){case"Identifier":n=r.name;break;case"Literal":n=String(r.value);break;default:return}var i=e.kind;"__proto__"===n&&"init"===i&&(t.proto&&this.raise(r.start,"Redefinition of __proto__ property"),t.proto=!0)}},u.parseExpression=function(e,t){var r=this.state.start,n=this.state.startLoc,a=this.parseMaybeAssign(e,t);if(this.match(i.types.comma)){var s=this.startNodeAt(r,n);for(s.expressions=[a];this.eat(i.types.comma);)s.expressions.push(this.parseMaybeAssign(e,t));return this.toReferencedList(s.expressions),this.finishNode(s,"SequenceExpression")}return a},u.parseMaybeAssign=function(e,t,r){if(this.match(i.types._yield)&&this.state.inGenerator)return this.parseYield();var n=void 0;t?n=!1:(t={start:0},n=!0);var a=this.state.start,s=this.state.startLoc;(this.match(i.types.parenL)||this.match(i.types.name))&&(this.state.potentialArrowAt=this.state.start);var o=this.parseMaybeConditional(e,t);if(r&&(o=r.call(this,o,a,s)),this.state.type.isAssign){var u=this.startNodeAt(a,s);if(u.operator=this.state.value,u.left=this.match(i.types.eq)?this.toAssignable(o):o,t.start=0,this.checkLVal(o),o.parenthesizedExpression){var p=void 0;"ObjectPattern"===o.type?p="`({a}) = 0` use `({a} = 0)`":"ArrayPattern"===o.type&&(p="`([a]) = 0` use `([a] = 0)`"),p&&this.raise(o.start,"You're trying to assign to a parenthesized expression, eg. instead of "+p)}return this.next(),u.right=this.parseMaybeAssign(e),this.finishNode(u,"AssignmentExpression")}return n&&t.start&&this.unexpected(t.start),o},u.parseMaybeConditional=function(e,t){var r=this.state.start,n=this.state.startLoc,a=this.parseExprOps(e,t);if(t&&t.start)return a;if(this.eat(i.types.question)){var s=this.startNodeAt(r,n);return s.test=a,s.consequent=this.parseMaybeAssign(),this.expect(i.types.colon),s.alternate=this.parseMaybeAssign(e),this.finishNode(s,"ConditionalExpression")}return a},u.parseExprOps=function(e,t){var r=this.state.start,n=this.state.startLoc,i=this.parseMaybeUnary(t);return t&&t.start?i:this.parseExprOp(i,r,n,-1,e)},u.parseExprOp=function(e,t,r,n,a){var s=this.state.type.binop;if(!(null==s||a&&this.match(i.types._in))&&s>n){var o=this.startNodeAt(t,r);o.left=e,o.operator=this.state.value;var u=this.state.type;this.next();var p=this.state.start,l=this.state.startLoc;return o.right=this.parseExprOp(this.parseMaybeUnary(),p,l,u.rightAssociative?s-1:s,a),this.finishNode(o,u===i.types.logicalOR||u===i.types.logicalAND?"LogicalExpression":"BinaryExpression"),this.parseExprOp(o,t,r,n,a)}return e},u.parseMaybeUnary=function(e){if(this.state.type.prefix){var t=this.startNode(),r=this.match(i.types.incDec);return t.operator=this.state.value,t.prefix=!0,this.next(),t.argument=this.parseMaybeUnary(),e&&e.start&&this.unexpected(e.start),r?this.checkLVal(t.argument):this.strict&&"delete"===t.operator&&"Identifier"===t.argument.type&&this.raise(t.start,"Deleting local variable in strict mode"),this.finishNode(t,r?"UpdateExpression":"UnaryExpression")}var n=this.state.start,a=this.state.startLoc,s=this.parseExprSubscripts(e);if(e&&e.start)return s;for(;this.state.type.postfix&&!this.canInsertSemicolon();){var t=this.startNodeAt(n,a);t.operator=this.state.value,t.prefix=!1,t.argument=s,this.checkLVal(s),this.next(),s=this.finishNode(t,"UpdateExpression")}return s},u.parseExprSubscripts=function(e){var t=this.state.start,r=this.state.startLoc,n=this.parseExprAtom(e);return e&&e.start?n:this.parseSubscripts(n,t,r)},u.parseSubscripts=function(e,t,r,n){for(;;){if(!n&&this.eat(i.types.doubleColon)){var a=this.startNodeAt(t,r);return a.object=e,a.callee=this.parseNoCallExpr(),this.parseSubscripts(this.finishNode(a,"BindExpression"),t,r,n)}if(this.eat(i.types.dot)){var a=this.startNodeAt(t,r);a.object=e,a.property=this.parseIdent(!0),a.computed=!1,e=this.finishNode(a,"MemberExpression")}else if(this.eat(i.types.bracketL)){var a=this.startNodeAt(t,r);a.object=e,a.property=this.parseExpression(),a.computed=!0,this.expect(i.types.bracketR),e=this.finishNode(a,"MemberExpression")}else if(!n&&this.match(i.types.parenL)){var s="Identifier"===e.type&&"async"===e.name&&!this.canInsertSemicolon();this.next();var a=this.startNodeAt(t,r);a.callee=e,a.arguments=this.parseExprList(i.types.parenR,this.options.features["es7.trailingFunctionCommas"]),e=this.finishNode(a,"CallExpression"),s&&(this.match(i.types.colon)||this.match(i.types.arrow))?e=this.parseAsyncArrowFromCallExpression(this.startNodeAt(t,r),a):this.toReferencedList(a.arguments)}else{if(!this.match(i.types.backQuote))return e;var a=this.startNodeAt(t,r);a.tag=e,a.quasi=this.parseTemplate(),e=this.finishNode(a,"TaggedTemplateExpression")}}},u.parseAsyncArrowFromCallExpression=function(e,t){return this.options.features["es7.asyncFunctions"]||this.unexpected(),this.expect(i.types.arrow),this.parseArrowExpression(e,t.arguments,!0)},u.parseNoCallExpr=function(){var e=this.state.start,t=this.state.startLoc;return this.parseSubscripts(this.parseExprAtom(),e,t,!0)},u.parseExprAtom=function(e){var t=void 0,r=this.state.potentialArrowAt===this.state.start;switch(this.state.type){case i.types._super:this.state.inFunction||this.raise(this.state.start,"'super' outside of function or class");case i.types._this:var n=this.match(i.types._this)?"ThisExpression":"Super";return t=this.startNode(),this.next(),this.finishNode(t,n);case i.types._yield:this.state.inGenerator&&this.unexpected();case i.types._do:if(this.options.features["es7.doExpressions"]){var a=this.startNode();this.next();var s=this.state.inFunction,o=this.state.labels;return this.state.labels=[],this.state.inFunction=!1,a.body=this.parseBlock(),this.state.inFunction=s,this.state.labels=o,this.finishNode(a,"DoExpression")}case i.types.name:t=this.startNode();var u=this.parseIdent(!0);if(this.options.features["es7.asyncFunctions"])if("await"===u.name){if(this.inAsync)return this.parseAwait(t)}else{if("async"===u.name&&this.match(i.types._function)&&!this.canInsertSemicolon())return this.next(),this.parseFunction(t,!1,!1,!0);if(r&&"async"===u.name&&this.match(i.types.name)){var p=[this.parseIdent()];return this.expect(i.types.arrow),this.parseArrowExpression(t,p,!0)}}return r&&!this.canInsertSemicolon()&&this.eat(i.types.arrow)?this.parseArrowExpression(t,[u]):u;case i.types.regexp:var l=this.state.value;return t=this.parseLiteral(l.value),t.regex={pattern:l.pattern,flags:l.flags},t;case i.types.num:case i.types.string:return this.parseLiteral(this.state.value);case i.types._null:case i.types._true:case i.types._false:return t=this.startNode(),t.rawValue=t.value=this.match(i.types._null)?null:this.match(i.types._true),t.raw=this.state.type.keyword,this.next(),this.finishNode(t,"Literal");case i.types.parenL:return this.parseParenAndDistinguishExpression(null,null,r);case i.types.bracketL:return t=this.startNode(),this.next(),this.options.features["es7.comprehensions"]&&this.match(i.types._for)?this.parseComprehension(t,!1):(t.elements=this.parseExprList(i.types.bracketR,!0,!0,e),this.toReferencedList(t.elements),this.finishNode(t,"ArrayExpression"));case i.types.braceL:return this.parseObj(!1,e);case i.types._function:return t=this.startNode(),this.next(),this.parseFunction(t,!1);case i.types.at:this.parseDecorators();case i.types._class:return t=this.startNode(),this.takeDecorators(t),this.parseClass(t,!1);case i.types._new:return this.parseNew();case i.types.backQuote:return this.parseTemplate();case i.types.doubleColon:t=this.startNode(),this.next(),t.object=null;var c=t.callee=this.parseNoCallExpr();if("MemberExpression"===c.type)return this.finishNode(t,"BindExpression");this.raise(c.start,"Binding should be performed on object property.");default:this.unexpected()}},u.parseLiteral=function(e){var t=this.startNode();return t.rawValue=t.value=e,t.raw=this.input.slice(this.state.start,this.state.end),this.next(),this.finishNode(t,"Literal")},u.parseParenExpression=function(){this.expect(i.types.parenL);var e=this.parseExpression();return this.expect(i.types.parenR),e},u.parseParenAndDistinguishExpression=function(e,t,r,n){e=e||this.state.start,t=t||this.state.startLoc;var a=void 0;if(this.next(),this.options.features["es7.comprehensions"]&&this.match(i.types._for))return this.parseComprehension(this.startNodeAt(e,t),!0);for(var s=this.state.start,o=this.state.startLoc,u=[],p=!0,l={start:0},c=void 0,f=void 0,d=void 0;!this.match(i.types.parenR);){if(p)p=!1;else if(this.expect(i.types.comma),this.match(i.types.parenR)&&this.options.features["es7.trailingFunctionCommas"]){d=this.state.start;break}if(this.match(i.types.ellipsis)){var h=this.state.start,m=this.state.startLoc;c=this.state.start,u.push(this.parseParenItem(this.parseRest(),m,h));break}this.match(i.types.parenL)&&!f&&(f=this.state.start),u.push(this.parseMaybeAssign(!1,l,this.parseParenItem))}var y=this.state.start,g=this.state.startLoc;if(this.expect(i.types.parenR),r&&!this.canInsertSemicolon()&&this.eat(i.types.arrow))return f&&this.unexpected(f),this.parseArrowExpression(this.startNodeAt(e,t),u,n);if(!u.length){if(n)return;this.unexpected(this.state.lastTokStart)}return d&&this.unexpected(d),c&&this.unexpected(c),l.start&&this.unexpected(l.start),u.length>1?(a=this.startNodeAt(s,o),a.expressions=u,this.toReferencedList(a.expressions),this.finishNodeAt(a,"SequenceExpression",y,g)):a=u[0],a.parenthesizedExpression=!0,a},u.parseParenItem=function(e){return e},u.parseNew=function(){var e=this.startNode(),t=this.parseIdent(!0);return this.eat(i.types.dot)?(e.meta=t,e.property=this.parseIdent(!0),"target"!==e.property.name&&this.raise(e.property.start,"The only valid meta property for new is new.target"),this.finishNode(e,"MetaProperty")):(e.callee=this.parseNoCallExpr(),this.eat(i.types.parenL)?(e.arguments=this.parseExprList(i.types.parenR,this.options.features["es7.trailingFunctionCommas"]),this.toReferencedList(e.arguments)):e.arguments=[],this.finishNode(e,"NewExpression"))},u.parseTemplateElement=function(){var e=this.startNode();return e.value={raw:this.input.slice(this.state.start,this.state.end).replace(/\r\n?/g,"\n"),cooked:this.state.value},this.next(),e.tail=this.match(i.types.backQuote),this.finishNode(e,"TemplateElement")},u.parseTemplate=function(){var e=this.startNode();this.next(),e.expressions=[];var t=this.parseTemplateElement();for(e.quasis=[t];!t.tail;)this.expect(i.types.dollarBraceL),e.expressions.push(this.parseExpression()),this.expect(i.types.braceR),e.quasis.push(t=this.parseTemplateElement());return this.next(),this.finishNode(e,"TemplateLiteral")},u.parseObj=function(e,t){var r=this.startNode(),n=!0,a=Object.create(null);r.properties=[];var s=[];for(this.next();!this.eat(i.types.braceR);){if(n)n=!1;else if(this.expect(i.types.comma),this.eat(i.types.braceR))break;for(;this.match(i.types.at);)s.push(this.parseDecorator());var o=this.startNode(),u=!1,p=!1,l=void 0,c=void 0;if(s.length&&(o.decorators=s,s=[]),this.options.features["es7.objectRestSpread"]&&this.match(i.types.ellipsis))o=this.parseSpread(),o.type="SpreadProperty",r.properties.push(o);else{if(o.method=!1,o.shorthand=!1,(e||t)&&(l=this.state.start,c=this.state.startLoc),e||(u=this.eat(i.types.star)),!e&&this.options.features["es7.asyncFunctions"]&&this.isContextual("async")){u&&this.unexpected();
var f=this.parseIdent();this.match(i.types.colon)||this.match(i.types.parenL)||this.match(i.types.braceR)?o.key=f:(p=!0,this.parsePropertyName(o))}else this.parsePropertyName(o);this.parseObjPropValue(o,l,c,u,p,e,t),this.checkPropClash(o,a),r.properties.push(this.finishNode(o,"Property"))}}return s.length&&this.raise(this.state.start,"You have trailing decorators with no property"),this.finishNode(r,e?"ObjectPattern":"ObjectExpression")},u.parseObjPropValue=function(e,t,r,n,a,s,u){if(this.eat(i.types.colon))e.value=s?this.parseMaybeDefault(this.state.start,this.state.startLoc):this.parseMaybeAssign(!1,u),e.kind="init";else if(this.match(i.types.parenL))s&&this.unexpected(),e.kind="init",e.method=!0,e.value=this.parseMethod(n,a);else if(e.computed||"Identifier"!==e.key.type||"get"!==e.key.name&&"set"!==e.key.name||this.match(i.types.comma)||this.match(i.types.braceR))e.computed||"Identifier"!==e.key.type?this.unexpected():(e.kind="init",s?((this.isKeyword(e.key.name)||this.strict&&(o.reservedWords.strictBind(e.key.name)||o.reservedWords.strict(e.key.name))||!this.options.allowReserved&&this.isReservedWord(e.key.name))&&this.raise(e.key.start,"Binding "+e.key.name),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):this.match(i.types.eq)&&u?(u.start||(u.start=this.state.start),e.value=this.parseMaybeDefault(t,r,e.key.__clone())):e.value=e.key.__clone(),e.shorthand=!0);else{(n||a||s)&&this.unexpected(),e.kind=e.key.name,this.parsePropertyName(e),e.value=this.parseMethod(!1);var p="get"===e.kind?0:1;if(e.value.params.length!==p){var l=e.value.start;"get"===e.kind?this.raise(l,"getter should have no params"):this.raise(l,"setter should have exactly one param")}}},u.parsePropertyName=function(e){return this.eat(i.types.bracketL)?(e.computed=!0,e.key=this.parseMaybeAssign(),this.expect(i.types.bracketR),e.key):(e.computed=!1,e.key=this.match(i.types.num)||this.match(i.types.string)?this.parseExprAtom():this.parseIdent(!0))},u.initFunction=function(e,t){e.id=null,e.generator=!1,e.expression=!1,this.options.features["es7.asyncFunctions"]&&(e.async=!!t)},u.parseMethod=function(e,t){var r=this.startNode();return this.initFunction(r,t),this.expect(i.types.parenL),r.params=this.parseBindingList(i.types.parenR,!1,this.options.features["es7.trailingFunctionCommas"]),r.generator=e,this.parseFunctionBody(r),this.finishNode(r,"FunctionExpression")},u.parseArrowExpression=function(e,t,r){return this.initFunction(e,r),e.params=this.toAssignableList(t,!0),this.parseFunctionBody(e,!0),this.finishNode(e,"ArrowFunctionExpression")},u.parseFunctionBody=function(e,t){var r=t&&!this.match(i.types.braceL),n=this.inAsync;if(this.inAsync=e.async,r)e.body=this.parseMaybeAssign(),e.expression=!0;else{var a=this.state.inFunction,s=this.state.inGenerator,o=this.state.labels;this.state.inFunction=!0,this.state.inGenerator=e.generator,this.state.labels=[],e.body=this.parseBlock(!0),e.expression=!1,this.state.inFunction=a,this.state.inGenerator=s,this.state.labels=o}if(this.inAsync=n,this.strict||!r&&e.body.body.length&&this.isUseStrict(e.body.body[0])){var u=Object.create(null),p=this.strict;this.strict=!0,e.id&&this.checkLVal(e.id,!0);for(var l=e.params,c=0;c<l.length;c++){var f=l[c];this.checkLVal(f,!0,u)}this.strict=p}},u.parseExprList=function(e,t,r,n){for(var a=[],s=!0;!this.eat(e);){if(s)s=!1;else if(this.expect(i.types.comma),t&&this.eat(e))break;a.push(this.parseExprListItem(r,n))}return a},u.parseExprListItem=function(e,t){var r=void 0;return r=e&&this.match(i.types.comma)?null:this.match(i.types.ellipsis)?this.parseSpread(t):this.parseMaybeAssign(!1,t)},u.parseIdent=function(e){var t=this.startNode();return this.match(i.types.name)?(!e&&(!this.options.allowReserved&&this.isReservedWord(this.state.value)||this.strict&&o.reservedWords.strict(this.state.value))&&this.raise(this.state.start,"The keyword '"+this.state.value+"' is reserved"),t.name=this.state.value):e&&this.state.type.keyword?t.name=this.state.type.keyword:this.unexpected(),this.next(),this.finishNode(t,"Identifier")},u.parseAwait=function(e){return(this.eat(i.types.semi)||this.canInsertSemicolon())&&this.unexpected(),e.all=this.eat(i.types.star),e.argument=this.parseMaybeUnary(),this.finishNode(e,"AwaitExpression")},u.parseYield=function(){var e=this.startNode();return this.next(),this.match(i.types.semi)||this.canInsertSemicolon()||!this.match(i.types.star)&&!this.state.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat(i.types.star),e.argument=this.parseMaybeAssign()),this.finishNode(e,"YieldExpression")},u.parseComprehension=function(e,t){for(e.blocks=[];this.match(i.types._for);){var r=this.startNode();this.next(),this.expect(i.types.parenL),r.left=this.parseBindingAtom(),this.checkLVal(r.left,!0),this.expectContextual("of"),r.right=this.parseExpression(),this.expect(i.types.parenR),e.blocks.push(this.finishNode(r,"ComprehensionBlock"))}return e.filter=this.eat(i.types._if)?this.parseParenExpression():null,e.body=this.parseExpression(),this.expect(t?i.types.parenR:i.types.bracketR),e.generator=t,this.finishNode(e,"ComprehensionExpression")}},{609:609,621:621,622:622}],609:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}r.__esModule=!0;var s=e(622),o=e(606),u=e(619),p=n(u),l={};r.plugins=l;var c=function(e){function t(r,n){i(this,t),e.call(this,n),this.options=o.getOptions(r),this.isKeyword=s.isKeyword,this.isReservedWord=s.reservedWords[6],this.input=n,this.loadPlugins(this.options.plugins),this.inModule="module"===this.options.sourceType,this.strict=this.options.strictMode===!1?!1:this.inModule,0===this.state.pos&&"#"===this.input[0]&&"!"===this.input[1]&&this.skipLineComment(2)}return a(t,e),t.prototype.extend=function(e,t){this[e]=t(this[e])},t.prototype.loadPlugins=function(e){for(var t in e){var n=r.plugins[t];if(!n)throw new Error("Plugin '"+t+"' not found");n(this,e[t])}},t.prototype.parse=function(){var e=this.startNode(),t=this.startNode();return this.nextToken(),this.parseTopLevel(e,t)},t}(p["default"]);r["default"]=c},{606:606,619:619,622:622}],610:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(623),a=e(609),s=n(a),o=s["default"].prototype;o.raise=function(e,t){var r=i.getLineInfo(this.input,e);t+=" ("+r.line+":"+r.column+")";var n=new SyntaxError(t);throw n.pos=e,n.loc=r,n}},{609:609,623:623}],611:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(621),a=e(609),s=n(a),o=e(622),u=s["default"].prototype;u.toAssignable=function(e,t){if(e)switch(e.type){case"Identifier":case"ObjectPattern":case"ArrayPattern":case"AssignmentPattern":break;case"ObjectExpression":e.type="ObjectPattern";for(var r=e.properties,n=0;n<r.length;n++){var i=r[n];"SpreadProperty"!==i.type&&("init"!==i.kind&&this.raise(i.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(i.value,t))}break;case"ArrayExpression":e.type="ArrayPattern",this.toAssignableList(e.elements,t);break;case"AssignmentExpression":"="===e.operator?(e.type="AssignmentPattern",delete e.operator):this.raise(e.left.end,"Only '=' operator can be used for specifying default value.");break;case"MemberExpression":if(!t)break;default:this.raise(e.start,"Assigning to rvalue")}return e},u.toAssignableList=function(e,t){var r=e.length;if(r){var n=e[r-1];if(n&&"RestElement"===n.type)--r;else if(n&&"SpreadElement"===n.type){n.type="RestElement";var i=n.argument;this.toAssignable(i,t),"Identifier"!==i.type&&"MemberExpression"!==i.type&&"ArrayPattern"!==i.type&&this.unexpected(i.start),--r}}for(var a=0;r>a;a++){var s=e[a];s&&this.toAssignable(s,t)}return e},u.toReferencedList=function(e){return e},u.parseSpread=function(e){var t=this.startNode();return this.next(),t.argument=this.parseMaybeAssign(e),this.finishNode(t,"SpreadElement")},u.parseRest=function(){var e=this.startNode();return this.next(),e.argument=this.match(i.types.name)||this.match(i.types.bracketL)?this.parseBindingAtom():this.unexpected(),this.finishNode(e,"RestElement")},u.parseBindingAtom=function(){switch(this.state.type){case i.types.name:return this.parseIdent();case i.types.bracketL:var e=this.startNode();return this.next(),e.elements=this.parseBindingList(i.types.bracketR,!0,!0),this.finishNode(e,"ArrayPattern");case i.types.braceL:return this.parseObj(!0);default:this.unexpected()}},u.parseBindingList=function(e,t,r){for(var n=[],a=!0;!this.eat(e);)if(a?a=!1:this.expect(i.types.comma),t&&this.match(i.types.comma))n.push(null);else{if(r&&this.eat(e))break;if(this.match(i.types.ellipsis)){n.push(this.parseAssignableListItemTypes(this.parseRest())),this.expect(e);break}var s=this.parseMaybeDefault();this.parseAssignableListItemTypes(s),n.push(this.parseMaybeDefault(null,null,s))}return n},u.parseAssignableListItemTypes=function(e){return e},u.parseMaybeDefault=function(e,t,r){if(t=t||this.state.startLoc,e=e||this.state.start,r=r||this.parseBindingAtom(),!this.eat(i.types.eq))return r;var n=this.startNodeAt(e,t);return n.left=r,n.right=this.parseMaybeAssign(),this.finishNode(n,"AssignmentPattern")},u.checkLVal=function(e,t,r){switch(e.type){case"Identifier":this.strict&&(o.reservedWords.strictBind(e.name)||o.reservedWords.strict(e.name))&&this.raise(e.start,(t?"Binding ":"Assigning to ")+e.name+" in strict mode"),r&&(r[e.name]?this.raise(e.start,"Argument name clash in strict mode"):r[e.name]=!0);break;case"MemberExpression":t&&this.raise(e.start,(t?"Binding":"Assigning to")+" member expression");break;case"ObjectPattern":for(var n=e.properties,i=0;i<n.length;i++){var a=n[i];"Property"===a.type&&(a=a.value),this.checkLVal(a,t,r)}break;case"ArrayPattern":for(var s=e.elements,u=0;u<s.length;u++){var p=s[u];p&&this.checkLVal(p,t,r)}break;case"AssignmentPattern":this.checkLVal(e.left,t,r);break;case"SpreadProperty":case"RestElement":this.checkLVal(e.argument,t,r);break;default:this.raise(e.start,(t?"Binding":"Assigning to")+" rvalue")}}},{609:609,621:621,622:622}],612:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r,n){return e.type=t,e.end=r,e.loc.end=n,this.processComment(e),e}r.__esModule=!0;var s=e(609),o=n(s),u=e(623),p=o["default"].prototype,l=function(){function e(t,r,n){i(this,e),this.type="",this.start=r,this.end=0,this.loc=new u.SourceLocation(n)}return e.prototype.__clone=function(){var t=new e;for(var r in this)t[r]=this[r];return t},e}();r.Node=l,p.startNode=function(){return new l(this,this.state.start,this.state.startLoc)},p.startNodeAt=function(e,t){return new l(this,e,t)},p.finishNode=function(e,t){return a.call(this,e,t,this.state.lastTokEnd,this.state.lastTokEndLoc)},p.finishNodeAt=function(e,t,r,n){return a.call(this,e,t,r,n)}},{609:609,623:623}],613:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(621),a=e(609),s=n(a),o=e(624),u=s["default"].prototype;u.parseTopLevel=function(e,t){t.sourceType=this.options.sourceType,t.body=[];for(var r=!0;!this.match(i.types.eof);){var n=this.parseStatement(!0,!0);t.body.push(n),r&&(this.isUseStrict(n)&&this.setStrict(!0),r=!1)}return this.next(),e.program=this.finishNode(t,"Program"),e.comments=this.state.comments,e.tokens=this.state.tokens,this.finishNode(e,"File")};var p={kind:"loop"},l={kind:"switch"};u.parseStatement=function(e,t){this.match(i.types.at)&&this.parseDecorators(!0);var r=this.state.type,n=this.startNode();switch(r){case i.types._break:case i.types._continue:return this.parseBreakContinueStatement(n,r.keyword);case i.types._debugger:return this.parseDebuggerStatement(n);case i.types._do:return this.parseDoStatement(n);case i.types._for:return this.parseForStatement(n);case i.types._function:return e||this.unexpected(),this.parseFunctionStatement(n);case i.types._class:return e||this.unexpected(),this.takeDecorators(n),this.parseClass(n,!0);case i.types._if:return this.parseIfStatement(n);case i.types._return:return this.parseReturnStatement(n);case i.types._switch:return this.parseSwitchStatement(n);case i.types._throw:return this.parseThrowStatement(n);case i.types._try:return this.parseTryStatement(n);case i.types._let:case i.types._const:e||this.unexpected();case i.types._var:return this.parseVarStatement(n,r);case i.types._while:return this.parseWhileStatement(n);case i.types._with:return this.parseWithStatement(n);case i.types.braceL:return this.parseBlock();case i.types.semi:return this.parseEmptyStatement(n);case i.types._export:case i.types._import:return this.options.allowImportExportEverywhere||(t||this.raise(this.state.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.state.start,"'import' and 'export' may appear only with 'sourceType: module'")),r===i.types._import?this.parseImport(n):this.parseExport(n);case i.types.name:if(this.options.features["es7.asyncFunctions"]&&"async"===this.state.value){var a=this.state.clone();if(this.next(),this.match(i.types._function)&&!this.canInsertSemicolon())return this.expect(i.types._function),this.parseFunction(n,!0,!1,!0);this.state=a}default:var s=this.state.value,o=this.parseExpression();return r===i.types.name&&"Identifier"===o.type&&this.eat(i.types.colon)?this.parseLabeledStatement(n,s,o):this.parseExpressionStatement(n,o)}},u.takeDecorators=function(e){this.state.decorators.length&&(e.decorators=this.state.decorators,this.state.decorators=[])},u.parseDecorators=function(e){for(;this.match(i.types.at);)this.state.decorators.push(this.parseDecorator());e&&this.match(i.types._export)||this.match(i.types._class)||this.raise(this.state.start,"Leading decorators must be attached to a class declaration")},u.parseDecorator=function(){this.options.features["es7.decorators"]||this.unexpected();var e=this.startNode();return this.next(),e.expression=this.parseMaybeAssign(),this.finishNode(e,"Decorator")},u.parseBreakContinueStatement=function(e,t){var r="break"===t;this.next(),this.eat(i.types.semi)||this.canInsertSemicolon()?e.label=null:this.match(i.types.name)?(e.label=this.parseIdent(),this.semicolon()):this.unexpected();for(var n=0;n<this.state.labels.length;++n){var a=this.state.labels[n];if(null==e.label||a.name===e.label.name){if(null!=a.kind&&(r||"loop"===a.kind))break;if(e.label&&r)break}}return n===this.state.labels.length&&this.raise(e.start,"Unsyntactic "+t),this.finishNode(e,r?"BreakStatement":"ContinueStatement")},u.parseDebuggerStatement=function(e){return this.next(),this.semicolon(),this.finishNode(e,"DebuggerStatement")},u.parseDoStatement=function(e){return this.next(),this.state.labels.push(p),e.body=this.parseStatement(!1),this.state.labels.pop(),this.expect(i.types._while),e.test=this.parseParenExpression(),this.eat(i.types.semi),this.finishNode(e,"DoWhileStatement")},u.parseForStatement=function(e){if(this.next(),this.state.labels.push(p),this.expect(i.types.parenL),this.match(i.types.semi))return this.parseFor(e,null);if(this.match(i.types._var)||this.match(i.types._let)||this.match(i.types._const)){var t=this.startNode(),r=this.state.type;return this.next(),this.parseVar(t,!0,r),this.finishNode(t,"VariableDeclaration"),!this.match(i.types._in)&&!this.isContextual("of")||1!==t.declarations.length||r!==i.types._var&&t.declarations[0].init?this.parseFor(e,t):this.parseForIn(e,t)}var n={start:0},a=this.parseExpression(!0,n);return this.match(i.types._in)||this.isContextual("of")?(this.toAssignable(a),this.checkLVal(a),this.parseForIn(e,a)):(n.start&&this.unexpected(n.start),this.parseFor(e,a))},u.parseFunctionStatement=function(e){return this.next(),this.parseFunction(e,!0)},u.parseIfStatement=function(e){return this.next(),e.test=this.parseParenExpression(),e.consequent=this.parseStatement(!1),e.alternate=this.eat(i.types._else)?this.parseStatement(!1):null,this.finishNode(e,"IfStatement")},u.parseReturnStatement=function(e){return this.state.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.state.start,"'return' outside of function"),this.next(),this.eat(i.types.semi)||this.canInsertSemicolon()?e.argument=null:(e.argument=this.parseExpression(),this.semicolon()),this.finishNode(e,"ReturnStatement")},u.parseSwitchStatement=function(e){this.next(),e.discriminant=this.parseParenExpression(),e.cases=[],this.expect(i.types.braceL),this.state.labels.push(l);for(var t,r;!this.match(i.types.braceR);)if(this.match(i.types._case)||this.match(i.types._default)){var n=this.match(i.types._case);t&&this.finishNode(t,"SwitchCase"),e.cases.push(t=this.startNode()),t.consequent=[],this.next(),n?t.test=this.parseExpression():(r&&this.raise(this.state.lastTokStart,"Multiple default clauses"),r=!0,t.test=null),this.expect(i.types.colon)}else t||this.unexpected(),t.consequent.push(this.parseStatement(!0));return t&&this.finishNode(t,"SwitchCase"),this.next(),this.state.labels.pop(),this.finishNode(e,"SwitchStatement")},u.parseThrowStatement=function(e){return this.next(),o.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start))&&this.raise(this.state.lastTokEnd,"Illegal newline after throw"),e.argument=this.parseExpression(),this.semicolon(),this.finishNode(e,"ThrowStatement")};var c=[];u.parseTryStatement=function(e){if(this.next(),e.block=this.parseBlock(),e.handler=null,this.match(i.types._catch)){var t=this.startNode();this.next(),this.expect(i.types.parenL),t.param=this.parseBindingAtom(),this.checkLVal(t.param,!0),this.expect(i.types.parenR),t.body=this.parseBlock(),e.handler=this.finishNode(t,"CatchClause")}return e.guardedHandlers=c,e.finalizer=this.eat(i.types._finally)?this.parseBlock():null,e.handler||e.finalizer||this.raise(e.start,"Missing catch or finally clause"),this.finishNode(e,"TryStatement")},u.parseVarStatement=function(e,t){return this.next(),this.parseVar(e,!1,t),this.semicolon(),this.finishNode(e,"VariableDeclaration")},u.parseWhileStatement=function(e){return this.next(),e.test=this.parseParenExpression(),this.state.labels.push(p),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"WhileStatement")},u.parseWithStatement=function(e){return this.strict&&this.raise(this.state.start,"'with' in strict mode"),this.next(),e.object=this.parseParenExpression(),e.body=this.parseStatement(!1),this.finishNode(e,"WithStatement")},u.parseEmptyStatement=function(e){return this.next(),this.finishNode(e,"EmptyStatement")},u.parseLabeledStatement=function(e,t,r){for(var n=this.state.labels,a=0;a<n.length;a++){var s=n[a];s.name===t&&this.raise(r.start,"Label '"+t+"' is already declared")}for(var o=this.state.type.isLoop?"loop":this.match(i.types._switch)?"switch":null,u=this.state.labels.length-1;u>=0;u--){var s=this.state.labels[u];if(s.statementStart!==e.start)break;s.statementStart=this.state.start,s.kind=o}return this.state.labels.push({name:t,kind:o,statementStart:this.state.start}),e.body=this.parseStatement(!0),this.state.labels.pop(),e.label=r,this.finishNode(e,"LabeledStatement")},u.parseExpressionStatement=function(e,t){return e.expression=t,this.semicolon(),this.finishNode(e,"ExpressionStatement")},u.parseBlock=function(e){var t=this.startNode(),r=!0,n=void 0;for(t.body=[],this.expect(i.types.braceL);!this.eat(i.types.braceR);){var a=this.parseStatement(!0);t.body.push(a),r&&e&&this.isUseStrict(a)&&(n=this.strict,this.setStrict(this.strict=!0)),r=!1}return n===!1&&this.setStrict(!1),this.finishNode(t,"BlockStatement")},u.parseFor=function(e,t){return e.init=t,this.expect(i.types.semi),e.test=this.match(i.types.semi)?null:this.parseExpression(),this.expect(i.types.semi),e.update=this.match(i.types.parenR)?null:this.parseExpression(),this.expect(i.types.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,"ForStatement")},u.parseForIn=function(e,t){var r=this.match(i.types._in)?"ForInStatement":"ForOfStatement";return this.next(),e.left=t,e.right=this.parseExpression(),this.expect(i.types.parenR),e.body=this.parseStatement(!1),this.state.labels.pop(),this.finishNode(e,r)},u.parseVar=function(e,t,r){for(e.declarations=[],e.kind=r.keyword;;){var n=this.startNode();if(this.parseVarHead(n),this.eat(i.types.eq)?n.init=this.parseMaybeAssign(t):r!==i.types._const||this.match(i.types._in)||this.isContextual("of")?"Identifier"===n.id.type||t&&(this.match(i.types._in)||this.isContextual("of"))?n.init=null:this.raise(this.state.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),e.declarations.push(this.finishNode(n,"VariableDeclarator")),!this.eat(i.types.comma))break}return e},u.parseVarHead=function(e){e.id=this.parseBindingAtom(),this.checkLVal(e.id,!0)},u.parseFunction=function(e,t,r,n){return this.initFunction(e,n),e.generator=this.eat(i.types.star),(t||this.match(i.types.name))&&(e.id=this.parseIdent()),this.parseFunctionParams(e),this.parseFunctionBody(e,r),this.finishNode(e,t?"FunctionDeclaration":"FunctionExpression")},u.parseFunctionParams=function(e){this.expect(i.types.parenL),e.params=this.parseBindingList(i.types.parenR,!1,this.options.features["es7.trailingFunctionCommas"])},u.parseClass=function(e,t){this.next(),this.parseClassId(e,t),this.parseClassSuper(e);var r=this.startNode(),n=!1;r.body=[],this.expect(i.types.braceL);for(var a=[];!this.eat(i.types.braceR);)if(!this.eat(i.types.semi))if(this.match(i.types.at))a.push(this.parseDecorator());else{var s=this.startNode();a.length&&(s.decorators=a,a=[]);var o=this.match(i.types.name)&&"static"===this.state.value,u=this.eat(i.types.star),p=!1;if(this.parsePropertyName(s),s["static"]=o&&!this.match(i.types.parenL),s["static"]&&(u&&this.unexpected(),u=this.eat(i.types.star),this.parsePropertyName(s)),u||"Identifier"!==s.key.type||s.computed||!this.isClassProperty()){!this.options.features["es7.asyncFunctions"]||this.match(i.types.parenL)||s.computed||"Identifier"!==s.key.type||"async"!==s.key.name||(p=!0,this.parsePropertyName(s));var l=!1;if(s.kind="method",!s.computed){var c=s.key;p||u||"Identifier"!==c.type||this.match(i.types.parenL)||"get"!==c.name&&"set"!==c.name||(l=!0,s.kind=c.name,c=this.parsePropertyName(s)),!s["static"]&&("Identifier"===c.type&&"constructor"===c.name||"Literal"===c.type&&"constructor"===c.value)&&(n&&this.raise(c.start,"Duplicate constructor in the same class"),l&&this.raise(c.start,"Constructor can't have get/set modifier"),u&&this.raise(c.start,"Constructor can't be a generator"),p&&this.raise(c.start,"Constructor can't be an async function"),s.kind="constructor",n=!0)}if("constructor"===s.kind&&s.decorators&&this.raise(s.start,"You can't attach decorators to a class constructor"),this.parseClassMethod(r,s,u,p),l){var f="get"===s.kind?0:1;if(s.value.params.length!==f){var d=s.value.start;"get"===s.kind?this.raise(d,"getter should have no params"):this.raise(d,"setter should have exactly one param")}}}else r.body.push(this.parseClassProperty(s))}return a.length&&this.raise(this.state.start,"You have trailing decorators with no method"),e.body=this.finishNode(r,"ClassBody"),this.finishNode(e,t?"ClassDeclaration":"ClassExpression")},u.isClassProperty=function(){return this.match(i.types.eq)||this.match(i.types.semi)||this.canInsertSemicolon()},u.parseClassProperty=function(e){return this.match(i.types.eq)?(this.options.features["es7.classProperties"]||this.unexpected(),this.next(),e.value=this.parseMaybeAssign()):e.value=null,this.semicolon(),this.finishNode(e,"ClassProperty")},u.parseClassMethod=function(e,t,r,n){t.value=this.parseMethod(r,n),e.body.push(this.finishNode(t,"MethodDefinition"))},u.parseClassId=function(e,t){e.id=this.match(i.types.name)?this.parseIdent():t?this.unexpected():null},u.parseClassSuper=function(e){e.superClass=this.eat(i.types._extends)?this.parseExprSubscripts():null},u.parseExport=function(e){if(this.next(),this.match(i.types.star)){var t=this.startNode();if(this.next(),!this.options.features["es7.exportExtensions"]||!this.eatContextual("as"))return this.parseExportFrom(e,!0),this.finishNode(e,"ExportAllDeclaration");t.exported=this.parseIdent(),e.specifiers=[this.finishNode(t,"ExportNamespaceSpecifier")],this.parseExportSpecifiersMaybe(e),this.parseExportFrom(e,!0)}else if(this.options.features["es7.exportExtensions"]&&this.isExportDefaultSpecifier()){var t=this.startNode();if(t.exported=this.parseIdent(!0),e.specifiers=[this.finishNode(t,"ExportDefaultSpecifier")],this.match(i.types.comma)&&this.lookahead().type===i.types.star){this.expect(i.types.comma);var r=this.startNode();this.expect(i.types.star),this.expectContextual("as"),r.exported=this.parseIdent(),e.specifiers.push(this.finishNode(r,"ExportNamespaceSpecifier"))}else this.parseExportSpecifiersMaybe(e);this.parseExportFrom(e,!0)}else{if(this.eat(i.types._default)){var n=this.match(i.types._function)||this.match(i.types._class),a=this.parseMaybeAssign(),s=!0;return n&&(s=!1,a.id&&(a.type="FunctionExpression"===a.type?"FunctionDeclaration":"ClassDeclaration")),e.declaration=a,s&&this.semicolon(),this.checkExport(e),this.finishNode(e,"ExportDefaultDeclaration")}this.state.type.keyword||this.shouldParseExportDeclaration()?(e.specifiers=[],e.source=null,e.declaration=this.parseExportDeclaration(e)):(e.declaration=null,e.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(e))}return this.checkExport(e),this.finishNode(e,"ExportNamedDeclaration")},u.parseExportDeclaration=function(){return this.parseStatement(!0)},u.isExportDefaultSpecifier=function(){if(this.match(i.types.name))return"type"!==this.state.value&&"async"!==this.state.value;if(!this.match(i.types._default))return!1;var e=this.lookahead();return e.type===i.types.comma||e.type===i.types.name&&"from"===e.value},u.parseExportSpecifiersMaybe=function(e){this.eat(i.types.comma)&&(e.specifiers=e.specifiers.concat(this.parseExportSpecifiers()))},u.parseExportFrom=function(e,t){this.eatContextual("from")?(e.source=this.match(i.types.string)?this.parseExprAtom():this.unexpected(),this.checkExport(e)):t?this.unexpected():e.source=null,this.semicolon()},u.shouldParseExportDeclaration=function(){return this.options.features["es7.asyncFunctions"]&&this.isContextual("async")},u.checkExport=function(e){if(this.state.decorators.length){var t=e.declaration&&("ClassDeclaration"===e.declaration.type||"ClassExpression"===e.declaration.type);e.declaration&&t||this.raise(e.start,"You can only use decorators on an export when exporting a class"),this.takeDecorators(e.declaration)}},u.parseExportSpecifiers=function(){var e=[],t=!0;for(this.expect(i.types.braceL);!this.eat(i.types.braceR);){if(t)t=!1;else if(this.expect(i.types.comma),this.eat(i.types.braceR))break;var r=this.startNode();r.local=this.parseIdent(this.match(i.types._default)),r.exported=this.eatContextual("as")?this.parseIdent(!0):r.local.__clone(),e.push(this.finishNode(r,"ExportSpecifier"))}return e},u.parseImport=function(e){return this.next(),this.match(i.types.string)?(e.specifiers=[],e.source=this.parseExprAtom()):(e.specifiers=[],this.parseImportSpecifiers(e),this.expectContextual("from"),e.source=this.match(i.types.string)?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(e,"ImportDeclaration")},u.parseImportSpecifiers=function(e){var t=!0;if(this.match(i.types.name)){var r=this.state.start,n=this.state.startLoc;if(e.specifiers.push(this.parseImportSpecifierDefault(this.parseIdent(),r,n)),!this.eat(i.types.comma))return}if(this.match(i.types.star)){var a=this.startNode();return this.next(),this.expectContextual("as"),a.local=this.parseIdent(),this.checkLVal(a.local,!0),void e.specifiers.push(this.finishNode(a,"ImportNamespaceSpecifier"))}for(this.expect(i.types.braceL);!this.eat(i.types.braceR);){if(t)t=!1;else if(this.expect(i.types.comma),this.eat(i.types.braceR))break;var a=this.startNode();a.imported=this.parseIdent(!0),a.local=this.eatContextual("as")?this.parseIdent():a.imported.__clone(),this.checkLVal(a.local,!0),e.specifiers.push(this.finishNode(a,"ImportSpecifier"))}},u.parseImportSpecifierDefault=function(e,t,r){var n=this.startNodeAt(t,r);return n.local=e,this.checkLVal(n.local,!0),this.finishNode(n,"ImportDefaultSpecifier")}},{609:609,621:621,624:624}],614:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}var i=e(621),a=e(609),s=n(a),o=e(624),u=s["default"].prototype;u.isUseStrict=function(e){return"ExpressionStatement"===e.type&&"Literal"===e.expression.type&&"use strict"===e.expression.raw.slice(1,-1)},u.isRelational=function(e){return this.match(i.types.relational)&&this.state.value===e},u.expectRelational=function(e){this.isRelational(e)?this.next():this.unexpected()},u.isContextual=function(e){return this.match(i.types.name)&&this.state.value===e},u.eatContextual=function(e){return this.state.value===e&&this.eat(i.types.name)},u.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},u.canInsertSemicolon=function(){return this.match(i.types.eof)||this.match(i.types.braceR)||o.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start))},u.semicolon=function(){this.eat(i.types.semi)||this.canInsertSemicolon()||this.unexpected()},u.expect=function(e){return this.eat(e)||this.unexpected()},u.unexpected=function(e){this.raise(null!=e?e:this.state.start,"Unexpected token")}},{609:609,621:621,624:624}],615:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}r.__esModule=!0;var i=e(621),a=e(609),s=n(a),o=s["default"].prototype;o.flowParseTypeInitialiser=function(e){var t=this.state.inType;this.state.inType=!0,this.expect(e||i.types.colon);var r=this.flowParseType();return this.state.inType=t,r},o.flowParseDeclareClass=function(e){return this.next(),this.flowParseInterfaceish(e,!0),this.finishNode(e,"DeclareClass")},o.flowParseDeclareFunction=function(e){this.next();var t=e.id=this.parseIdent(),r=this.startNode(),n=this.startNode();this.isRelational("<")?r.typeParameters=this.flowParseTypeParameterDeclaration():r.typeParameters=null,this.expect(i.types.parenL);var a=this.flowParseFunctionTypeParams();return r.params=a.params,r.rest=a.rest,this.expect(i.types.parenR),r.returnType=this.flowParseTypeInitialiser(),n.typeAnnotation=this.finishNode(r,"FunctionTypeAnnotation"),t.typeAnnotation=this.finishNode(n,"TypeAnnotation"),this.finishNode(t,t.type),this.semicolon(),this.finishNode(e,"DeclareFunction")},o.flowParseDeclare=function(e){return this.match(i.types._class)?this.flowParseDeclareClass(e):this.match(i.types._function)?this.flowParseDeclareFunction(e):this.match(i.types._var)?this.flowParseDeclareVariable(e):this.isContextual("module")?this.flowParseDeclareModule(e):void this.unexpected()},o.flowParseDeclareVariable=function(e){return this.next(),e.id=this.flowParseTypeAnnotatableIdentifier(),this.semicolon(),this.finishNode(e,"DeclareVariable")},o.flowParseDeclareModule=function(e){this.next(),this.match(i.types.string)?e.id=this.parseExprAtom():e.id=this.parseIdent();var t=e.body=this.startNode(),r=t.body=[];for(this.expect(i.types.braceL);!this.match(i.types.braceR);){var n=this.startNode();this.next(),r.push(this.flowParseDeclare(n))}return this.expect(i.types.braceR),this.finishNode(t,"BlockStatement"),this.finishNode(e,"DeclareModule")},o.flowParseInterfaceish=function(e,t){if(e.id=this.parseIdent(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e["extends"]=[],this.eat(i.types._extends))do e["extends"].push(this.flowParseInterfaceExtends());while(this.eat(i.types.comma));e.body=this.flowParseObjectType(t)},o.flowParseInterfaceExtends=function(){var e=this.startNode();return e.id=this.parseIdent(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterInstantiation():e.typeParameters=null,
this.finishNode(e,"InterfaceExtends")},o.flowParseInterface=function(e){return this.flowParseInterfaceish(e,!1),this.finishNode(e,"InterfaceDeclaration")},o.flowParseTypeAlias=function(e){return e.id=this.parseIdent(),this.isRelational("<")?e.typeParameters=this.flowParseTypeParameterDeclaration():e.typeParameters=null,e.right=this.flowParseTypeInitialiser(i.types.eq),this.semicolon(),this.finishNode(e,"TypeAlias")},o.flowParseTypeParameterDeclaration=function(){var e=this.startNode();for(e.params=[],this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flowParseTypeAnnotatableIdentifier()),this.isRelational(">")||this.expect(i.types.comma);return this.expectRelational(">"),this.finishNode(e,"TypeParameterDeclaration")},o.flowParseTypeParameterInstantiation=function(){var e=this.startNode(),t=this.state.inType;for(e.params=[],this.state.inType=!0,this.expectRelational("<");!this.isRelational(">");)e.params.push(this.flowParseType()),this.isRelational(">")||this.expect(i.types.comma);return this.expectRelational(">"),this.state.inType=t,this.finishNode(e,"TypeParameterInstantiation")},o.flowParseObjectPropertyKey=function(){return this.match(i.types.num)||this.match(i.types.string)?this.parseExprAtom():this.parseIdent(!0)},o.flowParseObjectTypeIndexer=function(e,t){return e["static"]=t,this.expect(i.types.bracketL),e.id=this.flowParseObjectPropertyKey(),e.key=this.flowParseTypeInitialiser(),this.expect(i.types.bracketR),e.value=this.flowParseTypeInitialiser(),this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeIndexer")},o.flowParseObjectTypeMethodish=function(e){for(e.params=[],e.rest=null,e.typeParameters=null,this.isRelational("<")&&(e.typeParameters=this.flowParseTypeParameterDeclaration()),this.expect(i.types.parenL);this.match(i.types.name);)e.params.push(this.flowParseFunctionTypeParam()),this.match(i.types.parenR)||this.expect(i.types.comma);return this.eat(i.types.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),this.expect(i.types.parenR),e.returnType=this.flowParseTypeInitialiser(),this.finishNode(e,"FunctionTypeAnnotation")},o.flowParseObjectTypeMethod=function(e,t,r,n){var i=this.startNodeAt(e,t);return i.value=this.flowParseObjectTypeMethodish(this.startNodeAt(e,t)),i["static"]=r,i.key=n,i.optional=!1,this.flowObjectTypeSemicolon(),this.finishNode(i,"ObjectTypeProperty")},o.flowParseObjectTypeCallProperty=function(e,t){var r=this.startNode();return e["static"]=t,e.value=this.flowParseObjectTypeMethodish(r),this.flowObjectTypeSemicolon(),this.finishNode(e,"ObjectTypeCallProperty")},o.flowParseObjectType=function(e){var t,r,n,a=this.startNode();for(a.callProperties=[],a.properties=[],a.indexers=[],this.expect(i.types.braceL);!this.match(i.types.braceR);){var s=!1,o=this.state.start,u=this.state.startLoc;t=this.startNode(),e&&this.isContextual("static")&&(this.next(),n=!0),this.match(i.types.bracketL)?a.indexers.push(this.flowParseObjectTypeIndexer(t,n)):this.match(i.types.parenL)||this.isRelational("<")?a.callProperties.push(this.flowParseObjectTypeCallProperty(t,e)):(r=n&&this.match(i.types.colon)?this.parseIdent():this.flowParseObjectPropertyKey(),this.isRelational("<")||this.match(i.types.parenL)?a.properties.push(this.flowParseObjectTypeMethod(o,u,n,r)):(this.eat(i.types.question)&&(s=!0),t.key=r,t.value=this.flowParseTypeInitialiser(),t.optional=s,t["static"]=n,this.flowObjectTypeSemicolon(),a.properties.push(this.finishNode(t,"ObjectTypeProperty"))))}return this.expect(i.types.braceR),this.finishNode(a,"ObjectTypeAnnotation")},o.flowObjectTypeSemicolon=function(){this.eat(i.types.semi)||this.eat(i.types.comma)||this.match(i.types.braceR)||this.unexpected()},o.flowParseGenericType=function(e,t,r){var n=this.startNodeAt(e,t);for(n.typeParameters=null,n.id=r;this.eat(i.types.dot);){var a=this.startNodeAt(e,t);a.qualification=n.id,a.id=this.parseIdent(),n.id=this.finishNode(a,"QualifiedTypeIdentifier")}return this.isRelational("<")&&(n.typeParameters=this.flowParseTypeParameterInstantiation()),this.finishNode(n,"GenericTypeAnnotation")},o.flowParseTypeofType=function(){var e=this.startNode();return this.expect(i.types._typeof),e.argument=this.flowParsePrimaryType(),this.finishNode(e,"TypeofTypeAnnotation")},o.flowParseTupleType=function(){var e=this.startNode();for(e.types=[],this.expect(i.types.bracketL);this.state.pos<this.input.length&&!this.match(i.types.bracketR)&&(e.types.push(this.flowParseType()),!this.match(i.types.bracketR));)this.expect(i.types.comma);return this.expect(i.types.bracketR),this.finishNode(e,"TupleTypeAnnotation")},o.flowParseFunctionTypeParam=function(){var e=!1,t=this.startNode();return t.name=this.parseIdent(),this.eat(i.types.question)&&(e=!0),t.optional=e,t.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(t,"FunctionTypeParam")},o.flowParseFunctionTypeParams=function(){for(var e={params:[],rest:null};this.match(i.types.name);)e.params.push(this.flowParseFunctionTypeParam()),this.match(i.types.parenR)||this.expect(i.types.comma);return this.eat(i.types.ellipsis)&&(e.rest=this.flowParseFunctionTypeParam()),e},o.flowIdentToTypeAnnotation=function(e,t,r,n){switch(n.name){case"any":return this.finishNode(r,"AnyTypeAnnotation");case"void":return this.finishNode(r,"VoidTypeAnnotation");case"bool":case"boolean":return this.finishNode(r,"BooleanTypeAnnotation");case"mixed":return this.finishNode(r,"MixedTypeAnnotation");case"number":return this.finishNode(r,"NumberTypeAnnotation");case"string":return this.finishNode(r,"StringTypeAnnotation");default:return this.flowParseGenericType(e,t,n)}},o.flowParsePrimaryType=function(){var e,t,r=this.state.start,n=this.state.startLoc,a=this.startNode(),s=!1;switch(this.state.type){case i.types.name:return this.flowIdentToTypeAnnotation(r,n,a,this.parseIdent());case i.types.braceL:return this.flowParseObjectType();case i.types.bracketL:return this.flowParseTupleType();case i.types.relational:if("<"===this.state.value)return a.typeParameters=this.flowParseTypeParameterDeclaration(),this.expect(i.types.parenL),e=this.flowParseFunctionTypeParams(),a.params=e.params,a.rest=e.rest,this.expect(i.types.parenR),this.expect(i.types.arrow),a.returnType=this.flowParseType(),this.finishNode(a,"FunctionTypeAnnotation");case i.types.parenL:if(this.next(),!this.match(i.types.parenR)&&!this.match(i.types.ellipsis))if(this.match(i.types.name)){var o=this.lookahead().type;s=o!==i.types.question&&o!==i.types.colon}else s=!0;return s?(t=this.flowParseType(),this.expect(i.types.parenR),this.eat(i.types.arrow)&&this.raise(a,"Unexpected token =>. It looks like you are trying to write a function type, but you ended up writing a grouped type followed by an =>, which is a syntax error. Remember, function type parameters are named so function types look like (name1: type1, name2: type2) => returnType. You probably wrote (type1) => returnType"),t):(e=this.flowParseFunctionTypeParams(),a.params=e.params,a.rest=e.rest,this.expect(i.types.parenR),this.expect(i.types.arrow),a.returnType=this.flowParseType(),a.typeParameters=null,this.finishNode(a,"FunctionTypeAnnotation"));case i.types.string:return a.rawValue=a.value=this.state.value,a.raw=this.input.slice(this.state.start,this.state.end),this.next(),this.finishNode(a,"StringLiteralTypeAnnotation");case i.types._true:case i.types._false:return a.value=this.match(i.types._true),this.next(),this.finishNode(a,"BooleanLiteralTypeAnnotation");case i.types.num:return a.rawValue=a.value=this.state.value,a.raw=this.input.slice(this.state.start,this.state.end),this.next(),this.finishNode(a,"NumberLiteralTypeAnnotation");default:if("typeof"===this.state.type.keyword)return this.flowParseTypeofType()}this.unexpected()},o.flowParsePostfixType=function(){var e=this.startNode(),t=e.elementType=this.flowParsePrimaryType();return this.match(i.types.bracketL)?(this.expect(i.types.bracketL),this.expect(i.types.bracketR),this.finishNode(e,"ArrayTypeAnnotation")):t},o.flowParsePrefixType=function(){var e=this.startNode();return this.eat(i.types.question)?(e.typeAnnotation=this.flowParsePrefixType(),this.finishNode(e,"NullableTypeAnnotation")):this.flowParsePostfixType()},o.flowParseIntersectionType=function(){var e=this.startNode(),t=this.flowParsePrefixType();for(e.types=[t];this.eat(i.types.bitwiseAND);)e.types.push(this.flowParsePrefixType());return 1===e.types.length?t:this.finishNode(e,"IntersectionTypeAnnotation")},o.flowParseUnionType=function(){var e=this.startNode(),t=this.flowParseIntersectionType();for(e.types=[t];this.eat(i.types.bitwiseOR);)e.types.push(this.flowParseIntersectionType());return 1===e.types.length?t:this.finishNode(e,"UnionTypeAnnotation")},o.flowParseType=function(){var e=this.state.inType;this.state.inType=!0;var t=this.flowParseUnionType();return this.state.inType=e,t},o.flowParseTypeAnnotation=function(){var e=this.startNode();return e.typeAnnotation=this.flowParseTypeInitialiser(),this.finishNode(e,"TypeAnnotation")},o.flowParseTypeAnnotatableIdentifier=function(e,t){var r=this.parseIdent(),n=!1;return t&&this.eat(i.types.question)&&(this.expect(i.types.question),n=!0),(e||this.match(i.types.colon))&&(r.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(r,r.type)),n&&(r.optional=!0,this.finishNode(r,r.type)),r},r["default"]=function(e){function t(e){return e.expression.typeAnnotation=e.typeAnnotation,e.expression}e.extend("parseFunctionBody",function(e){return function(t,r){return this.match(i.types.colon)&&!r&&(t.returnType=this.flowParseTypeAnnotation()),e.call(this,t,r)}}),e.extend("parseStatement",function(e){return function(t,r){if(this.strict&&this.match(i.types.name)&&"interface"===this.state.value){var n=this.startNode();return this.next(),this.flowParseInterface(n)}return e.call(this,t,r)}}),e.extend("parseExpressionStatement",function(e){return function(t,r){if("Identifier"===r.type)if("declare"===r.name){if(this.match(i.types._class)||this.match(i.types.name)||this.match(i.types._function)||this.match(i.types._var))return this.flowParseDeclare(t)}else if(this.match(i.types.name)){if("interface"===r.name)return this.flowParseInterface(t);if("type"===r.name)return this.flowParseTypeAlias(t)}return e.call(this,t,r)}}),e.extend("shouldParseExportDeclaration",function(e){return function(){return this.isContextual("type")||e.call(this)}}),e.extend("parseParenItem",function(){return function(e,t,r,n){if(this.match(i.types.colon)){var a=this.startNodeAt(t,r);if(a.expression=e,a.typeAnnotation=this.flowParseTypeAnnotation(),n&&!this.match(i.types.arrow)&&this.unexpected(),this.eat(i.types.arrow)){var s=this.parseArrowExpression(this.startNodeAt(t,r),[e]);return s.returnType=a.typeAnnotation,s}return this.finishNode(a,"TypeCastExpression")}return e}}),e.extend("parseExport",function(e){return function(t){return t=e.call(this,t),"ExportNamedDeclaration"===t.type&&(t.exportKind=t.exportKind||"value"),t}}),e.extend("parseExportDeclaration",function(e){return function(t){if(this.isContextual("type")){t.exportKind="type";var r=this.startNode();return this.next(),this.match(i.types.braceL)?(t.specifiers=this.parseExportSpecifiers(),this.parseExportFrom(t),null):this.flowParseTypeAlias(r)}return e.call(this,t)}}),e.extend("parseClassId",function(e){return function(t,r){e.call(this,t,r),this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration())}}),e.extend("isKeyword",function(e){return function(t){return this.state.inType&&"void"===t?!1:e.call(this,t)}}),e.extend("readToken",function(e){return function(t){return!this.state.inType||62!==t&&60!==t?e.call(this,t):this.finishOp(i.types.relational,1)}}),e.extend("jsx_readToken",function(e){return function(){return this.state.inType?void 0:e.call(this)}}),e.extend("toAssignableList",function(e){return function(r,n){for(var i=0;i<r.length;i++){var a=r[i];a&&"TypeCastExpression"===a.type&&(r[i]=t(a))}return e.call(this,r,n)}}),e.extend("toReferencedList",function(){return function(e){for(var t=0;t<e.length;t++){var r=e[t];r&&r._exprListItem&&"TypeCastExpression"===r.type&&this.raise(r.start,"Unexpected type cast")}return e}}),e.extend("parseExprListItem",function(e){return function(t,r){var n=this.startNode(),a=e.call(this,t,r);return this.match(i.types.colon)?(n._exprListItem=!0,n.expression=a,n.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(n,"TypeCastExpression")):a}}),e.extend("parseClassProperty",function(e){return function(t){return this.match(i.types.colon)&&(t.typeAnnotation=this.flowParseTypeAnnotation()),e.call(this,t)}}),e.extend("isClassProperty",function(e){return function(){return this.match(i.types.colon)||e.call(this)}}),e.extend("parseClassMethod",function(){return function(e,t,r,n){var i;this.isRelational("<")&&(i=this.flowParseTypeParameterDeclaration()),t.value=this.parseMethod(r,n),t.value.typeParameters=i,e.body.push(this.finishNode(t,"MethodDefinition"))}}),e.extend("parseClassSuper",function(e){return function(t,r){if(e.call(this,t,r),t.superClass&&this.isRelational("<")&&(t.superTypeParameters=this.flowParseTypeParameterInstantiation()),this.isContextual("implements")){this.next();var n=t["implements"]=[];do{var a=this.startNode();a.id=this.parseIdent(),this.isRelational("<")?a.typeParameters=this.flowParseTypeParameterInstantiation():a.typeParameters=null,n.push(this.finishNode(a,"ClassImplements"))}while(this.eat(i.types.comma))}}}),e.extend("parseObjPropValue",function(e){return function(t){var r;this.isRelational("<")&&(r=this.flowParseTypeParameterDeclaration(),this.match(i.types.parenL)||this.unexpected()),e.apply(this,arguments),r&&(t.value.typeParameters=r)}}),e.extend("parseAssignableListItemTypes",function(){return function(e){return this.eat(i.types.question)&&(e.optional=!0),this.match(i.types.colon)&&(e.typeAnnotation=this.flowParseTypeAnnotation()),this.finishNode(e,e.type),e}}),e.extend("parseImportSpecifiers",function(e){return function(t){t.importKind="value";var r=this.match(i.types._typeof)?"typeof":this.isContextual("type")?"type":null;if(r){var n=this.lookahead();(n.type===i.types.name&&"from"!==n.value||n.type===i.types.braceL||n.type===i.types.star)&&(this.next(),t.importKind=r)}e.call(this,t)}}),e.extend("parseFunctionParams",function(e){return function(t){this.isRelational("<")&&(t.typeParameters=this.flowParseTypeParameterDeclaration()),e.call(this,t)}}),e.extend("parseVarHead",function(e){return function(t){e.call(this,t),this.match(i.types.colon)&&(t.id.typeAnnotation=this.flowParseTypeAnnotation(),this.finishNode(t.id,t.id.type))}}),e.extend("parseAsyncArrowFromCallExpression",function(e){return function(t,r){return this.match(i.types.colon)&&(t.returnType=this.flowParseTypeAnnotation()),e.call(this,t,r)}}),e.extend("parseParenAndDistinguishExpression",function(e){return function(t,r,n,a){if(t=t||this.state.start,r=r||this.state.startLoc,this.lookahead().type===i.types.parenR){this.expect(i.types.parenL),this.expect(i.types.parenR);var s=this.startNodeAt(t,r);return this.match(i.types.colon)&&(s.returnType=this.flowParseTypeAnnotation()),this.expect(i.types.arrow),this.parseArrowExpression(s,[],a)}var s=e.call(this,t,r,n,a);if(!this.match(i.types.colon))return s;var o=this.state.clone();try{return this.parseParenItem(s,t,r,!0)}catch(u){if(u instanceof SyntaxError)return this.state=o,s;throw u}}})},t.exports=r["default"]},{609:609,621:621}],616:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e){return"JSXIdentifier"===e.type?e.name:"JSXNamespacedName"===e.type?e.namespace.name+":"+e.name.name:"JSXMemberExpression"===e.type?i(e.object)+"."+i(e.property):void 0}r.__esModule=!0;var a=e(617),s=n(a),o=e(621),u=e(618),p=e(609),l=n(p),c=e(622),f=e(624),d=/^[\da-fA-F]+$/,h=/^\d+$/;u.types.j_oTag=new u.TokContext("<tag",!1),u.types.j_cTag=new u.TokContext("</tag",!1),u.types.j_expr=new u.TokContext("<tag>...</tag>",!0,!0),o.types.jsxName=new o.TokenType("jsxName"),o.types.jsxText=new o.TokenType("jsxText",{beforeExpr:!0}),o.types.jsxTagStart=new o.TokenType("jsxTagStart"),o.types.jsxTagEnd=new o.TokenType("jsxTagEnd"),o.types.jsxTagStart.updateContext=function(){this.state.context.push(u.types.j_expr),this.state.context.push(u.types.j_oTag),this.state.exprAllowed=!1},o.types.jsxTagEnd.updateContext=function(e){var t=this.state.context.pop();t===u.types.j_oTag&&e===o.types.slash||t===u.types.j_cTag?(this.state.context.pop(),this.state.exprAllowed=this.curContext()===u.types.j_expr):this.state.exprAllowed=!0};var m=l["default"].prototype;m.jsxReadToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated JSX contents");var r=this.input.charCodeAt(this.state.pos);switch(r){case 60:case 123:return this.state.pos===this.state.start?60===r&&this.state.exprAllowed?(++this.state.pos,this.finishToken(o.types.jsxTagStart)):this.getTokenFromCode(r):(e+=this.input.slice(t,this.state.pos),this.finishToken(o.types.jsxText,e));case 38:e+=this.input.slice(t,this.state.pos),e+=this.jsxReadEntity(),t=this.state.pos;break;default:f.isNewLine(r)?(e+=this.input.slice(t,this.state.pos),e+=this.jsxReadNewLine(!0),t=this.state.pos):++this.state.pos}}},m.jsxReadNewLine=function(e){var t,r=this.input.charCodeAt(this.state.pos);return++this.state.pos,13===r&&10===this.input.charCodeAt(this.state.pos)?(++this.state.pos,t=e?"\n":"\r\n"):t=String.fromCharCode(r),++this.state.curLine,this.state.lineStart=this.state.pos,t},m.jsxReadString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;38===n?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadEntity(),r=this.state.pos):f.isNewLine(n)?(t+=this.input.slice(r,this.state.pos),t+=this.jsxReadNewLine(!1),r=this.state.pos):++this.state.pos}return t+=this.input.slice(r,this.state.pos++),this.finishToken(o.types.string,t)},m.jsxReadEntity=function(){for(var e,t="",r=0,n=this.input[this.state.pos],i=++this.state.pos;this.state.pos<this.input.length&&r++<10;){if(n=this.input[this.state.pos++],";"===n){"#"===t[0]?"x"===t[1]?(t=t.substr(2),d.test(t)&&(e=String.fromCharCode(parseInt(t,16)))):(t=t.substr(1),h.test(t)&&(e=String.fromCharCode(parseInt(t,10)))):e=s["default"][t];break}t+=n}return e?e:(this.state.pos=i,"&")},m.jsxReadWord=function(){var e,t=this.state.pos;do e=this.input.charCodeAt(++this.state.pos);while(c.isIdentifierChar(e)||45===e);return this.finishToken(o.types.jsxName,this.input.slice(t,this.state.pos))},m.jsxParseIdentifier=function(){var e=this.startNode();return this.match(o.types.jsxName)?e.name=this.state.value:this.state.type.keyword?e.name=this.state.type.keyword:this.unexpected(),this.next(),this.finishNode(e,"JSXIdentifier")},m.jsxParseNamespacedName=function(){var e=this.state.start,t=this.state.startLoc,r=this.jsxParseIdentifier();if(!this.eat(o.types.colon))return r;var n=this.startNodeAt(e,t);return n.namespace=r,n.name=this.jsxParseIdentifier(),this.finishNode(n,"JSXNamespacedName")},m.jsxParseElementName=function(){for(var e=this.state.start,t=this.state.startLoc,r=this.jsxParseNamespacedName();this.eat(o.types.dot);){var n=this.startNodeAt(e,t);n.object=r,n.property=this.jsxParseIdentifier(),r=this.finishNode(n,"JSXMemberExpression")}return r},m.jsxParseAttributeValue=function(){var e;switch(this.state.type){case o.types.braceL:if(e=this.jsxParseExpressionContainer(),"JSXEmptyExpression"!==e.expression.type)return e;this.raise(e.start,"JSX attributes must only be assigned a non-empty expression");case o.types.jsxTagStart:case o.types.string:return e=this.parseExprAtom(),e.rawValue=null,e;default:this.raise(this.state.start,"JSX value should be either an expression or a quoted JSX text")}},m.jsxParseEmptyExpression=function(){var e=this.state.start;return this.state.start=this.state.lastTokEnd,this.state.lastTokEnd=e,e=this.state.startLoc,this.state.startLoc=this.state.lastTokEndLoc,this.state.lastTokEndLoc=e,this.finishNode(this.startNode(),"JSXEmptyExpression")},m.jsxParseExpressionContainer=function(){var e=this.startNode();return this.next(),this.match(o.types.braceR)?e.expression=this.jsxParseEmptyExpression():e.expression=this.parseExpression(),this.expect(o.types.braceR),this.finishNode(e,"JSXExpressionContainer")},m.jsxParseAttribute=function(){var e=this.startNode();return this.eat(o.types.braceL)?(this.expect(o.types.ellipsis),e.argument=this.parseMaybeAssign(),this.expect(o.types.braceR),this.finishNode(e,"JSXSpreadAttribute")):(e.name=this.jsxParseNamespacedName(),e.value=this.eat(o.types.eq)?this.jsxParseAttributeValue():null,this.finishNode(e,"JSXAttribute"))},m.jsxParseOpeningElementAt=function(e,t){var r=this.startNodeAt(e,t);for(r.attributes=[],r.name=this.jsxParseElementName();!this.match(o.types.slash)&&!this.match(o.types.jsxTagEnd);)r.attributes.push(this.jsxParseAttribute());return r.selfClosing=this.eat(o.types.slash),this.expect(o.types.jsxTagEnd),this.finishNode(r,"JSXOpeningElement")},m.jsxParseClosingElementAt=function(e,t){var r=this.startNodeAt(e,t);return r.name=this.jsxParseElementName(),this.expect(o.types.jsxTagEnd),this.finishNode(r,"JSXClosingElement")},m.jsxParseElementAt=function(e,t){var r=this.startNodeAt(e,t),n=[],a=this.jsxParseOpeningElementAt(e,t),s=null;if(!a.selfClosing){e:for(;;)switch(this.state.type){case o.types.jsxTagStart:if(e=this.state.start,t=this.state.startLoc,this.next(),this.eat(o.types.slash)){s=this.jsxParseClosingElementAt(e,t);break e}n.push(this.jsxParseElementAt(e,t));break;case o.types.jsxText:n.push(this.parseExprAtom());break;case o.types.braceL:n.push(this.jsxParseExpressionContainer());break;default:this.unexpected()}i(s.name)!==i(a.name)&&this.raise(s.start,"Expected corresponding JSX closing tag for <"+i(a.name)+">")}return r.openingElement=a,r.closingElement=s,r.children=n,this.match(o.types.relational)&&"<"===this.state.value&&this.raise(this.state.start,"Adjacent JSX elements must be wrapped in an enclosing tag"),this.finishNode(r,"JSXElement")},m.jsxParseElement=function(){var e=this.state.start,t=this.state.startLoc;return this.next(),this.jsxParseElementAt(e,t)},r["default"]=function(e){e.extend("parseExprAtom",function(e){return function(t){if(this.match(o.types.jsxText)){var r=this.parseLiteral(this.state.value);return r.rawValue=null,r}return this.match(o.types.jsxTagStart)?this.jsxParseElement():e.call(this,t)}}),e.extend("readToken",function(e){return function(t){var r=this.curContext();if(r===u.types.j_expr)return this.jsxReadToken();if(r===u.types.j_oTag||r===u.types.j_cTag){if(c.isIdentifierStart(t))return this.jsxReadWord();if(62===t)return++this.state.pos,this.finishToken(o.types.jsxTagEnd);if((34===t||39===t)&&r===u.types.j_oTag)return this.jsxReadString(t)}return 60===t&&this.state.exprAllowed?(++this.state.pos,this.finishToken(o.types.jsxTagStart)):e.call(this,t)}}),e.extend("updateContext",function(e){return function(t){if(this.match(o.types.braceL)){var r=this.curContext();r===u.types.j_oTag?this.state.context.push(u.types.b_expr):r===u.types.j_expr?this.state.context.push(u.types.b_tmpl):e.call(this,t),this.state.exprAllowed=!0}else{if(!this.match(o.types.slash)||t!==o.types.jsxTagStart)return e.call(this,t);this.state.context.length-=2,this.state.context.push(u.types.j_cTag),this.state.exprAllowed=!1}}})},t.exports=r["default"]},{609:609,617:617,618:618,621:621,622:622,624:624}],617:[function(e,t,r){"use strict";r.__esModule=!0,r["default"]={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"},t.exports=r["default"]},{}],618:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=e(621),a=function o(e,t,r,i){n(this,o),this.token=e,this.isExpr=!!t,this.preserveSpace=!!r,this.override=i};r.TokContext=a;var s={b_stat:new a("{",!1),b_expr:new a("{",!0),b_tmpl:new a("${",!0),p_stat:new a("(",!1),p_expr:new a("(",!0),q_tmpl:new a("`",!0,!0,function(e){return e.readTmplToken()}),f_expr:new a("function",!0)};r.types=s,i.types.parenR.updateContext=i.types.braceR.updateContext=function(){if(1===this.state.context.length)return void(this.state.exprAllowed=!0);var e=this.state.context.pop();e===s.b_stat&&this.curContext()===s.f_expr?(this.state.context.pop(),this.state.exprAllowed=!1):e===s.b_tmpl?this.state.exprAllowed=!0:this.state.exprAllowed=!e.isExpr},i.types.braceL.updateContext=function(e){this.state.context.push(this.braceIsBlock(e)?s.b_stat:s.b_expr),this.state.exprAllowed=!0},i.types.dollarBraceL.updateContext=function(){this.state.context.push(s.b_tmpl),this.state.exprAllowed=!0},i.types.parenL.updateContext=function(e){var t=e===i.types._if||e===i.types._for||e===i.types._with||e===i.types._while;this.state.context.push(t?s.p_stat:s.p_expr),this.state.exprAllowed=!0},i.types.incDec.updateContext=function(){},i.types._function.updateContext=function(){this.curContext()!==s.b_stat&&this.state.context.push(s.f_expr),this.state.exprAllowed=!1},i.types.backQuote.updateContext=function(){this.curContext()===s.q_tmpl?this.state.context.pop():this.state.context.push(s.q_tmpl),this.state.exprAllowed=!1}},{621:621}],619:[function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,r){try{return new RegExp(e,t)}catch(n){void 0!==r&&(n instanceof SyntaxError&&this.raise(r,"Error parsing regular expression: "+n.message),this.raise(n))}}function s(e){return 65535>=e?String.fromCharCode(e):String.fromCharCode((e-65536>>10)+55296,(e-65536&1023)+56320)}r.__esModule=!0;var o=e(622),u=e(621),p=e(618),l=e(623),c=e(624),f=e(620),d=n(f),h=function v(e){i(this,v),this.type=e.type,this.value=e.value,this.start=e.start,this.end=e.end,this.loc=new l.SourceLocation(e.startLoc,e.endLoc)};r.Token=h;var m="object"==typeof Packages&&"[object JavaPackage]"===Object.prototype.toString.call(Packages),y=!!a("","u"),g=function(){function e(t){i(this,e),this.state=new d["default"],this.state.init(t)}return e.prototype.next=function(){this.state.tokens.push(new h(this.state)),this.state.lastTokEnd=this.state.end,this.state.lastTokStart=this.state.start,this.state.lastTokEndLoc=this.state.endLoc,this.state.lastTokStartLoc=this.state.startLoc,this.nextToken()},e.prototype.eat=function(e){return this.match(e)?(this.next(),!0):!1},e.prototype.match=function(e){return this.state.type===e},e.prototype.lookahead=function(){var e=this.state;this.state=e.clone(),this.next();var t=this.state.clone();return this.state=e,t},e.prototype.setStrict=function(e){if(this.strict=e,this.match(u.types.num)||this.match(u.types.string)){for(this.state.pos=this.state.start;this.state.pos<this.state.lineStart;)this.state.lineStart=this.input.lastIndexOf("\n",this.state.lineStart-2)+1,--this.state.curLine;this.nextToken()}},e.prototype.curContext=function(){return this.state.context[this.state.context.length-1]},e.prototype.nextToken=function(){var e=this.curContext();return e&&e.preserveSpace||this.skipSpace(),this.state.start=this.state.pos,this.state.startLoc=this.state.curPosition(),this.state.pos>=this.input.length?this.finishToken(u.types.eof):e.override?e.override(this):this.readToken(this.fullCharCodeAtPos())},e.prototype.readToken=function(e){return o.isIdentifierStart(e,!0)||92===e?this.readWord():this.getTokenFromCode(e)},e.prototype.fullCharCodeAtPos=function(){var e=this.input.charCodeAt(this.state.pos);if(55295>=e||e>=57344)return e;var t=this.input.charCodeAt(this.state.pos+1);return(e<<10)+t-56613888},e.prototype.pushComment=function(e,t,r,n,i,a){var s={type:e?"CommentBlock":"CommentLine",value:t,start:r,end:n,loc:new l.SourceLocation(i,a),range:[r,n]};this.state.tokens.push(s),this.state.comments.push(s),this.addComment(s)},e.prototype.skipBlockComment=function(){var e=this.state.curPosition(),t=this.state.pos,r=this.input.indexOf("*/",this.state.pos+=2);-1===r&&this.raise(this.state.pos-2,"Unterminated comment"),this.state.pos=r+2,c.lineBreakG.lastIndex=t;for(var n=void 0;(n=c.lineBreakG.exec(this.input))&&n.index<this.state.pos;)++this.state.curLine,this.state.lineStart=n.index+n[0].length;this.pushComment(!0,this.input.slice(t+2,r),t,this.state.pos,e,this.state.curPosition())},e.prototype.skipLineComment=function(e){for(var t=this.state.pos,r=this.state.curPosition(),n=this.input.charCodeAt(this.state.pos+=e);this.state.pos<this.input.length&&10!==n&&13!==n&&8232!==n&&8233!==n;)++this.state.pos,n=this.input.charCodeAt(this.state.pos);this.pushComment(!1,this.input.slice(t+e,this.state.pos),t,this.state.pos,r,this.state.curPosition())},e.prototype.skipSpace=function(){e:for(;this.state.pos<this.input.length;){var e=this.input.charCodeAt(this.state.pos);switch(e){case 32:case 160:++this.state.pos;break;case 13:10===this.input.charCodeAt(this.state.pos+1)&&++this.state.pos;case 10:case 8232:case 8233:++this.state.pos,++this.state.curLine,this.state.lineStart=this.state.pos;break;case 47:switch(this.input.charCodeAt(this.state.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break e}break;default:if(!(e>8&&14>e||e>=5760&&c.nonASCIIwhitespace.test(String.fromCharCode(e))))break e;++this.state.pos}}},e.prototype.finishToken=function(e,t){this.state.end=this.state.pos,this.state.endLoc=this.state.curPosition();var r=this.state.type;this.state.type=e,this.state.value=t,this.updateContext(r)},e.prototype.readToken_dot=function(){var e=this.input.charCodeAt(this.state.pos+1);if(e>=48&&57>=e)return this.readNumber(!0);var t=this.input.charCodeAt(this.state.pos+2);return 46===e&&46===t?(this.state.pos+=3,
this.finishToken(u.types.ellipsis)):(++this.state.pos,this.finishToken(u.types.dot))},e.prototype.readToken_slash=function(){if(this.state.exprAllowed)return++this.state.pos,this.readRegexp();var e=this.input.charCodeAt(this.state.pos+1);return 61===e?this.finishOp(u.types.assign,2):this.finishOp(u.types.slash,1)},e.prototype.readToken_mult_modulo=function(e){var t=42===e?u.types.star:u.types.modulo,r=1,n=this.input.charCodeAt(this.state.pos+1);return 42===n&&this.options.features["es7.exponentiationOperator"]&&(r++,n=this.input.charCodeAt(this.state.pos+2),t=u.types.exponent),61===n&&(r++,t=u.types.assign),this.finishOp(t,r)},e.prototype.readToken_pipe_amp=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?this.finishOp(124===e?u.types.logicalOR:u.types.logicalAND,2):61===t?this.finishOp(u.types.assign,2):this.finishOp(124===e?u.types.bitwiseOR:u.types.bitwiseAND,1)},e.prototype.readToken_caret=function(){var e=this.input.charCodeAt(this.state.pos+1);return 61===e?this.finishOp(u.types.assign,2):this.finishOp(u.types.bitwiseXOR,1)},e.prototype.readToken_plus_min=function(e){var t=this.input.charCodeAt(this.state.pos+1);return t===e?45===t&&62===this.input.charCodeAt(this.state.pos+2)&&c.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.pos))?(this.skipLineComment(3),this.skipSpace(),this.nextToken()):this.finishOp(u.types.incDec,2):61===t?this.finishOp(u.types.assign,2):this.finishOp(u.types.plusMin,1)},e.prototype.readToken_lt_gt=function(e){var t=this.input.charCodeAt(this.state.pos+1),r=1;return t===e?(r=62===e&&62===this.input.charCodeAt(this.state.pos+2)?3:2,61===this.input.charCodeAt(this.state.pos+r)?this.finishOp(u.types.assign,r+1):this.finishOp(u.types.bitShift,r)):33===t&&60===e&&45===this.input.charCodeAt(this.state.pos+2)&&45===this.input.charCodeAt(this.state.pos+3)?(this.inModule&&this.unexpected(),this.skipLineComment(4),this.skipSpace(),this.nextToken()):(61===t&&(r=61===this.input.charCodeAt(this.state.pos+2)?3:2),this.finishOp(u.types.relational,r))},e.prototype.readToken_eq_excl=function(e){var t=this.input.charCodeAt(this.state.pos+1);return 61===t?this.finishOp(u.types.equality,61===this.input.charCodeAt(this.state.pos+2)?3:2):61===e&&62===t?(this.state.pos+=2,this.finishToken(u.types.arrow)):this.finishOp(61===e?u.types.eq:u.types.prefix,1)},e.prototype.getTokenFromCode=function(e){switch(e){case 46:return this.readToken_dot();case 40:return++this.state.pos,this.finishToken(u.types.parenL);case 41:return++this.state.pos,this.finishToken(u.types.parenR);case 59:return++this.state.pos,this.finishToken(u.types.semi);case 44:return++this.state.pos,this.finishToken(u.types.comma);case 91:return++this.state.pos,this.finishToken(u.types.bracketL);case 93:return++this.state.pos,this.finishToken(u.types.bracketR);case 123:return++this.state.pos,this.finishToken(u.types.braceL);case 125:return++this.state.pos,this.finishToken(u.types.braceR);case 58:return this.options.features["es7.functionBind"]&&58===this.input.charCodeAt(this.state.pos+1)?this.finishOp(u.types.doubleColon,2):(++this.state.pos,this.finishToken(u.types.colon));case 63:return++this.state.pos,this.finishToken(u.types.question);case 64:return++this.state.pos,this.finishToken(u.types.at);case 96:return++this.state.pos,this.finishToken(u.types.backQuote);case 48:var t=this.input.charCodeAt(this.state.pos+1);if(120===t||88===t)return this.readRadixNumber(16);if(111===t||79===t)return this.readRadixNumber(8);if(98===t||66===t)return this.readRadixNumber(2);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(e);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo(e);case 124:case 38:return this.readToken_pipe_amp(e);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(e);case 60:case 62:return this.readToken_lt_gt(e);case 61:case 33:return this.readToken_eq_excl(e);case 126:return this.finishOp(u.types.prefix,1)}this.raise(this.state.pos,"Unexpected character '"+s(e)+"'")},e.prototype.finishOp=function(e,t){var r=this.input.slice(this.state.pos,this.state.pos+t);return this.state.pos+=t,this.finishToken(e,r)},e.prototype.readRegexp=function(){for(var e=this,t=void 0,r=void 0,n=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(n,"Unterminated regular expression");var i=this.input.charAt(this.state.pos);if(c.lineBreak.test(i)&&this.raise(n,"Unterminated regular expression"),t)t=!1;else{if("["===i)r=!0;else if("]"===i&&r)r=!1;else if("/"===i&&!r)break;t="\\"===i}++this.state.pos}var s=this.input.slice(n,this.state.pos);++this.state.pos;var o=this.readWord1(),p=s;if(o){var l=/^[gmsiyu]*$/;l.test(o)||this.raise(n,"Invalid regular expression flag"),o.indexOf("u")>=0&&!y&&(p=p.replace(/\\u\{([0-9a-fA-F]+)\}/g,function(t,r,i){return r=Number("0x"+r),r>1114111&&e.raise(n+i+3,"Code point out of bounds"),"x"}),p=p.replace(/\\u([a-fA-F0-9]{4})|[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x"))}var f=null;return m||(a.call(this,p,void 0,n),f=a.call(this,s,o)),this.finishToken(u.types.regexp,{pattern:s,flags:o,value:f})},e.prototype.readInt=function(e,t){for(var r=this.state.pos,n=0,i=0,a=null==t?1/0:t;a>i;++i){var s=this.input.charCodeAt(this.state.pos),o=void 0;if(o=s>=97?s-97+10:s>=65?s-65+10:s>=48&&57>=s?s-48:1/0,o>=e)break;++this.state.pos,n=n*e+o}return this.state.pos===r||null!=t&&this.state.pos-r!==t?null:n},e.prototype.readRadixNumber=function(e){this.state.pos+=2;var t=this.readInt(e);return null==t&&this.raise(this.state.start+2,"Expected number in radix "+e),o.isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number"),this.finishToken(u.types.num,t)},e.prototype.readNumber=function(e){var t=this.state.pos,r=!1,n=48===this.input.charCodeAt(this.state.pos);e||null!==this.readInt(10)||this.raise(t,"Invalid number");var i=this.input.charCodeAt(this.state.pos);46===i&&(++this.state.pos,this.readInt(10),r=!0,i=this.input.charCodeAt(this.state.pos)),(69===i||101===i)&&(i=this.input.charCodeAt(++this.state.pos),(43===i||45===i)&&++this.state.pos,null===this.readInt(10)&&this.raise(t,"Invalid number"),r=!0),o.isIdentifierStart(this.fullCharCodeAtPos())&&this.raise(this.state.pos,"Identifier directly after number");var a=this.input.slice(t,this.state.pos),s=void 0;return r?s=parseFloat(a):n&&1!==a.length?/[89]/.test(a)||this.strict?this.raise(t,"Invalid number"):s=parseInt(a,8):s=parseInt(a,10),this.finishToken(u.types.num,s)},e.prototype.readCodePoint=function(){var e=this.input.charCodeAt(this.state.pos),t=void 0;if(123===e){var r=++this.state.pos;t=this.readHexChar(this.input.indexOf("}",this.state.pos)-this.state.pos),++this.state.pos,t>1114111&&this.raise(r,"Code point out of bounds")}else t=this.readHexChar(4);return t},e.prototype.readString=function(e){for(var t="",r=++this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated string constant");var n=this.input.charCodeAt(this.state.pos);if(n===e)break;92===n?(t+=this.input.slice(r,this.state.pos),t+=this.readEscapedChar(!1),r=this.state.pos):(c.isNewLine(n)&&this.raise(this.state.start,"Unterminated string constant"),++this.state.pos)}return t+=this.input.slice(r,this.state.pos++),this.finishToken(u.types.string,t)},e.prototype.readTmplToken=function(){for(var e="",t=this.state.pos;;){this.state.pos>=this.input.length&&this.raise(this.state.start,"Unterminated template");var r=this.input.charCodeAt(this.state.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.state.pos+1))return this.state.pos===this.state.start&&this.match(u.types.template)?36===r?(this.state.pos+=2,this.finishToken(u.types.dollarBraceL)):(++this.state.pos,this.finishToken(u.types.backQuote)):(e+=this.input.slice(t,this.state.pos),this.finishToken(u.types.template,e));if(92===r)e+=this.input.slice(t,this.state.pos),e+=this.readEscapedChar(!0),t=this.state.pos;else if(c.isNewLine(r)){switch(e+=this.input.slice(t,this.state.pos),++this.state.pos,r){case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}++this.state.curLine,this.state.lineStart=this.state.pos,t=this.state.pos}else++this.state.pos}},e.prototype.readEscapedChar=function(e){var t=this.input.charCodeAt(++this.state.pos);switch(++this.state.pos,t){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return s(this.readCodePoint());case 116:return" ";case 98:return"\b";case 118:return"";case 102:return"\f";case 13:10===this.input.charCodeAt(this.state.pos)&&++this.state.pos;case 10:return this.state.lineStart=this.state.pos,++this.state.curLine,"";default:if(t>=48&&55>=t){var r=this.input.substr(this.state.pos-1,3).match(/^[0-7]+/)[0],n=parseInt(r,8);return n>255&&(r=r.slice(0,-1),n=parseInt(r,8)),n>0&&(this.strict||e)&&this.raise(this.state.pos-2,"Octal literal in strict mode"),this.state.pos+=r.length-1,String.fromCharCode(n)}return String.fromCharCode(t)}},e.prototype.readHexChar=function(e){var t=this.state.pos,r=this.readInt(16,e);return null===r&&this.raise(t,"Bad character escape sequence"),r},e.prototype.readWord1=function(){this.state.containsEsc=!1;for(var e="",t=!0,r=this.state.pos;this.state.pos<this.input.length;){var n=this.fullCharCodeAtPos();if(o.isIdentifierChar(n,!0))this.state.pos+=65535>=n?1:2;else{if(92!==n)break;this.state.containsEsc=!0,e+=this.input.slice(r,this.state.pos);var i=this.state.pos;117!==this.input.charCodeAt(++this.state.pos)&&this.raise(this.state.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.state.pos;var a=this.readCodePoint();(t?o.isIdentifierStart:o.isIdentifierChar)(a,!0)||this.raise(i,"Invalid Unicode escape"),e+=s(a),r=this.state.pos}t=!1}return e+this.input.slice(r,this.state.pos)},e.prototype.readWord=function(){var e=this.readWord1(),t=u.types.name;return!this.state.containsEsc&&this.isKeyword(e)&&(t=u.keywords[e]),this.finishToken(t,e)},e.prototype.braceIsBlock=function(e){if(e===u.types.colon){var t=this.curContext();if(t===p.types.b_stat||t===p.types.b_expr)return!t.isExpr}return e===u.types._return?c.lineBreak.test(this.input.slice(this.state.lastTokEnd,this.state.start)):e===u.types._else||e===u.types.semi||e===u.types.eof||e===u.types.parenR?!0:e===u.types.braceL?this.curContext()===p.types.b_stat:!this.state.exprAllowed},e.prototype.updateContext=function(e){var t=void 0,r=this.state.type;r.keyword&&e===u.types.dot?this.state.exprAllowed=!1:(t=r.updateContext)?t.call(this,e):this.state.exprAllowed=r.beforeExpr},e}();r["default"]=g},{618:618,620:620,621:621,622:622,623:623,624:624}],620:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}r.__esModule=!0;var i=e(623),a=e(618),s=e(621),o=function(){function e(){n(this,e)}return e.prototype.init=function(e){return this.input=e,this.potentialArrowAt=-1,this.inFunction=this.inGenerator=!1,this.labels=[],this.decorators=[],this.tokens=[],this.comments=[],this.trailingComments=[],this.leadingComments=[],this.commentStack=[],this.pos=this.lineStart=0,this.curLine=1,this.type=s.types.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=[a.types.b_stat],this.exprAllowed=!0,this.containsEsc=!1,this},e.prototype.curPosition=function(){return new i.Position(this.curLine,this.pos-this.lineStart)},e.prototype.clone=function(){var t=new e;for(var r in this){var n=this[r];Array.isArray(n)&&(n=n.slice()),t[r]=n}return t},e}();r["default"]=o,t.exports=r["default"]},{618:618,621:621,623:623}],621:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){return new s(e,{beforeExpr:!0,binop:t})}function a(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];t.keyword=e,l[e]=p["_"+e]=new s(e,t)}r.__esModule=!0;var s=function c(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];n(this,c),this.label=e,this.keyword=t.keyword,this.beforeExpr=!!t.beforeExpr,this.startsExpr=!!t.startsExpr,this.rightAssociative=!!t.rightAssociative,this.isLoop=!!t.isLoop,this.isAssign=!!t.isAssign,this.prefix=!!t.prefix,this.postfix=!!t.postfix,this.binop=t.binop||null,this.updateContext=null};r.TokenType=s;var o={beforeExpr:!0},u={startsExpr:!0},p={num:new s("num",u),regexp:new s("regexp",u),string:new s("string",u),name:new s("name",u),eof:new s("eof"),bracketL:new s("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new s("]"),braceL:new s("{",{beforeExpr:!0,startsExpr:!0}),braceR:new s("}"),parenL:new s("(",{beforeExpr:!0,startsExpr:!0}),parenR:new s(")"),comma:new s(",",o),semi:new s(";",o),colon:new s(":",o),doubleColon:new s("::",o),dot:new s("."),question:new s("?",o),arrow:new s("=>",o),template:new s("template"),ellipsis:new s("...",o),backQuote:new s("`",u),dollarBraceL:new s("${",{beforeExpr:!0,startsExpr:!0}),at:new s("@"),eq:new s("=",{beforeExpr:!0,isAssign:!0}),assign:new s("_=",{beforeExpr:!0,isAssign:!0}),incDec:new s("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new s("prefix",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:i("||",1),logicalAND:i("&&",2),bitwiseOR:i("|",3),bitwiseXOR:i("^",4),bitwiseAND:i("&",5),equality:i("==/!=",6),relational:i("</>",7),bitShift:i("<</>>",8),plusMin:new s("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:i("%",10),star:i("*",10),slash:i("/",10),exponent:new s("**",{beforeExpr:!0,binop:11,rightAssociative:!0})};r.types=p;var l={};r.keywords=l,a("break"),a("case",o),a("catch"),a("continue"),a("debugger"),a("default",o),a("do",{isLoop:!0}),a("else",o),a("finally"),a("for",{isLoop:!0}),a("function",u),a("if"),a("return",o),a("switch"),a("throw",o),a("try"),a("var"),a("let"),a("const"),a("while",{isLoop:!0}),a("with"),a("new",{beforeExpr:!0,startsExpr:!0}),a("this",u),a("super",u),a("class"),a("extends",o),a("export"),a("import"),a("yield",{beforeExpr:!0,startsExpr:!0}),a("null",u),a("true",u),a("false",u),a("in",{beforeExpr:!0,binop:7}),a("instanceof",{beforeExpr:!0,binop:7}),a("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),a("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),a("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},{}],622:[function(e,t,r){"use strict";function n(e){return e=e.split(" "),function(t){return e.indexOf(t)>=0}}function i(e,t){for(var r=65536,n=0;n<t.length;n+=2){if(r+=t[n],r>e)return!1;if(r+=t[n+1],r>=e)return!0}}function a(e){return 65>e?36===e:91>e?!0:97>e?95===e:123>e?!0:65535>=e?e>=170&&c.test(String.fromCharCode(e)):i(e,d)}function s(e){return 48>e?36===e:58>e?!0:65>e?!1:91>e?!0:97>e?95===e:123>e?!0:65535>=e?e>=170&&f.test(String.fromCharCode(e)):i(e,d)||i(e,h)}r.__esModule=!0,r.isIdentifierStart=a,r.isIdentifierChar=s;var o={6:n("enum await"),strict:n("implements interface let package private protected public static yield"),strictBind:n("eval arguments")};r.reservedWords=o;var u=n("break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this let const class extends export import yield super");r.isKeyword=u;var p="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠ-ࢲऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞭꞰꞱꟷ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭟꭤꭥꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",l="·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఃా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഁ-ഃാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ංඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ູົຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏ᦰ-ᧀᧈᧉ᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭ᳲ-᳴᳸᳹᷀-᷵᷼-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧꢀꢁꢴ-꣄꣐-꣙꣠-꣱꤀-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︭︳︴﹍-﹏0-9_",c=new RegExp("["+p+"]"),f=new RegExp("["+p+l+"]");p=l=null;var d=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,17,26,6,37,11,29,3,35,5,7,2,4,43,157,99,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,98,21,11,25,71,55,7,1,65,0,16,3,2,2,2,26,45,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,955,52,76,44,33,24,27,35,42,34,4,0,13,47,15,3,22,0,38,17,2,24,133,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,32,4,287,47,21,1,2,0,185,46,82,47,21,0,60,42,502,63,32,0,449,56,1288,920,104,110,2962,1070,13266,568,8,30,114,29,19,47,17,3,32,20,6,18,881,68,12,0,67,12,16481,1,3071,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,4149,196,1340,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42710,42,4148,12,221,16355,541],h=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,1306,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,52,0,13,2,49,13,16,9,83,11,168,11,6,9,8,2,57,0,2,6,3,1,3,2,10,0,11,1,3,6,4,4,316,19,13,9,214,6,3,8,112,16,16,9,82,12,9,9,535,9,20855,9,135,4,60,6,26,9,1016,45,17,3,19723,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,4305,6,792618,239]},{}],623:[function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){for(var r=1,n=0;;){a.lineBreakG.lastIndex=n;var i=a.lineBreakG.exec(e);if(!(i&&i.index<t))return new s(r,t-n);++r,n=i.index+i[0].length}}r.__esModule=!0,r.getLineInfo=i;var a=e(624),s=function u(e,t){n(this,u),this.line=e,this.column=t};r.Position=s;var o=function p(e,t){n(this,p),this.start=e,this.end=t};r.SourceLocation=o},{624:624}],624:[function(e,t,r){"use strict";function n(e){return 10===e||13===e||8232===e||8233===e}r.__esModule=!0,r.isNewLine=n;var i=/\r\n?|\n|\u2028|\u2029/;r.lineBreak=i;var a=new RegExp(i.source,"g");r.lineBreakG=a;var s=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;r.nonASCIIwhitespace=s},{}]},{},[14])(14)});
|
packages/material-ui-icons/src/Movie.js
|
kybarg/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<path d="M18 4l2 4h-3l-2-4h-2l2 4h-3l-2-4H8l2 4H7L5 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4h-4z" />
, 'Movie');
|
public/js/11D.js
|
ritchieanesco/frontendmastersreact
|
/* Setting application state */
import React from 'react'
// type annotataions for data
const {string} = React.PropTypes
const ShowCard = React.createClass({
propTypes: {
poster: string,
title: string,
year: string,
description: string
},
render () {
// destructuring - e6 feature
const { poster, title, year, description } = this.props
return (
<div className='show-card'>
<img src={`/public/img/posters/${poster}`} />
<div>
<h3>{title}</h3>
<h4>({year})</h4>
<p>{description}</p>
</div>
</div>
)
}
})
export default ShowCard
|
packages/material-ui-icons/src/StraightenTwoTone.js
|
Kagami/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path fill="none" d="M0 0h24v24H0V0z" /><g><path d="M19 12h-2V8h-2v4h-2V8h-2v4H9V8H7v4H5V8H3v8h18V8h-2z" opacity=".3" /><path d="M21 6H3c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 10H3V8h2v4h2V8h2v4h2V8h2v4h2V8h2v4h2V8h2v8z" /></g></React.Fragment>
, 'StraightenTwoTone');
|
src/routes/login/index.js
|
kdama/react-starter-kit-twitter
|
/**
* React Starter Kit (https://www.reactstarterkit.com/)
*
* Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
import React from 'react';
import Login from './Login';
export default {
path: '/login',
action() {
return <Login />;
},
};
|
src/view/catalog/pre-text.js
|
NaNuNoo/Matcha
|
import { withStyles } from 'material-ui/styles';
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import PreBase from './pre-base';
import styles from './pre-text-styles';
function _PreText({
classes, path, title, author, date, html
}) {
const newContent = (
<div>
<div dangerouslySetInnerHTML={{ __html: html }} />
<span>Read More>></span>
</div>
);
return (
<PreBase
path={path}
title={title}
author={author}
date={date}
content={newContent}
extraClasses={classes}
/>
);
}
_PreText.propsType = {
path: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
author: PropTypes.string.isRequired,
date: PropTypes.string.isRequired,
html: PropTypes.string.isRequired,
};
export const PreText = withStyles(styles)(_PreText);
|
admin/client/App/index.js
|
frontyard/keystone
|
/**
* This is the main entry file, which we compile the main JS bundle from. It
* only contains the client side routing setup.
*/
// Needed for ES6 generators (redux-saga) to work
import '@babel/polyfill';
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Route, browserHistory, IndexRoute } from 'react-router';
import { Provider } from 'react-redux';
import { syncHistoryWithStore } from 'react-router-redux';
import App from './App';
import Home from './screens/Home';
import Item from './screens/Item';
import List from './screens/List';
import store from './store';
// Sync the browser history to the Redux store
const history = syncHistoryWithStore(browserHistory, store);
// Initialise Keystone.User list
import { listsByKey } from '../utils/lists';
Keystone.User = listsByKey[Keystone.userList];
ReactDOM.render(
<Provider store={store}>
<Router history={history}>
<Route path={Keystone.adminPath} component={App}>
<IndexRoute component={Home} />
<Route path=":listId" component={List} />
<Route path=":listId/:itemId" component={Item} />
</Route>
</Router>
</Provider>,
document.getElementById('react-root')
);
|
client/modules/map/form.js
|
jozecarlos/bloodonors
|
import React, { Component } from 'react';
import {
Modal,
ModalHeader,
ModalTitle,
ModalClose,
ModalBody,
ModalFooter,
} from 'react-modal-bootstrap';
import axios from 'axios';
export default class Form extends Component {
constructor(props) {
super(props);
this.state = { isOpen: false,
donor: {
firstName: '',
lastName: '',
email: '',
contactNumber: '',
address: '',
bloodGroup: '',
},
};
}
componentDidMount() {
const self = this;
this.props.socket.on('response:add', evt => {
if (evt.type === 'add:donors') {
self.hideModal();
}
});
}
componentWillReceiveProps(nextProps) {
if (nextProps.isOpen !== this.state.isOpen) {
this.setState({ isOpen: nextProps.isOpen });
}
}
onSubmit = () => {
this.props.onSubmit(this.state.donor);
}
hideModal = () => {
this.props.hideModal();
};
handleChange = ({ target }) => {
const donor = this.state.donor;
donor[target.id] = target.value;
this.setState(donor);
}
render() {
return (
<Modal isOpen={this.state.isOpen} onRequestHide={this.hideModal}>
<ModalHeader>
<ModalTitle>Save a life, Give Blood</ModalTitle>
<ModalClose onClick={this.hideModal} />
</ModalHeader>
<ModalBody>
<div className={"row"}>
<div className="col-md-6 form-group">
<div className="form-group">
<label htmlFor="firstName">First Name:</label>
<input type="text" className="form-control" id="firstName"
value={this.state.donor.firstName} onChange={this.handleChange} />
</div>
<div className="form-group">
<label htmlFor="lastName">Last Name:</label>
<input type="text" className="form-control"
id="lastName" onChange={this.handleChange}
value={this.state.donor.lastName} />
</div>
<div className="form-group">
<label htmlFor="email">Email address:</label>
<input type="email" className="form-control" id="email"
onChange={this.handleChange} value={this.state.donor.email} />
</div>
</div>
<div className="col-md-6 form-group">
<div className="form-group">
<label htmlFor="contactNumber">Contact Number:</label>
<input type="text" className="form-control" id="contactNumber"
onChange={this.handleChange} value={this.state.donor.contactNumber} />
</div>
<div className="form-group">
<label htmlFor="address">Address:</label>
<input type="text" className="form-control" id="address"
onChange={this.handleChange} value={this.state.donor.address} />
</div>
<div className="form-group">
<label htmlFor="bloodGroup">Blood Group:</label>
<select
onChange={this.handleChange}
value={this.state.donor.bloodGroup}
className="form-control" id="bloodGroup">
<option value="A">A</option>
<option value="B">B</option>
<option value="AB">AB</option>
<option value="AB">O</option>
</select>
</div>
</div>
</div>
</ModalBody>
<ModalFooter>
<button className="btn btn-default" onClick={this.hideModal}>
Close
</button>
<button className="btn btn-primary" onClick={this.onSubmit}>
Save
</button>
</ModalFooter>
</Modal>);
}
}
|
pathfinder/vtables/applicationcloudmaturityandadoption/src/common/Link.js
|
leanix/leanix-custom-reports
|
import React, { Component } from 'react';
import PropTypes from 'prop-types';
class Link extends Component {
constructor(props) {
super(props);
this._handleClick = this._handleClick.bind(this);
}
_handleClick(e) {
e.preventDefault();
lx.openLink(this.props.link, this.props.target);
}
render() {
if (!this.props.link || !this.props.target || !this.props.text) {
return null;
}
switch (this.props.target) {
case '_blank':
return (
<a href={this.props.link}
title='Opens a new tab/window.'
target={this.props.target}
onClick={this._handleClick}
>{this.props.text}</a>
);
default:
return (
<a href={this.props.link}
target={this.props.target}
onClick={this._handleClick}
>{this.props.text}</a>
);
}
}
}
Link.propTypes = {
link: PropTypes.string.isRequired,
target: PropTypes.string.isRequired,
text: PropTypes.string.isRequired
};
export default Link;
|
packages/react-codemod/test/pure-render-mixin-test3.output.js
|
kakadiya91/react
|
var React = require('react/addons');
var Foo = 'Foo';
var MyComponent = React.createClass({
shouldComponentUpdate: function(nextProps, nextState) {
return React.addons.shallowCompare(this, nextProps, nextState);
},
render: function() {
return <div />;
}
});
module.exports = MyComponent;
|
components/Modal/ModalPortal.js
|
scott-riley/loggins
|
import React from 'react';
import cx from 'react/lib/cx';
export default React.createClass({
propTypes: {
className: React.PropTypes.string,
isOpen: React.PropTypes.bool.isRequired,
onRequestClose: React.PropTypes.func,
children: React.PropTypes.any,
},
backgroundClick(e) {
if (e.target.classList.contains('modal-container')) {
this.props.onRequestClose(e);
}
},
render() {
const classes = cx({
'is-open': this.props.isOpen,
});
// TODO: share code with Dropdown for non-this clicks
return (
<div onClick={this.backgroundClick} className={`Modal ${this.props.className} ${classes}`}>
{this.props.onRequestClose ?
<button
className="Modal-close button button--mimic-link ss-delete"
onClick={this.props.onRequestClose}
/>
: null
}
<div className="Modal-window">
<div className="Modal-window-inner">
{this.props.children}
</div>
</div>
</div>
);
},
});
|
app/index.js
|
JCombee/wallet
|
import React from 'react';
import { render } from 'react-dom';
import { Provider } from 'react-redux';
import { Router, hashHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import routes from './routes';
import configureStore from './store/configureStore';
import './app.global.css';
const store = configureStore();
const history = syncHistoryWithStore(hashHistory, store);
render(
<Provider store={store}>
<Router history={history} routes={routes} />
</Provider>,
document.getElementById('root')
);
|
src/routes/UIElement/dropOption/index.js
|
IssaTan1990/antd-admin
|
import React from 'react'
import { DropOption } from '../../../components'
import { Table, Row, Col, Card, message } from 'antd'
const DropOptionPage = () => <div className="content-inner">
<Row gutter={32}>
<Col lg={8} md={12}>
<Card title="默认">
<DropOption menuOptions={[{ key: '1', name: '编辑' }, { key: '2', name: '删除' }]} />
</Card>
</Col>
<Col lg={8} md={12}>
<Card title="样式">
<DropOption menuOptions={[{ key: '1', name: '编辑' }, { key: '2', name: '删除' }]} buttonStyle={{ border: 'solid 1px #eee', width: 60 }} />
</Card>
</Col>
<Col lg={8} md={12}>
<Card title="事件">
<DropOption
menuOptions={[{ key: '1', name: '编辑' }, { key: '2', name: '删除' }]}
buttonStyle={{ border: 'solid 1px #eee', width: 60 }}
onMenuClick={({ key }) => {
switch (key) {
case '1':
message.success('点击了编辑')
break
case '2':
message.success('点击了删除')
break
default:
break
}
}}
/>
</Card>
</Col>
</Row>
<h2 style={{ margin: '16px 0' }}>Props</h2>
<Row>
<Col lg={18} md={24}>
<Table
rowKey={(record, key) => key}
pagination={false}
bordered
scroll={{ x: 800 }}
columns={[
{
title: '参数',
dataIndex: 'props',
},
{
title: '说明',
dataIndex: 'desciption',
},
{
title: '类型',
dataIndex: 'type',
},
{
title: '默认值',
dataIndex: 'default',
},
]}
dataSource={[
{
props: 'menuOptions',
desciption: '下拉操作的选项,格式为[{name:string,key:string}]',
type: 'Array',
default: '必选',
},
{
props: 'onMenuClick',
desciption: '点击 menuitem 调用此函数,参数为 {item, key, keyPath}',
type: 'Function',
default: '-',
},
{
props: 'buttonStyle',
desciption: '按钮的样式',
type: 'Object',
default: '-',
},
{
props: 'dropdownProps',
desciption: '下拉菜单的参数,可参考antd的【Dropdown】组件',
type: 'Object',
default: '-',
},
]}
/>
</Col>
</Row>
</div>
export default DropOptionPage
|
app/containers/MainView.js
|
transparantnederland/browser
|
import React from 'react';
import { DragDropContext } from 'react-dnd';
import HTML5Backend from 'react-dnd-html5-backend';
import TwoColumnLayout from '../layouts/TwoColumnLayout';
import ResultPanel from './ResultPanel';
import DetailPanel from './DetailPanel';
const MainView = React.createClass({
shouldComponentUpdate() {
return false;
},
render() {
return (
<TwoColumnLayout>
<ResultPanel />
<DetailPanel />
</TwoColumnLayout>
);
},
});
export default DragDropContext(HTML5Backend)(MainView);
|
app/containers/RepoListItem/index.js
|
Demonslyr/Donut.WFE.Customer
|
/**
* RepoListItem
*
* Lists the name and the issue count of a repository
*/
import React from 'react';
import PropTypes from 'prop-types';
import { connect } from 'react-redux';
import { createStructuredSelector } from 'reselect';
import { FormattedNumber } from 'react-intl';
import { makeSelectCurrentUser } from 'containers/App/selectors';
import ListItem from 'components/ListItem';
import IssueIcon from './IssueIcon';
import IssueLink from './IssueLink';
import RepoLink from './RepoLink';
import Wrapper from './Wrapper';
export class RepoListItem extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
render() {
const item = this.props.item;
let nameprefix = '';
// If the repository is owned by a different person than we got the data for
// it's a fork and we should show the name of the owner
if (item.owner.login !== this.props.currentUser) {
nameprefix = `${item.owner.login}/`;
}
// Put together the content of the repository
const content = (
<Wrapper>
<RepoLink href={item.html_url} target="_blank">
{nameprefix + item.name}
</RepoLink>
<IssueLink href={`${item.html_url}/issues`} target="_blank">
<IssueIcon />
<FormattedNumber value={item.open_issues_count} />
</IssueLink>
</Wrapper>
);
// Render the content into a list item
return (
<ListItem key={`repo-list-item-${item.full_name}`} item={content} />
);
}
}
RepoListItem.propTypes = {
item: PropTypes.object,
currentUser: PropTypes.string,
};
export default connect(createStructuredSelector({
currentUser: makeSelectCurrentUser(),
}))(RepoListItem);
|
src/svg-icons/action/line-style.js
|
verdan/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from '../../SvgIcon';
let ActionLineStyle = (props) => (
<SvgIcon {...props}>
<path d="M3 16h5v-2H3v2zm6.5 0h5v-2h-5v2zm6.5 0h5v-2h-5v2zM3 20h2v-2H3v2zm4 0h2v-2H7v2zm4 0h2v-2h-2v2zm4 0h2v-2h-2v2zm4 0h2v-2h-2v2zM3 12h8v-2H3v2zm10 0h8v-2h-8v2zM3 4v4h18V4H3z"/>
</SvgIcon>
);
ActionLineStyle = pure(ActionLineStyle);
ActionLineStyle.displayName = 'ActionLineStyle';
ActionLineStyle.muiName = 'SvgIcon';
export default ActionLineStyle;
|
ajax/libs/yui/3.8.0pr1/event-custom-base/event-custom-base-debug.js
|
dannyxx001/cdnjs
|
YUI.add('event-custom-base', function (Y, NAME) {
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
*/
Y.Env.evt = {
handles: {},
plugins: {}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* Allows for the insertion of methods that are executed before or after
* a specified method
* @class Do
* @static
*/
var DO_BEFORE = 0,
DO_AFTER = 1,
DO = {
/**
* Cache of objects touched by the utility
* @property objs
* @static
* @deprecated Since 3.6.0. The `_yuiaop` property on the AOP'd object
* replaces the role of this property, but is considered to be private, and
* is only mentioned to provide a migration path.
*
* If you have a use case which warrants migration to the _yuiaop property,
* please file a ticket to let us know what it's used for and we can see if
* we need to expose hooks for that functionality more formally.
*/
objs: null,
/**
* <p>Execute the supplied method before the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterArgs(message, newArgArray)</code></dt>
* <dd>Replace the arguments that the original function will be
* called with.</dd>
* <dt></code>Y.Do.Prevent(message)</code></dt>
* <dd>Don't execute the wrapped function. Other before phase
* wrappers will be executed.</dd>
* </dl>
*
* @method before
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {string} handle for the subscription
* @static
*/
before: function(fn, obj, sFn, c) {
// Y.log('Do before: ' + sFn, 'info', 'event');
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_BEFORE, f, obj, sFn);
},
/**
* <p>Execute the supplied method after the specified function. Wrapping
* function may optionally return an instance of the following classes to
* further alter runtime behavior:</p>
* <dl>
* <dt></code>Y.Do.Halt(message, returnValue)</code></dt>
* <dd>Immediatly stop execution and return
* <code>returnValue</code>. No other wrapping functions will be
* executed.</dd>
* <dt></code>Y.Do.AlterReturn(message, returnValue)</code></dt>
* <dd>Return <code>returnValue</code> instead of the wrapped
* method's original return value. This can be further altered by
* other after phase wrappers.</dd>
* </dl>
*
* <p>The static properties <code>Y.Do.originalRetVal</code> and
* <code>Y.Do.currentRetVal</code> will be populated for reference.</p>
*
* @method after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @param arg* {mixed} 0..n additional arguments to supply to the subscriber
* @return {string} handle for the subscription
* @static
*/
after: function(fn, obj, sFn, c) {
var f = fn, a;
if (c) {
a = [fn, c].concat(Y.Array(arguments, 4, true));
f = Y.rbind.apply(Y, a);
}
return this._inject(DO_AFTER, f, obj, sFn);
},
/**
* Execute the supplied method before or after the specified function.
* Used by <code>before</code> and <code>after</code>.
*
* @method _inject
* @param when {string} before or after
* @param fn {Function} the function to execute
* @param obj the object hosting the method to displace
* @param sFn {string} the name of the method to displace
* @param c The execution context for fn
* @return {string} handle for the subscription
* @private
* @static
*/
_inject: function(when, fn, obj, sFn) {
// object id
var id = Y.stamp(obj), o, sid;
if (!obj._yuiaop) {
// create a map entry for the obj if it doesn't exist, to hold overridden methods
obj._yuiaop = {};
}
o = obj._yuiaop;
if (!o[sFn]) {
// create a map entry for the method if it doesn't exist
o[sFn] = new Y.Do.Method(obj, sFn);
// re-route the method to our wrapper
obj[sFn] = function() {
return o[sFn].exec.apply(o[sFn], arguments);
};
}
// subscriber id
sid = id + Y.stamp(fn) + sFn;
// register the callback
o[sFn].register(sid, fn, when);
return new Y.EventHandle(o[sFn], sid);
},
/**
* Detach a before or after subscription.
*
* @method detach
* @param handle {string} the subscription handle
* @static
*/
detach: function(handle) {
if (handle.detach) {
handle.detach();
}
},
_unload: function(e, me) {
}
};
Y.Do = DO;
//////////////////////////////////////////////////////////////////////////
/**
* Contains the return value from the wrapped method, accessible
* by 'after' event listeners.
*
* @property originalRetVal
* @static
* @since 3.2.0
*/
/**
* Contains the current state of the return value, consumable by
* 'after' event listeners, and updated if an after subscriber
* changes the return value generated by the wrapped function.
*
* @property currentRetVal
* @static
* @since 3.2.0
*/
//////////////////////////////////////////////////////////////////////////
/**
* Wrapper for a displaced method with aop enabled
* @class Do.Method
* @constructor
* @param obj The object to operate on
* @param sFn The name of the method to displace
*/
DO.Method = function(obj, sFn) {
this.obj = obj;
this.methodName = sFn;
this.method = obj[sFn];
this.before = {};
this.after = {};
};
/**
* Register a aop subscriber
* @method register
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype.register = function (sid, fn, when) {
if (when) {
this.after[sid] = fn;
} else {
this.before[sid] = fn;
}
};
/**
* Unregister a aop subscriber
* @method delete
* @param sid {string} the subscriber id
* @param fn {Function} the function to execute
* @param when {string} when to execute the function
*/
DO.Method.prototype._delete = function (sid) {
// Y.log('Y.Do._delete: ' + sid, 'info', 'Event');
delete this.before[sid];
delete this.after[sid];
};
/**
* <p>Execute the wrapped method. All arguments are passed into the wrapping
* functions. If any of the before wrappers return an instance of
* <code>Y.Do.Halt</code> or <code>Y.Do.Prevent</code>, neither the wrapped
* function nor any after phase subscribers will be executed.</p>
*
* <p>The return value will be the return value of the wrapped function or one
* provided by a wrapper function via an instance of <code>Y.Do.Halt</code> or
* <code>Y.Do.AlterReturn</code>.
*
* @method exec
* @param arg* {any} Arguments are passed to the wrapping and wrapped functions
* @return {any} Return value of wrapped function unless overwritten (see above)
*/
DO.Method.prototype.exec = function () {
var args = Y.Array(arguments, 0, true),
i, ret, newRet,
bf = this.before,
af = this.after,
prevented = false;
// execute before
for (i in bf) {
if (bf.hasOwnProperty(i)) {
ret = bf[i].apply(this.obj, args);
if (ret) {
switch (ret.constructor) {
case DO.Halt:
return ret.retVal;
case DO.AlterArgs:
args = ret.newArgs;
break;
case DO.Prevent:
prevented = true;
break;
default:
}
}
}
}
// execute method
if (!prevented) {
ret = this.method.apply(this.obj, args);
}
DO.originalRetVal = ret;
DO.currentRetVal = ret;
// execute after methods.
for (i in af) {
if (af.hasOwnProperty(i)) {
newRet = af[i].apply(this.obj, args);
// Stop processing if a Halt object is returned
if (newRet && newRet.constructor == DO.Halt) {
return newRet.retVal;
// Check for a new return value
} else if (newRet && newRet.constructor == DO.AlterReturn) {
ret = newRet.newRetVal;
// Update the static retval state
DO.currentRetVal = ret;
}
}
}
return ret;
};
//////////////////////////////////////////////////////////////////////////
/**
* Return an AlterArgs object when you want to change the arguments that
* were passed into the function. Useful for Do.before subscribers. An
* example would be a service that scrubs out illegal characters prior to
* executing the core business logic.
* @class Do.AlterArgs
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newArgs {Array} Call parameters to be used for the original method
* instead of the arguments originally passed in.
*/
DO.AlterArgs = function(msg, newArgs) {
this.msg = msg;
this.newArgs = newArgs;
};
/**
* Return an AlterReturn object when you want to change the result returned
* from the core method to the caller. Useful for Do.after subscribers.
* @class Do.AlterReturn
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param newRetVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.AlterReturn = function(msg, newRetVal) {
this.msg = msg;
this.newRetVal = newRetVal;
};
/**
* Return a Halt object when you want to terminate the execution
* of all subsequent subscribers as well as the wrapped method
* if it has not exectued yet. Useful for Do.before subscribers.
* @class Do.Halt
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
*/
DO.Halt = function(msg, retVal) {
this.msg = msg;
this.retVal = retVal;
};
/**
* Return a Prevent object when you want to prevent the wrapped function
* from executing, but want the remaining listeners to execute. Useful
* for Do.before subscribers.
* @class Do.Prevent
* @constructor
* @param msg {String} (optional) Explanation of why the termination was done
*/
DO.Prevent = function(msg) {
this.msg = msg;
};
/**
* Return an Error object when you want to terminate the execution
* of all subsequent method calls.
* @class Do.Error
* @constructor
* @param msg {String} (optional) Explanation of the altered return value
* @param retVal {any} Return value passed to code that invoked the wrapped
* function.
* @deprecated use Y.Do.Halt or Y.Do.Prevent
*/
DO.Error = DO.Halt;
//////////////////////////////////////////////////////////////////////////
// Y["Event"] && Y.Event.addListener(window, "unload", Y.Do._unload, Y.Do);
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
// var onsubscribeType = "_event:onsub",
var YArray = Y.Array,
AFTER = 'after',
CONFIGS = [
'broadcast',
'monitored',
'bubbles',
'context',
'contextFn',
'currentTarget',
'defaultFn',
'defaultTargetOnly',
'details',
'emitFacade',
'fireOnce',
'async',
'host',
'preventable',
'preventedFn',
'queuable',
'silent',
'stoppedFn',
'target',
'type'
],
CONFIGS_HASH = YArray.hash(CONFIGS),
nativeSlice = Array.prototype.slice,
YUI3_SIGNATURE = 9,
YUI_LOG = 'yui:log',
mixConfigs = function(r, s, ov) {
var p;
for (p in s) {
if (CONFIGS_HASH[p] && (ov || !(p in r))) {
r[p] = s[p];
}
}
return r;
};
/**
* The CustomEvent class lets you define events for your application
* that can be subscribed to by one or more independent component.
*
* @param {String} type The type of event, which is passed to the callback
* when the event fires.
* @param {object} o configuration object.
* @class CustomEvent
* @constructor
*/
Y.CustomEvent = function(type, o) {
this._kds = Y.CustomEvent.keepDeprecatedSubs;
o = o || {};
this.id = Y.stamp(this);
/**
* The type of event, returned to subscribers when the event fires
* @property type
* @type string
*/
this.type = type;
/**
* The context the the event will fire from by default. Defaults to the YUI
* instance.
* @property context
* @type object
*/
this.context = Y;
/**
* Monitor when an event is attached or detached.
*
* @property monitored
* @type boolean
*/
// this.monitored = false;
this.logSystem = (type == YUI_LOG);
/**
* If 0, this event does not broadcast. If 1, the YUI instance is notified
* every time this event fires. If 2, the YUI instance and the YUI global
* (if event is enabled on the global) are notified every time this event
* fires.
* @property broadcast
* @type int
*/
// this.broadcast = 0;
/**
* By default all custom events are logged in the debug build, set silent
* to true to disable debug outpu for this event.
* @property silent
* @type boolean
*/
this.silent = this.logSystem;
/**
* Specifies whether this event should be queued when the host is actively
* processing an event. This will effect exectution order of the callbacks
* for the various events.
* @property queuable
* @type boolean
* @default false
*/
// this.queuable = false;
/**
* The subscribers to this event
* @property subscribers
* @type Subscriber {}
* @deprecated
*/
if (this._kds) {
this.subscribers = {};
}
/**
* The subscribers to this event
* @property _subscribers
* @type Subscriber []
* @private
*/
this._subscribers = [];
/**
* 'After' subscribers
* @property afters
* @type Subscriber {}
*/
if (this._kds) {
this.afters = {};
}
/**
* 'After' subscribers
* @property _afters
* @type Subscriber []
* @private
*/
this._afters = [];
/**
* This event has fired if true
*
* @property fired
* @type boolean
* @default false;
*/
// this.fired = false;
/**
* An array containing the arguments the custom event
* was last fired with.
* @property firedWith
* @type Array
*/
// this.firedWith;
/**
* This event should only fire one time if true, and if
* it has fired, any new subscribers should be notified
* immediately.
*
* @property fireOnce
* @type boolean
* @default false;
*/
// this.fireOnce = false;
/**
* fireOnce listeners will fire syncronously unless async
* is set to true
* @property async
* @type boolean
* @default false
*/
//this.async = false;
/**
* Flag for stopPropagation that is modified during fire()
* 1 means to stop propagation to bubble targets. 2 means
* to also stop additional subscribers on this target.
* @property stopped
* @type int
*/
// this.stopped = 0;
/**
* Flag for preventDefault that is modified during fire().
* if it is not 0, the default behavior for this event
* @property prevented
* @type int
*/
// this.prevented = 0;
/**
* Specifies the host for this custom event. This is used
* to enable event bubbling
* @property host
* @type EventTarget
*/
// this.host = null;
/**
* The default function to execute after event listeners
* have fire, but only if the default action was not
* prevented.
* @property defaultFn
* @type Function
*/
// this.defaultFn = null;
/**
* The function to execute if a subscriber calls
* stopPropagation or stopImmediatePropagation
* @property stoppedFn
* @type Function
*/
// this.stoppedFn = null;
/**
* The function to execute if a subscriber calls
* preventDefault
* @property preventedFn
* @type Function
*/
// this.preventedFn = null;
/**
* Specifies whether or not this event's default function
* can be cancelled by a subscriber by executing preventDefault()
* on the event facade
* @property preventable
* @type boolean
* @default true
*/
this.preventable = true;
/**
* Specifies whether or not a subscriber can stop the event propagation
* via stopPropagation(), stopImmediatePropagation(), or halt()
*
* Events can only bubble if emitFacade is true.
*
* @property bubbles
* @type boolean
* @default true
*/
this.bubbles = true;
/**
* Supports multiple options for listener signatures in order to
* port YUI 2 apps.
* @property signature
* @type int
* @default 9
*/
this.signature = YUI3_SIGNATURE;
// this.subCount = 0;
// this.afterCount = 0;
// this.hasSubscribers = false;
// this.hasAfters = false;
/**
* If set to true, the custom event will deliver an EventFacade object
* that is similar to a DOM event object.
* @property emitFacade
* @type boolean
* @default false
*/
// this.emitFacade = false;
this.applyConfig(o, true);
// this.log("Creating " + this.type);
};
/**
* Static flag to enable population of the <a href="#property_subscribers">`subscribers`</a>
* and <a href="#property_subscribers">`afters`</a> properties held on a `CustomEvent` instance.
*
* These properties were changed to private properties (`_subscribers` and `_afters`), and
* converted from objects to arrays for performance reasons.
*
* Setting this property to true will populate the deprecated `subscribers` and `afters`
* properties for people who may be using them (which is expected to be rare). There will
* be a performance hit, compared to the new array based implementation.
*
* If you are using these deprecated properties for a use case which the public API
* does not support, please file an enhancement request, and we can provide an alternate
* public implementation which doesn't have the performance cost required to maintiain the
* properties as objects.
*
* @property keepDeprecatedSubs
* @static
* @for CustomEvent
* @type boolean
* @default false
* @deprecated
*/
Y.CustomEvent.keepDeprecatedSubs = false;
Y.CustomEvent.mixConfigs = mixConfigs;
Y.CustomEvent.prototype = {
constructor: Y.CustomEvent,
/**
* Returns the number of subscribers for this event as the sum of the on()
* subscribers and after() subscribers.
*
* @method hasSubs
* @return Number
*/
hasSubs: function(when) {
var s = this._subscribers.length, a = this._afters.length, sib = this.sibling;
if (sib) {
s += sib._subscribers.length;
a += sib._afters.length;
}
if (when) {
return (when == 'after') ? a : s;
}
return (s + a);
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('detach', 'attach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
this.monitored = true;
var type = this.id + '|' + this.type + '_' + what,
args = nativeSlice.call(arguments, 0);
args[0] = type;
return this.host.on.apply(this.host, args);
},
/**
* Get all of the subscribers to this event and any sibling event
* @method getSubs
* @return {Array} first item is the on subscribers, second the after.
*/
getSubs: function() {
var s = this._subscribers, a = this._afters, sib = this.sibling;
s = (sib) ? s.concat(sib._subscribers) : s.concat();
a = (sib) ? a.concat(sib._afters) : a.concat();
return [s, a];
},
/**
* Apply configuration properties. Only applies the CONFIG whitelist
* @method applyConfig
* @param o hash of properties to apply.
* @param force {boolean} if true, properties that exist on the event
* will be overwritten.
*/
applyConfig: function(o, force) {
mixConfigs(this, o, force);
},
/**
* Create the Subscription for subscribing function, context, and bound
* arguments. If this is a fireOnce event, the subscriber is immediately
* notified.
*
* @method _on
* @param fn {Function} Subscription callback
* @param [context] {Object} Override `this` in the callback
* @param [args] {Array} bound arguments that will be passed to the callback after the arguments generated by fire()
* @param [when] {String} "after" to slot into after subscribers
* @return {EventHandle}
* @protected
*/
_on: function(fn, context, args, when) {
if (!fn) { this.log('Invalid callback for CE: ' + this.type); }
var s = new Y.Subscriber(fn, context, args, when);
if (this.fireOnce && this.fired) {
if (this.async) {
setTimeout(Y.bind(this._notify, this, s, this.firedWith), 0);
} else {
this._notify(s, this.firedWith);
}
}
if (when == AFTER) {
this._afters.push(s);
} else {
this._subscribers.push(s);
}
if (this._kds) {
if (when == AFTER) {
this.afters[s.id] = s;
} else {
this.subscribers[s.id] = s;
}
}
return new Y.EventHandle(this, s);
},
/**
* Listen for this event
* @method subscribe
* @param {Function} fn The function to execute.
* @return {EventHandle} Unsubscribe handle.
* @deprecated use on.
*/
subscribe: function(fn, context) {
Y.log('ce.subscribe deprecated, use "on"', 'warn', 'deprecated');
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, true);
},
/**
* Listen for this event
* @method on
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} An object with a detach method to detch the handler(s).
*/
on: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
if (this.monitored && this.host) {
this.host._monitor('attach', this, {
args: arguments
});
}
return this._on(fn, context, a, true);
},
/**
* Listen for this event after the normal subscribers have been notified and
* the default behavior has been applied. If a normal subscriber prevents the
* default behavior, it also prevents after listeners from firing.
* @method after
* @param {Function} fn The function to execute.
* @param {object} context optional execution context.
* @param {mixed} arg* 0..n additional arguments to supply to the subscriber
* when the event fires.
* @return {EventHandle} handle Unsubscribe handle.
*/
after: function(fn, context) {
var a = (arguments.length > 2) ? nativeSlice.call(arguments, 2) : null;
return this._on(fn, context, a, AFTER);
},
/**
* Detach listeners.
* @method detach
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int} returns the number of subscribers unsubscribed.
*/
detach: function(fn, context) {
// unsubscribe handle
if (fn && fn.detach) {
return fn.detach();
}
var i, s,
found = 0,
subs = this._subscribers,
afters = this._afters;
for (i = subs.length; i >= 0; i--) {
s = subs[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, subs, i);
found++;
}
}
for (i = afters.length; i >= 0; i--) {
s = afters[i];
if (s && (!fn || fn === s.fn)) {
this._delete(s, afters, i);
found++;
}
}
return found;
},
/**
* Detach listeners.
* @method unsubscribe
* @param {Function} fn The subscribed function to remove, if not supplied
* all will be removed.
* @param {Object} context The context object passed to subscribe.
* @return {int|undefined} returns the number of subscribers unsubscribed.
* @deprecated use detach.
*/
unsubscribe: function() {
return this.detach.apply(this, arguments);
},
/**
* Notify a single subscriber
* @method _notify
* @param {Subscriber} s the subscriber.
* @param {Array} args the arguments array to apply to the listener.
* @protected
*/
_notify: function(s, args, ef) {
this.log(this.type + '->' + 'sub: ' + s.id);
var ret;
ret = s.notify(args, this);
if (false === ret || this.stopped > 1) {
this.log(this.type + ' cancelled by subscriber');
return false;
}
return true;
},
/**
* Logger abstraction to centralize the application of the silent flag
* @method log
* @param {string} msg message to log.
* @param {string} cat log category.
*/
log: function(msg, cat) {
if (!this.silent) { Y.log(this.id + ': ' + msg, cat || 'info', 'event'); }
},
/**
* Notifies the subscribers. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters:
* <ul>
* <li>The type of event</li>
* <li>All of the arguments fire() was executed with as an array</li>
* <li>The custom object (if any) that was passed into the subscribe()
* method</li>
* </ul>
* @method fire
* @param {Object*} arguments an arbitrary set of parameters to pass to
* the handler.
* @return {boolean} false if one of the subscribers returned false,
* true otherwise.
*
*/
fire: function() {
if (this.fireOnce && this.fired) {
this.log('fireOnce event: ' + this.type + ' already fired');
return true;
} else {
var args = nativeSlice.call(arguments, 0);
// this doesn't happen if the event isn't published
// this.host._monitor('fire', this.type, args);
this.fired = true;
if (this.fireOnce) {
this.firedWith = args;
}
if (this.emitFacade) {
return this.fireComplex(args);
} else {
return this.fireSimple(args);
}
}
},
/**
* Set up for notifying subscribers of non-emitFacade events.
*
* @method fireSimple
* @param args {Array} Arguments passed to fire()
* @return Boolean false if a subscriber returned false
* @protected
*/
fireSimple: function(args) {
this.stopped = 0;
this.prevented = 0;
if (this.hasSubs()) {
var subs = this.getSubs();
this._procSubs(subs[0], args);
this._procSubs(subs[1], args);
}
this._broadcast(args);
return this.stopped ? false : true;
},
// Requires the event-custom-complex module for full funcitonality.
fireComplex: function(args) {
this.log('Missing event-custom-complex needed to emit a facade for: ' + this.type);
args[0] = args[0] || {};
return this.fireSimple(args);
},
/**
* Notifies a list of subscribers.
*
* @method _procSubs
* @param subs {Array} List of subscribers
* @param args {Array} Arguments passed to fire()
* @param ef {}
* @return Boolean false if a subscriber returns false or stops the event
* propagation via e.stopPropagation(),
* e.stopImmediatePropagation(), or e.halt()
* @private
*/
_procSubs: function(subs, args, ef) {
var s, i, l;
for (i = 0, l = subs.length; i < l; i++) {
s = subs[i];
if (s && s.fn) {
if (false === this._notify(s, args, ef)) {
this.stopped = 2;
}
if (this.stopped == 2) {
return false;
}
}
}
return true;
},
/**
* Notifies the YUI instance if the event is configured with broadcast = 1,
* and both the YUI instance and Y.Global if configured with broadcast = 2.
*
* @method _broadcast
* @param args {Array} Arguments sent to fire()
* @private
*/
_broadcast: function(args) {
if (!this.stopped && this.broadcast) {
var a = args.concat();
a.unshift(this.type);
if (this.host !== Y) {
Y.fire.apply(Y, a);
}
if (this.broadcast == 2) {
Y.Global.fire.apply(Y.Global, a);
}
}
},
/**
* Removes all listeners
* @method unsubscribeAll
* @return {int} The number of listeners unsubscribed.
* @deprecated use detachAll.
*/
unsubscribeAll: function() {
return this.detachAll.apply(this, arguments);
},
/**
* Removes all listeners
* @method detachAll
* @return {int} The number of listeners unsubscribed.
*/
detachAll: function() {
return this.detach();
},
/**
* Deletes the subscriber from the internal store of on() and after()
* subscribers.
*
* @method _delete
* @param s subscriber object.
* @param subs (optional) on or after subscriber array
* @param index (optional) The index found.
* @private
*/
_delete: function(s, subs, i) {
var when = s._when;
if (!subs) {
subs = (when === AFTER) ? this._afters : this._subscribers;
i = YArray.indexOf(subs, s, 0);
}
if (s && subs[i] === s) {
subs.splice(i, 1);
}
if (this._kds) {
if (when === AFTER) {
delete this.afters[s.id];
} else {
delete this.subscribers[s.id];
}
}
if (this.monitored && this.host) {
this.host._monitor('detach', this, {
ce: this,
sub: s
});
}
if (s) {
s.deleted = true;
}
}
};
/**
* Stores the subscriber information to be used when the event fires.
* @param {Function} fn The wrapped function to execute.
* @param {Object} context The value of the keyword 'this' in the listener.
* @param {Array} args* 0..n additional arguments to supply the listener.
*
* @class Subscriber
* @constructor
*/
Y.Subscriber = function(fn, context, args, when) {
/**
* The callback that will be execute when the event fires
* This is wrapped by Y.rbind if obj was supplied.
* @property fn
* @type Function
*/
this.fn = fn;
/**
* Optional 'this' keyword for the listener
* @property context
* @type Object
*/
this.context = context;
/**
* Unique subscriber id
* @property id
* @type String
*/
this.id = Y.stamp(this);
/**
* Additional arguments to propagate to the subscriber
* @property args
* @type Array
*/
this.args = args;
this._when = when;
/**
* Custom events for a given fire transaction.
* @property events
* @type {EventTarget}
*/
// this.events = null;
/**
* This listener only reacts to the event once
* @property once
*/
// this.once = false;
};
Y.Subscriber.prototype = {
constructor: Y.Subscriber,
_notify: function(c, args, ce) {
if (this.deleted && !this.postponed) {
if (this.postponed) {
delete this.fn;
delete this.context;
} else {
delete this.postponed;
return null;
}
}
var a = this.args, ret;
switch (ce.signature) {
case 0:
ret = this.fn.call(c, ce.type, args, c);
break;
case 1:
ret = this.fn.call(c, args[0] || null, c);
break;
default:
if (a || args) {
args = args || [];
a = (a) ? args.concat(a) : args;
ret = this.fn.apply(c, a);
} else {
ret = this.fn.call(c);
}
}
if (this.once) {
ce._delete(this);
}
return ret;
},
/**
* Executes the subscriber.
* @method notify
* @param args {Array} Arguments array for the subscriber.
* @param ce {CustomEvent} The custom event that sent the notification.
*/
notify: function(args, ce) {
var c = this.context,
ret = true;
if (!c) {
c = (ce.contextFn) ? ce.contextFn() : ce.context;
}
// only catch errors if we will not re-throw them.
if (Y.config && Y.config.throwFail) {
ret = this._notify(c, args, ce);
} else {
try {
ret = this._notify(c, args, ce);
} catch (e) {
Y.error(this + ' failed: ' + e.message, e);
}
}
return ret;
},
/**
* Returns true if the fn and obj match this objects properties.
* Used by the unsubscribe method to match the right subscriber.
*
* @method contains
* @param {Function} fn the function to execute.
* @param {Object} context optional 'this' keyword for the listener.
* @return {boolean} true if the supplied arguments match this
* subscriber's signature.
*/
contains: function(fn, context) {
if (context) {
return ((this.fn == fn) && this.context == context);
} else {
return (this.fn == fn);
}
},
valueOf : function() {
return this.id;
}
};
/**
* Return value from all subscribe operations
* @class EventHandle
* @constructor
* @param {CustomEvent} evt the custom event.
* @param {Subscriber} sub the subscriber.
*/
Y.EventHandle = function(evt, sub) {
/**
* The custom event
*
* @property evt
* @type CustomEvent
*/
this.evt = evt;
/**
* The subscriber object
*
* @property sub
* @type Subscriber
*/
this.sub = sub;
};
Y.EventHandle.prototype = {
batch: function(f, c) {
f.call(c || this, this);
if (Y.Lang.isArray(this.evt)) {
Y.Array.each(this.evt, function(h) {
h.batch.call(c || h, f);
});
}
},
/**
* Detaches this subscriber
* @method detach
* @return {int} the number of detached listeners
*/
detach: function() {
var evt = this.evt, detached = 0, i;
if (evt) {
// Y.log('EventHandle.detach: ' + this.sub, 'info', 'Event');
if (Y.Lang.isArray(evt)) {
for (i = 0; i < evt.length; i++) {
detached += evt[i].detach();
}
} else {
evt._delete(this.sub);
detached = 1;
}
}
return detached;
},
/**
* Monitor the event state for the subscribed event. The first parameter
* is what should be monitored, the rest are the normal parameters when
* subscribing to an event.
* @method monitor
* @param what {string} what to monitor ('attach', 'detach', 'publish').
* @return {EventHandle} return value from the monitor event subscription.
*/
monitor: function(what) {
return this.evt.monitor.apply(this.evt, arguments);
}
};
/**
* Custom event engine, DOM event listener abstraction layer, synthetic DOM
* events.
* @module event-custom
* @submodule event-custom-base
*/
/**
* EventTarget provides the implementation for any object to
* publish, subscribe and fire to custom events, and also
* alows other EventTargets to target the object with events
* sourced from the other object.
* EventTarget is designed to be used with Y.augment to wrap
* EventCustom in an interface that allows events to be listened to
* and fired by name. This makes it possible for implementing code to
* subscribe to an event that either has not been created yet, or will
* not be created at all.
* @class EventTarget
* @param opts a configuration object
* @config emitFacade {boolean} if true, all events will emit event
* facade payloads by default (default false)
* @config prefix {String} the prefix to apply to non-prefixed event names
*/
var L = Y.Lang,
PREFIX_DELIMITER = ':',
CATEGORY_DELIMITER = '|',
AFTER_PREFIX = '~AFTER~',
WILD_TYPE_RE = /(.*?)(:)(.*?)/,
_wildType = Y.cached(function(type) {
return type.replace(WILD_TYPE_RE, "*$2$3");
}),
/**
* If the instance has a prefix attribute and the
* event type is not prefixed, the instance prefix is
* applied to the supplied type.
* @method _getType
* @private
*/
_getType = Y.cached(function(type, pre) {
if (!pre || (typeof type !== "string") || type.indexOf(PREFIX_DELIMITER) > -1) {
return type;
}
return pre + PREFIX_DELIMITER + type;
}),
/**
* Returns an array with the detach key (if provided),
* and the prefixed event name from _getType
* Y.on('detachcategory| menu:click', fn)
* @method _parseType
* @private
*/
_parseType = Y.cached(function(type, pre) {
var t = type, detachcategory, after, i;
if (!L.isString(t)) {
return t;
}
i = t.indexOf(AFTER_PREFIX);
if (i > -1) {
after = true;
t = t.substr(AFTER_PREFIX.length);
// Y.log(t);
}
i = t.indexOf(CATEGORY_DELIMITER);
if (i > -1) {
detachcategory = t.substr(0, (i));
t = t.substr(i+1);
if (t == '*') {
t = null;
}
}
// detach category, full type with instance prefix, is this an after listener, short type
return [detachcategory, (pre) ? _getType(t, pre) : t, after, t];
}),
ET = function(opts) {
// Y.log('EventTarget constructor executed: ' + this._yuid);
var o = (L.isObject(opts)) ? opts : {};
this._yuievt = this._yuievt || {
id: Y.guid(),
events: {},
targets: {},
config: o,
chain: ('chain' in o) ? o.chain : Y.config.chain,
bubbling: false,
defaults: {
context: o.context || this,
host: this,
emitFacade: o.emitFacade,
fireOnce: o.fireOnce,
queuable: o.queuable,
monitored: o.monitored,
broadcast: o.broadcast,
defaultTargetOnly: o.defaultTargetOnly,
bubbles: ('bubbles' in o) ? o.bubbles : true
}
};
};
ET.prototype = {
constructor: ET,
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>on</code> except the
* listener is immediatelly detached when it is executed.
* @method once
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
once: function() {
var handle = this.on.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Listen to a custom event hosted by this object one time.
* This is the equivalent to <code>after</code> except the
* listener is immediatelly detached when it is executed.
* @method onceAfter
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
onceAfter: function() {
var handle = this.after.apply(this, arguments);
handle.batch(function(hand) {
if (hand.sub) {
hand.sub.once = true;
}
});
return handle;
},
/**
* Takes the type parameter passed to 'on' and parses out the
* various pieces that could be included in the type. If the
* event type is passed without a prefix, it will be expanded
* to include the prefix one is supplied or the event target
* is configured with a default prefix.
* @method parseType
* @param {String} type the type
* @param {String} [pre=this._yuievt.config.prefix] the prefix
* @since 3.3.0
* @return {Array} an array containing:
* * the detach category, if supplied,
* * the prefixed event type,
* * whether or not this is an after listener,
* * the supplied event type
*/
parseType: function(type, pre) {
return _parseType(type, pre || this._yuievt.config.prefix);
},
/**
* Subscribe a callback function to a custom event fired by this object or
* from an object that bubbles its events to this object.
*
* Callback functions for events published with `emitFacade = true` will
* receive an `EventFacade` as the first argument (typically named "e").
* These callbacks can then call `e.preventDefault()` to disable the
* behavior published to that event's `defaultFn`. See the `EventFacade`
* API for all available properties and methods. Subscribers to
* non-`emitFacade` events will receive the arguments passed to `fire()`
* after the event name.
*
* To subscribe to multiple events at once, pass an object as the first
* argument, where the key:value pairs correspond to the eventName:callback,
* or pass an array of event names as the first argument to subscribe to
* all listed events with the same callback.
*
* Returning `false` from a callback is supported as an alternative to
* calling `e.preventDefault(); e.stopPropagation();`. However, it is
* recommended to use the event methods whenever possible.
*
* @method on
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching that
* subscription
*/
on: function(type, fn, context) {
var yuievt = this._yuievt,
parts = _parseType(type, yuievt.config.prefix), f, c, args, ret, ce,
detachcategory, handle, store = Y.Env.evt.handles, after, adapt, shorttype,
Node = Y.Node, n, domevent, isArr;
// full name, args, detachcategory, after
this._monitor('attach', parts[1], {
args: arguments,
category: parts[0],
after: parts[2]
});
if (L.isObject(type)) {
if (L.isFunction(type)) {
return Y.Do.before.apply(Y.Do, arguments);
}
f = fn;
c = context;
args = nativeSlice.call(arguments, 0);
ret = [];
if (L.isArray(type)) {
isArr = true;
}
after = type._after;
delete type._after;
Y.each(type, function(v, k) {
if (L.isObject(v)) {
f = v.fn || ((L.isFunction(v)) ? v : f);
c = v.context || c;
}
var nv = (after) ? AFTER_PREFIX : '';
args[0] = nv + ((isArr) ? v : k);
args[1] = f;
args[2] = c;
ret.push(this.on.apply(this, args));
}, this);
return (yuievt.chain) ? this : new Y.EventHandle(ret);
}
detachcategory = parts[0];
after = parts[2];
shorttype = parts[3];
// extra redirection so we catch adaptor events too. take a look at this.
if (Node && Y.instanceOf(this, Node) && (shorttype in Node.DOM_EVENTS)) {
args = nativeSlice.call(arguments, 0);
args.splice(2, 0, Node.getDOMNode(this));
// Y.log("Node detected, redirecting with these args: " + args);
return Y.on.apply(Y, args);
}
type = parts[1];
if (Y.instanceOf(this, YUI)) {
adapt = Y.Env.evt.plugins[type];
args = nativeSlice.call(arguments, 0);
args[0] = shorttype;
if (Node) {
n = args[2];
if (Y.instanceOf(n, Y.NodeList)) {
n = Y.NodeList.getDOMNodes(n);
} else if (Y.instanceOf(n, Node)) {
n = Node.getDOMNode(n);
}
domevent = (shorttype in Node.DOM_EVENTS);
// Captures both DOM events and event plugins.
if (domevent) {
args[2] = n;
}
}
// check for the existance of an event adaptor
if (adapt) {
Y.log('Using adaptor for ' + shorttype + ', ' + n, 'info', 'event');
handle = adapt.on.apply(Y, args);
} else if ((!type) || domevent) {
handle = Y.Event._attach(args);
}
}
if (!handle) {
ce = yuievt.events[type] || this.publish(type);
handle = ce._on(fn, context, (arguments.length > 3) ? nativeSlice.call(arguments, 3) : null, (after) ? 'after' : true);
}
if (detachcategory) {
store[detachcategory] = store[detachcategory] || {};
store[detachcategory][type] = store[detachcategory][type] || [];
store[detachcategory][type].push(handle);
}
return (yuievt.chain) ? this : handle;
},
/**
* subscribe to an event
* @method subscribe
* @deprecated use on
*/
subscribe: function() {
Y.log('EventTarget subscribe() is deprecated, use on()', 'warn', 'deprecated');
return this.on.apply(this, arguments);
},
/**
* Detach one or more listeners the from the specified event
* @method detach
* @param type {string|Object} Either the handle to the subscriber or the
* type of event. If the type
* is not specified, it will attempt to remove
* the listener from all hosted events.
* @param fn {Function} The subscribed function to unsubscribe, if not
* supplied, all subscribers will be removed.
* @param context {Object} The custom object passed to subscribe. This is
* optional, but if supplied will be used to
* disambiguate multiple listeners that are the same
* (e.g., you subscribe many object using a function
* that lives on the prototype)
* @return {EventTarget} the host
*/
detach: function(type, fn, context) {
var evts = this._yuievt.events, i,
Node = Y.Node, isNode = Node && (Y.instanceOf(this, Node));
// detachAll disabled on the Y instance.
if (!type && (this !== Y)) {
for (i in evts) {
if (evts.hasOwnProperty(i)) {
evts[i].detach(fn, context);
}
}
if (isNode) {
Y.Event.purgeElement(Node.getDOMNode(this));
}
return this;
}
var parts = _parseType(type, this._yuievt.config.prefix),
detachcategory = L.isArray(parts) ? parts[0] : null,
shorttype = (parts) ? parts[3] : null,
adapt, store = Y.Env.evt.handles, detachhost, cat, args,
ce,
keyDetacher = function(lcat, ltype, host) {
var handles = lcat[ltype], ce, i;
if (handles) {
for (i = handles.length - 1; i >= 0; --i) {
ce = handles[i].evt;
if (ce.host === host || ce.el === host) {
handles[i].detach();
}
}
}
};
if (detachcategory) {
cat = store[detachcategory];
type = parts[1];
detachhost = (isNode) ? Y.Node.getDOMNode(this) : this;
if (cat) {
if (type) {
keyDetacher(cat, type, detachhost);
} else {
for (i in cat) {
if (cat.hasOwnProperty(i)) {
keyDetacher(cat, i, detachhost);
}
}
}
return this;
}
// If this is an event handle, use it to detach
} else if (L.isObject(type) && type.detach) {
type.detach();
return this;
// extra redirection so we catch adaptor events too. take a look at this.
} else if (isNode && ((!shorttype) || (shorttype in Node.DOM_EVENTS))) {
args = nativeSlice.call(arguments, 0);
args[2] = Node.getDOMNode(this);
Y.detach.apply(Y, args);
return this;
}
adapt = Y.Env.evt.plugins[shorttype];
// The YUI instance handles DOM events and adaptors
if (Y.instanceOf(this, YUI)) {
args = nativeSlice.call(arguments, 0);
// use the adaptor specific detach code if
if (adapt && adapt.detach) {
adapt.detach.apply(Y, args);
return this;
// DOM event fork
} else if (!type || (!adapt && Node && (type in Node.DOM_EVENTS))) {
args[0] = type;
Y.Event.detach.apply(Y.Event, args);
return this;
}
}
// ce = evts[type];
ce = evts[parts[1]];
if (ce) {
ce.detach(fn, context);
}
return this;
},
/**
* detach a listener
* @method unsubscribe
* @deprecated use detach
*/
unsubscribe: function() {
Y.log('EventTarget unsubscribe() is deprecated, use detach()', 'warn', 'deprecated');
return this.detach.apply(this, arguments);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method detachAll
* @param type {String} The type, or name of the event
*/
detachAll: function(type) {
return this.detach(type);
},
/**
* Removes all listeners from the specified event. If the event type
* is not specified, all listeners from all hosted custom events will
* be removed.
* @method unsubscribeAll
* @param type {String} The type, or name of the event
* @deprecated use detachAll
*/
unsubscribeAll: function() {
Y.log('EventTarget unsubscribeAll() is deprecated, use detachAll()', 'warn', 'deprecated');
return this.detachAll.apply(this, arguments);
},
/**
* Creates a new custom event of the specified type. If a custom event
* by that name already exists, it will not be re-created. In either
* case the custom event is returned.
*
* @method publish
*
* @param type {String} the type, or name of the event
* @param opts {object} optional config params. Valid properties are:
*
* <ul>
* <li>
* 'broadcast': whether or not the YUI instance and YUI global are notified when the event is fired (false)
* </li>
* <li>
* 'bubbles': whether or not this event bubbles (true)
* Events can only bubble if emitFacade is true.
* </li>
* <li>
* 'context': the default execution context for the listeners (this)
* </li>
* <li>
* 'defaultFn': the default function to execute when this event fires if preventDefault was not called
* </li>
* <li>
* 'emitFacade': whether or not this event emits a facade (false)
* </li>
* <li>
* 'prefix': the prefix for this targets events, e.g., 'menu' in 'menu:click'
* </li>
* <li>
* 'fireOnce': if an event is configured to fire once, new subscribers after
* the fire will be notified immediately.
* </li>
* <li>
* 'async': fireOnce event listeners will fire synchronously if the event has already
* fired unless async is true.
* </li>
* <li>
* 'preventable': whether or not preventDefault() has an effect (true)
* </li>
* <li>
* 'preventedFn': a function that is executed when preventDefault is called
* </li>
* <li>
* 'queuable': whether or not this event can be queued during bubbling (false)
* </li>
* <li>
* 'silent': if silent is true, debug messages are not provided for this event.
* </li>
* <li>
* 'stoppedFn': a function that is executed when stopPropagation is called
* </li>
*
* <li>
* 'monitored': specifies whether or not this event should send notifications about
* when the event has been attached, detached, or published.
* </li>
* <li>
* 'type': the event type (valid option if not provided as the first parameter to publish)
* </li>
* </ul>
*
* @return {CustomEvent} the custom event
*
*/
publish: function(type, opts) {
var events, ce, ret, defaults,
edata = this._yuievt,
pre = edata.config.prefix;
if (L.isObject(type)) {
ret = {};
Y.each(type, function(v, k) {
ret[k] = this.publish(k, v || opts);
}, this);
return ret;
}
type = (pre) ? _getType(type, pre) : type;
events = edata.events;
ce = events[type];
this._monitor('publish', type, {
args: arguments
});
if (ce) {
// ce.log("publish applying new config to published event: '"+type+"' exists", 'info', 'event');
if (opts) {
ce.applyConfig(opts, true);
}
} else {
// TODO: Lazy publish goes here.
defaults = edata.defaults;
// apply defaults
ce = new Y.CustomEvent(type, defaults);
if (opts) {
ce.applyConfig(opts, true);
}
events[type] = ce;
}
// make sure we turn the broadcast flag off if this
// event was published as a result of bubbling
// if (opts instanceof Y.CustomEvent) {
// events[type].broadcast = false;
// }
return events[type];
},
/**
* This is the entry point for the event monitoring system.
* You can monitor 'attach', 'detach', 'fire', and 'publish'.
* When configured, these events generate an event. click ->
* click_attach, click_detach, click_publish -- these can
* be subscribed to like other events to monitor the event
* system. Inividual published events can have monitoring
* turned on or off (publish can't be turned off before it
* it published) by setting the events 'monitor' config.
*
* @method _monitor
* @param what {String} 'attach', 'detach', 'fire', or 'publish'
* @param eventType {String|CustomEvent} The prefixed name of the event being monitored, or the CustomEvent object.
* @param o {Object} Information about the event interaction, such as
* fire() args, subscription category, publish config
* @private
*/
_monitor: function(what, eventType, o) {
var monitorevt, ce, type;
if (eventType) {
if (typeof eventType === "string") {
type = eventType;
ce = this.getEvent(eventType, true);
} else {
ce = eventType;
type = eventType.type;
}
if ((this._yuievt.config.monitored && (!ce || ce.monitored)) || (ce && ce.monitored)) {
monitorevt = type + '_' + what;
o.monitored = what;
this.fire.call(this, monitorevt, o);
}
}
},
/**
* Fire a custom event by name. The callback functions will be executed
* from the context specified when the event was created, and with the
* following parameters.
*
* If the custom event object hasn't been created, then the event hasn't
* been published and it has no subscribers. For performance sake, we
* immediate exit in this case. This means the event won't bubble, so
* if the intention is that a bubble target be notified, the event must
* be published on this object first.
*
* The first argument is the event type, and any additional arguments are
* passed to the listeners as parameters. If the first of these is an
* object literal, and the event is configured to emit an event facade,
* that object is mixed into the event facade and the facade is provided
* in place of the original object.
*
* @method fire
* @param type {String|Object} The type of the event, or an object that contains
* a 'type' property.
* @param arguments {Object*} an arbitrary set of parameters to pass to
* the handler. If the first of these is an object literal and the event is
* configured to emit an event facade, the event facade will replace that
* parameter after the properties the object literal contains are copied to
* the event facade.
* @return {EventTarget} the event host
*/
fire: function(type) {
var typeIncluded = L.isString(type),
t = (typeIncluded) ? type : (type && type.type),
yuievt = this._yuievt,
pre = yuievt.config.prefix,
ce, ret,
ce2,
args = (typeIncluded) ? nativeSlice.call(arguments, 1) : arguments;
t = (pre) ? _getType(t, pre) : t;
ce = this.getEvent(t, true);
ce2 = this.getSibling(t, ce);
if (ce2 && !ce) {
ce = this.publish(t);
}
this._monitor('fire', (ce || t), {
args: args
});
// this event has not been published or subscribed to
if (!ce) {
if (yuievt.hasTargets) {
return this.bubble({ type: t }, args, this);
}
// otherwise there is nothing to be done
ret = true;
} else {
ce.sibling = ce2;
ret = ce.fire.apply(ce, args);
}
return (yuievt.chain) ? this : ret;
},
getSibling: function(type, ce) {
var ce2;
// delegate to *:type events if there are subscribers
if (type.indexOf(PREFIX_DELIMITER) > -1) {
type = _wildType(type);
// console.log(type);
ce2 = this.getEvent(type, true);
if (ce2) {
// console.log("GOT ONE: " + type);
ce2.applyConfig(ce);
ce2.bubbles = false;
ce2.broadcast = 0;
// ret = ce2.fire.apply(ce2, a);
}
}
return ce2;
},
/**
* Returns the custom event of the provided type has been created, a
* falsy value otherwise
* @method getEvent
* @param type {String} the type, or name of the event
* @param prefixed {String} if true, the type is prefixed already
* @return {CustomEvent} the custom event or null
*/
getEvent: function(type, prefixed) {
var pre, e;
if (!prefixed) {
pre = this._yuievt.config.prefix;
type = (pre) ? _getType(type, pre) : type;
}
e = this._yuievt.events;
return e[type] || null;
},
/**
* Subscribe to a custom event hosted by this object. The
* supplied callback will execute after any listeners add
* via the subscribe method, and after the default function,
* if configured for the event, has executed.
*
* @method after
* @param {String} type The name of the event
* @param {Function} fn The callback to execute in response to the event
* @param {Object} [context] Override `this` object in callback
* @param {Any} [arg*] 0..n additional arguments to supply to the subscriber
* @return {EventHandle} A subscription handle capable of detaching the
* subscription
*/
after: function(type, fn) {
var a = nativeSlice.call(arguments, 0);
switch (L.type(type)) {
case 'function':
return Y.Do.after.apply(Y.Do, arguments);
case 'array':
// YArray.each(a[0], function(v) {
// v = AFTER_PREFIX + v;
// });
// break;
case 'object':
a[0]._after = true;
break;
default:
a[0] = AFTER_PREFIX + type;
}
return this.on.apply(this, a);
},
/**
* Executes the callback before a DOM event, custom event
* or method. If the first argument is a function, it
* is assumed the target is a method. For DOM and custom
* events, this is an alias for Y.on.
*
* For DOM and custom events:
* type, callback, context, 0-n arguments
*
* For methods:
* callback, object (method host), methodName, context, 0-n arguments
*
* @method before
* @return detach handle
*/
before: function() {
return this.on.apply(this, arguments);
}
};
Y.EventTarget = ET;
// make Y an event target
Y.mix(Y, ET.prototype);
ET.call(Y, { bubbles: false });
YUI.Env.globalEvents = YUI.Env.globalEvents || new ET();
/**
* Hosts YUI page level events. This is where events bubble to
* when the broadcast config is set to 2. This property is
* only available if the custom event module is loaded.
* @property Global
* @type EventTarget
* @for YUI
*/
Y.Global = YUI.Env.globalEvents;
// @TODO implement a global namespace function on Y.Global?
/**
`Y.on()` can do many things:
<ul>
<li>Subscribe to custom events `publish`ed and `fire`d from Y</li>
<li>Subscribe to custom events `publish`ed with `broadcast` 1 or 2 and
`fire`d from any object in the YUI instance sandbox</li>
<li>Subscribe to DOM events</li>
<li>Subscribe to the execution of a method on any object, effectively
treating that method as an event</li>
</ul>
For custom event subscriptions, pass the custom event name as the first argument and callback as the second. The `this` object in the callback will be `Y` unless an override is passed as the third argument.
Y.on('io:complete', function () {
Y.MyApp.updateStatus('Transaction complete');
});
To subscribe to DOM events, pass the name of a DOM event as the first argument
and a CSS selector string as the third argument after the callback function.
Alternately, the third argument can be a `Node`, `NodeList`, `HTMLElement`,
array, or simply omitted (the default is the `window` object).
Y.on('click', function (e) {
e.preventDefault();
// proceed with ajax form submission
var url = this.get('action');
...
}, '#my-form');
The `this` object in DOM event callbacks will be the `Node` targeted by the CSS
selector or other identifier.
`on()` subscribers for DOM events or custom events `publish`ed with a
`defaultFn` can prevent the default behavior with `e.preventDefault()` from the
event object passed as the first parameter to the subscription callback.
To subscribe to the execution of an object method, pass arguments corresponding to the call signature for
<a href="../classes/Do.html#methods_before">`Y.Do.before(...)`</a>.
NOTE: The formal parameter list below is for events, not for function
injection. See `Y.Do.before` for that signature.
@method on
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@see Do.before
@for YUI
**/
/**
Listen for an event one time. Equivalent to `on()`, except that
the listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see on
@method once
@param {String} type DOM or custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Listen for an event one time. Equivalent to `once()`, except, like `after()`,
the subscription callback executes after all `on()` subscribers and the event's
`defaultFn` (if configured) have executed. Like `after()` if any `on()` phase
subscriber calls `e.preventDefault()`, neither the `defaultFn` nor the `after()`
subscribers will execute.
The listener is immediately detached when executed.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
@see once
@method onceAfter
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [arg*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
/**
Like `on()`, this method creates a subscription to a custom event or to the
execution of a method on an object.
For events, `after()` subscribers are executed after the event's
`defaultFn` unless `e.preventDefault()` was called from an `on()` subscriber.
See the <a href="#methods_on">`on()` method</a> for additional subscription
options.
NOTE: The subscription signature shown is for events, not for function
injection. See <a href="../classes/Do.html#methods_after">`Y.Do.after`</a>
for that signature.
@see on
@see Do.after
@method after
@param {String} type The custom event name
@param {Function} fn The callback to execute in response to the event
@param {Object} [context] Override `this` object in callback
@param {Any} [args*] 0..n additional arguments to supply to the subscriber
@return {EventHandle} A subscription handle capable of detaching the
subscription
@for YUI
**/
}, '@VERSION@', {"requires": ["oop"]});
|
react-flux/psadmin/src/components/commons/header.js
|
mauriciojunior/react-playground
|
'use strict'
import React from 'react'
import {Link} from 'react-router'
const Header = React.createClass({
render: function () {
return (
<nav className='navbar navbar-default'>
<div className='container-fluid'>
<Link to='app' className='navbar-brand'>
<img src='images/pluralsight-logo.png' />
</Link>
<ul className='nav navbar-nav'>
<li><Link to='app'>Home</Link></li>
<li><Link to='authors'>Authors</Link></li>
<li><Link to='about'>About</Link></li>
</ul>
</div>
</nav>
)
}
})
module.exports = Header
|
accounts-ui/app/components/reset.js
|
CloudBoost/cloudboost
|
import React from 'react';
import {Link} from 'react-router'
import axios from 'axios'
import CircularProgress from 'material-ui/CircularProgress'
class Reset extends React.Component {
constructor() {
super()
this.state = {
errorMessage: '',
email: '',
success: false,
progress: false
}
}
componentDidMount() {
if(__isBrowser) document.title = "CloudBoost | Forgot Password"
if (!__isDevelopment) {
/****Tracking*********/
mixpanel.track('Portal:Visited ForgotPassword Page', {"Visited": "Visited ForgotPassword page in portal!"});
/****End of Tracking*****/
}
}
reset(e) {
e.preventDefault()
this.setProgress(true)
let postData = {
email: this.state.email
}
axios.post(USER_SERVICE_URL + "/user/ResetPassword", postData).then(function(data) {
this.setProgress(false)
this.state.email = ''
this.state.success = true;
this.state['errorMessage'] = ''
this.setState(this.state)
}.bind(this), function(err) {
this.setProgress(false)
this.state['errorMessage'] = 'We dont have an account with this email. Please try again.'
if (err.response == undefined) {
this.state['errorMessage'] = "Sorry, we currently cannot process your request, please try again later."
}
this.state.email = ''
this.setState(this.state)
}.bind(this))
if (!__isDevelopment) {
/****Tracking*********/
mixpanel.track('Portal:Clicked ResetPassword Button', {"Clicked": "ResetPassword Button in portal!"});
/****End of Tracking*****/
}
}
changeHandler(which, e) {
this.state[which] = e.target.value
this.setState(this.state)
}
setProgress(which) {
this.state.progress = which
this.setState(this.state)
}
render() {
return (
<div>
<div className={this.state.progress
? 'loader'
: 'hide'}>
<CircularProgress color="#4E8EF7" size={50} thickness={6}/>
</div>
<div id="login" className={!this.state.progress
? ''
: 'hide'}>
<div id="image">
<img className="logo" src="public/assets/images/CbLogoIcon.png"/>
</div>
<div id="headLine" className={!this.state.success
? ''
: 'hide'}>
<h3 className="tacenter hfont">Reset your password.</h3>
</div>
<div id="box" className={!this.state.success
? ''
: 'hide'}>
<h5 className="tacenter bfont">Enter your email and we'll reset the password for you.</h5>
</div>
<div id="headLine" className={this.state.success
? ''
: 'hide'}>
<h3 className="tacenter hfont">Reset password email sent.</h3>
</div>
<div id="box" className={this.state.success
? ''
: 'hide'}>
<h5 className="tacenter bfont">We've sent you reset password email. Please make sure you check spam.</h5>
</div>
<div className={!this.state.success
? 'loginbox'
: 'hide'}>
<h5 className="tacenter red">{this.state.errorMessage}</h5>
<form onSubmit={this.reset.bind(this)}>
<input type="email" value={this.state.email} onChange={this.changeHandler.bind(this, 'email')} className="loginInput from-control" placeholder="Your Email." disabled={this.state.successReset} required/>
<button className="loginbtn" type="submit">
Reset Password
</button>
</form>
<Link to={ LOGIN_URL }>
<span className="forgotpw fl">Login.</span>
</Link>
<Link to={ SIGNUP_URL }>
<span className="forgotpw fr">
<span className="greydonthaveaccnt">Dont have an account? </span>
Sign Up.</span>
</Link>
</div>
<div className={this.state.success
? 'loginbox'
: 'hide'}>
<h5 className="tacenter">Want to login?
<Link to={ LOGIN_URL }>
<span className="forgotpw">Log in.
</span>
</Link>
</h5>
</div>
</div>
</div>
);
}
}
export default Reset;
|
ajax/libs/reactive-coffee/0.0.5/reactive-coffee.js
|
laurenceHR/cdnjs
|
(function() {
var DepArray, DepCell, DepMap, DepMgr, Ev, MappedDepArray, ObsArray, ObsCell, ObsMap, RawHtml, Recorder, SrcArray, SrcCell, SrcMap, asyncBind, bind, depMgr, ev, events, firstWhere, lagBind, mkMap, mktag, mkuid, nextUid, nthWhere, popKey, postLagBind, prop, propSet, props, recorder, rx, rxt, setProp, specialAttrs, tag, tags, _fn, _i, _len, _ref, _ref1, _ref2, _ref3,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
__slice = [].slice,
_this = this;
if (typeof exports === 'undefined') {
this.rx = rx = {};
} else {
rx = exports;
}
nextUid = 0;
mkuid = function() {
return nextUid += 1;
};
popKey = function(x, k) {
var v;
if (!k in x) {
throw 'object has no key ' + k;
}
v = x[k];
delete x[k];
return v;
};
nthWhere = function(xs, n, f) {
var i, x, _i, _len;
for (i = _i = 0, _len = xs.length; _i < _len; i = ++_i) {
x = xs[i];
if (f(x) && (n -= 1) < 0) {
return [x, i];
}
}
return [null, -1];
};
firstWhere = function(xs, f) {
return nthWhere(xs, 0, f);
};
mkMap = function() {
return Object.create(null);
};
DepMgr = rx.DepMgr = (function() {
function DepMgr() {
this.uid2src = {};
}
DepMgr.prototype.sub = function(uid, src) {
return this.uid2src[uid] = src;
};
DepMgr.prototype.unsub = function(uid) {
return popKey(this.uid2src, uid);
};
return DepMgr;
})();
rx._depMgr = depMgr = new DepMgr();
Ev = rx.Ev = (function() {
function Ev(inits) {
this.inits = inits;
this.subs = [];
}
Ev.prototype.sub = function(listener) {
var init, uid, _i, _len, _ref;
uid = mkuid();
if (this.inits != null) {
_ref = this.inits();
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
init = _ref[_i];
listener(init);
}
}
this.subs[uid] = listener;
depMgr.sub(uid, this);
return uid;
};
Ev.prototype.pub = function(data) {
var listener, uid, _ref, _results;
_ref = this.subs;
_results = [];
for (uid in _ref) {
listener = _ref[uid];
_results.push(listener(data));
}
return _results;
};
Ev.prototype.unsub = function(uid) {
popKey(this.subs, uid);
return depMgr.unsub(uid, this);
};
Ev.prototype.scoped = function(listener, context) {
var uid;
uid = this.sub(listener);
try {
return context();
} finally {
this.unsub(uid);
}
};
return Ev;
})();
rx.skipFirst = function(f) {
var first;
first = true;
return function(x) {
if (first) {
return first = false;
} else {
return f(x);
}
};
};
Recorder = rx.Recorder = (function() {
function Recorder() {
this.stack = [];
this.isMutating = false;
this.isIgnoring = false;
this.onMutationWarning = new Ev();
}
Recorder.prototype.record = function(dep, f) {
var wasIgnoring, wasMutating;
if (this.stack.length > 0 && !this.isMutating) {
_(this.stack).last().addNestedBind(dep);
}
this.stack.push(dep);
wasMutating = this.isMutating;
this.isMutating = false;
wasIgnoring = this.isIgnoring;
this.isIgnoring = false;
try {
return f();
} finally {
this.isIgnoring = wasIgnoring;
this.isMutating = wasMutating;
this.stack.pop();
}
};
Recorder.prototype.sub = function(sub) {
var handle, topCell;
if (this.stack.length > 0 && !this.isIgnoring) {
topCell = _(this.stack).last();
return handle = sub(topCell);
}
};
Recorder.prototype.addCleanup = function(cleanup) {
if (this.stack.length > 0) {
return _(this.stack).last().addCleanup(cleanup);
}
};
Recorder.prototype.mutating = function(f) {
var wasMutating;
if (this.stack.length > 0) {
console.warn('Mutation to observable detected during a bind context');
this.onMutationWarning.pub(null);
}
wasMutating = this.isMutating;
this.isMutating = true;
try {
return f();
} finally {
this.isMutating = wasMutating;
}
};
Recorder.prototype.ignoring = function(f) {
var wasIgnoring;
wasIgnoring = this.isIgnoring;
this.isIgnoring = true;
try {
return f();
} finally {
this.isIgnoring = wasIgnoring;
}
};
return Recorder;
})();
rx._recorder = recorder = new Recorder();
rx.asyncBind = asyncBind = function(init, f) {
var dep;
dep = new DepCell(f, init);
dep.refresh();
return dep;
};
rx.bind = bind = function(f) {
return asyncBind(null, function() {
return this.done(this.record(f));
});
};
rx.lagBind = lagBind = function(lag, init, f) {
var timeout;
timeout = null;
return asyncBind(init, function() {
var _this = this;
if (timeout != null) {
clearTimeout(timeout);
}
return timeout = setTimeout(function() {
return _this.done(_this.record(f));
}, lag);
});
};
rx.postLagBind = postLagBind = function(init, f) {
var timeout;
timeout = null;
return asyncBind(init, function() {
var ms, val, _ref,
_this = this;
_ref = this.record(f), val = _ref.val, ms = _ref.ms;
if (timeout != null) {
clearTimeout(timeout);
}
return timeout = setTimeout((function() {
return _this.done(val);
}), ms);
});
};
rx.snap = function(f) {
return recorder.ignoring(f);
};
rx.onDispose = function(cleanup) {
return recorder.addCleanup(cleanup);
};
rx.autoSub = function(ev, listener) {
var subid;
subid = ev.sub(listener);
rx.onDispose(function() {
return ev.unsub(subid);
});
return subid;
};
ObsCell = rx.ObsCell = (function() {
function ObsCell(x) {
var _ref,
_this = this;
this.x = x;
this.x = (_ref = this.x) != null ? _ref : null;
this.onSet = new Ev(function() {
return [[null, _this.x]];
});
}
ObsCell.prototype.get = function() {
var _this = this;
recorder.sub(function(target) {
return rx.autoSub(_this.onSet, function() {
return target.refresh();
});
});
return this.x;
};
return ObsCell;
})();
SrcCell = rx.SrcCell = (function(_super) {
__extends(SrcCell, _super);
function SrcCell() {
_ref = SrcCell.__super__.constructor.apply(this, arguments);
return _ref;
}
SrcCell.prototype.set = function(x) {
var _this = this;
return recorder.mutating(function() {
var old;
if (_this.x !== x) {
old = _this.x;
_this.x = x;
_this.onSet.pub([old, x]);
return old;
}
});
};
return SrcCell;
})(ObsCell);
DepCell = rx.DepCell = (function(_super) {
__extends(DepCell, _super);
function DepCell(body, init) {
this.body = body;
DepCell.__super__.constructor.call(this, init != null ? init : null);
this.refreshing = false;
this.nestedBinds = [];
this.cleanups = [];
}
DepCell.prototype.refresh = function() {
var env, old,
_this = this;
if (!this.refreshing) {
old = this.x;
env = {
_recorded: false,
record: function(f) {
if (!_this.refreshing) {
_this.disconnect();
_this.refreshing = true;
if (env._recorded) {
throw 'this refresh has already recorded its dependencies';
}
env._recorded = true;
try {
return recorder.record(_this, function() {
return f.call(env);
});
} finally {
_this.refreshing = false;
}
}
},
done: function(x) {
_this.x = x;
if (old !== _this.x) {
return _this.onSet.pub([old, _this.x]);
}
}
};
return this.body.call(env);
}
};
DepCell.prototype.disconnect = function() {
var cleanup, nestedBind, _i, _j, _len, _len1, _ref1, _ref2;
_ref1 = this.cleanups;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
cleanup = _ref1[_i];
cleanup();
}
_ref2 = this.nestedBinds;
for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
nestedBind = _ref2[_j];
nestedBind.disconnect();
}
this.nestedBinds = [];
return this.cleanups = [];
};
DepCell.prototype.addNestedBind = function(nestedBind) {
return this.nestedBinds.push(nestedBind);
};
DepCell.prototype.addCleanup = function(cleanup) {
return this.cleanups.push(cleanup);
};
return DepCell;
})(ObsCell);
ObsArray = rx.ObsArray = (function() {
function ObsArray(xs) {
var _ref1,
_this = this;
this.xs = xs;
this.xs = (_ref1 = this.xs) != null ? _ref1 : [];
this.onChange = new Ev(function() {
return [[0, [], _this.xs]];
});
}
ObsArray.prototype.all = function() {
var _this = this;
recorder.sub(function(target) {
return rx.autoSub(_this.onChange, function() {
return target.refresh();
});
});
return _.clone(this.xs);
};
ObsArray.prototype.raw = function() {
var _this = this;
recorder.sub(function(target) {
return rx.autoSub(_this.onChange, function() {
return target.refresh();
});
});
return this.xs;
};
ObsArray.prototype.at = function(i) {
var _this = this;
recorder.sub(function(target) {
return rx.autoSub(_this.onChange, function(_arg) {
var added, index, removed;
index = _arg[0], removed = _arg[1], added = _arg[2];
if (index === i) {
return target.refresh();
}
});
});
return this.xs[i];
};
ObsArray.prototype.length = function() {
var _this = this;
recorder.sub(function(target) {
return rx.autoSub(_this.onChange, function(_arg) {
var added, index, removed;
index = _arg[0], removed = _arg[1], added = _arg[2];
if (removed.length !== added.length) {
return target.refresh();
}
});
});
return this.xs.length;
};
ObsArray.prototype.map = function(f) {
var ys;
ys = new MappedDepArray();
rx.autoSub(this.onChange, function(_arg) {
var added, index, removed;
index = _arg[0], removed = _arg[1], added = _arg[2];
return ys.realSplice(index, removed.length, added.map(f));
});
return ys;
};
ObsArray.prototype.realSplice = function(index, count, additions) {
var removed;
removed = this.xs.splice.apply(this.xs, [index, count].concat(additions));
return this.onChange.pub([index, removed, additions]);
};
return ObsArray;
})();
SrcArray = rx.SrcArray = (function(_super) {
__extends(SrcArray, _super);
function SrcArray() {
_ref1 = SrcArray.__super__.constructor.apply(this, arguments);
return _ref1;
}
SrcArray.prototype.spliceArray = function(index, count, additions) {
var _this = this;
return recorder.mutating(function() {
return _this.realSplice(index, count, additions);
});
};
SrcArray.prototype.splice = function() {
var additions, count, index;
index = arguments[0], count = arguments[1], additions = 3 <= arguments.length ? __slice.call(arguments, 2) : [];
return this.spliceArray(index, count, additions);
};
SrcArray.prototype.insert = function(x, index) {
return this.splice(index, 0, x);
};
SrcArray.prototype.remove = function(x) {
return this.removeAt(_(this.raw()).indexOf(x));
};
SrcArray.prototype.removeAt = function(index) {
return this.splice(index, 1);
};
SrcArray.prototype.push = function(x) {
return this.splice(this.length(), 0, x);
};
SrcArray.prototype.put = function(i, x) {
return this.splice(i, 1, x);
};
SrcArray.prototype.replace = function(xs) {
return this.spliceArray(0, this.length(), xs);
};
return SrcArray;
})(ObsArray);
MappedDepArray = rx.MappedDepArray = (function(_super) {
__extends(MappedDepArray, _super);
function MappedDepArray() {
_ref2 = MappedDepArray.__super__.constructor.apply(this, arguments);
return _ref2;
}
return MappedDepArray;
})(ObsArray);
DepArray = rx.DepArray = (function(_super) {
__extends(DepArray, _super);
function DepArray(f) {
var _this = this;
this.f = f;
DepArray.__super__.constructor.call(this);
rx.autoSub((bind(function() {
return _this.f();
})).onSet, function(_arg) {
var additions, count, index, old, val, _i, _ref3, _ref4, _results;
old = _arg[0], val = _arg[1];
if (old != null) {
_ref4 = firstWhere((function() {
_results = [];
for (var _i = 0, _ref3 = Math.min(old.length, val.length); 0 <= _ref3 ? _i <= _ref3 : _i >= _ref3; 0 <= _ref3 ? _i++ : _i--){ _results.push(_i); }
return _results;
}).apply(this), function(i) {
return old[i] !== val[i];
}), index = _ref4[0], index = _ref4[1];
} else {
index = 0;
}
if (index > -1) {
count = old != null ? old.length - index : 0;
additions = val.slice(index);
return _this.realSplice(index, count, additions);
}
});
}
return DepArray;
})(ObsArray);
ObsMap = rx.ObsMap = (function() {
function ObsMap(x) {
var _this = this;
this.x = x != null ? x : {};
this.onAdd = new Ev(function() {
var k, v, _results;
_results = [];
for (k in x) {
v = x[k];
_results.push([k, v]);
}
return _results;
});
this.onRemove = new Ev();
this.onChange = new Ev();
}
ObsMap.prototype.get = function(key) {
var _this = this;
recorder.sub(function(target) {
return rx.autoSub(_this.onAdd, function(_arg) {
var subkey, val;
subkey = _arg[0], val = _arg[1];
if (key === subkey) {
return target.refresh();
}
});
});
recorder.sub(function(target) {
return rx.autoSub(_this.onChange, function(_arg) {
var old, subkey, val;
subkey = _arg[0], old = _arg[1], val = _arg[2];
if (key === subkey) {
return target.refresh();
}
});
});
recorder.sub(function(target) {
return rx.autoSub(_this.onRemove, function(_arg) {
var old, subkey;
subkey = _arg[0], old = _arg[1];
if (key === subkey) {
return target.refresh();
}
});
});
return this.x[key];
};
ObsMap.prototype.all = function() {
var _this = this;
recorder.sub(function(target) {
return rx.autoSub(_this.onAdd, function() {
return target.refresh();
});
});
recorder.sub(function(target) {
return rx.autoSub(_this.onChange, function() {
return target.refresh();
});
});
recorder.sub(function(target) {
return rx.autoSub(_this.onRemove, function() {
return target.refresh();
});
});
return _.clone(this.x);
};
ObsMap.prototype.realPut = function(key, val) {
var old;
if (key in this.x) {
old = this.x[key];
this.x[key] = val;
this.onChange.pub([key, old, val]);
return old;
} else {
this.x[key] = val;
this.onAdd.pub([key, val]);
return void 0;
}
};
ObsMap.prototype.realRemove = function(key) {
var val;
val = popKey(this.x, key);
this.onRemove.pub([key, val]);
return val;
};
return ObsMap;
})();
SrcMap = rx.SrcMap = (function(_super) {
__extends(SrcMap, _super);
function SrcMap() {
_ref3 = SrcMap.__super__.constructor.apply(this, arguments);
return _ref3;
}
SrcMap.prototype.put = function(key, val) {
var _this = this;
return recorder.mutating(function() {
return _this.realPut(key, val);
});
};
SrcMap.prototype.remove = function(key) {
var _this = this;
return recorder.mutating(function() {
return _this.realRemove(key);
});
};
return SrcMap;
})(ObsMap);
DepMap = rx.DepMap = (function(_super) {
__extends(DepMap, _super);
function DepMap(f) {
this.f = f;
DepMap.__super__.constructor.call(this);
rx.autoSub(new DepCell(this.f).onSet, function(_arg) {
var k, old, v, val, _results;
old = _arg[0], val = _arg[1];
for (k in old) {
v = old[k];
if (!k in val) {
this.realRemove(k);
}
}
_results = [];
for (k in val) {
v = val[k];
if (this.x[k] !== v) {
_results.push(this.realPut(k, v));
} else {
_results.push(void 0);
}
}
return _results;
});
}
return DepMap;
})(ObsMap);
rx.reactify = function(obj, fieldspec) {
var arr, methName, name, spec;
if (_.isArray(obj)) {
arr = rx.array(_.clone(obj));
Object.defineProperties(obj, _.object((function() {
var _i, _len, _ref4, _results;
_ref4 = _.functions(arr);
_results = [];
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
methName = _ref4[_i];
if (methName !== 'length') {
_results.push((function(methName) {
var meth, newMeth, spec;
meth = obj[methName];
newMeth = function() {
var args, res, _ref5;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
if (meth != null) {
res = meth.call.apply(meth, [obj].concat(__slice.call(args)));
}
(_ref5 = arr[methName]).call.apply(_ref5, [arr].concat(__slice.call(args)));
return res;
};
spec = {
configurable: true,
enumerable: false,
value: newMeth,
writable: true
};
return [methName, spec];
})(methName));
}
}
return _results;
})()));
return obj;
} else {
return Object.defineProperties(obj, _.object((function() {
var _results;
_results = [];
for (name in fieldspec) {
spec = fieldspec[name];
_results.push((function(name, spec) {
var desc, obs, view, _ref4, _ref5;
desc = null;
switch (spec.type) {
case 'cell':
obs = rx.cell((_ref4 = spec.val) != null ? _ref4 : null);
desc = {
configurable: true,
enumerable: true,
get: function() {
return obs.get();
},
set: function(x) {
return obs.set(x);
}
};
break;
case 'array':
view = rx.reactify((_ref5 = spec.val) != null ? _ref5 : []);
desc = {
configurable: true,
enumerable: true,
get: function() {
view.raw();
return view;
},
set: function(x) {
view.splice.apply(view, [0, view.length].concat(__slice.call(x)));
return view;
}
};
break;
default:
throw "Unknown observable type: " + type;
}
return [name, desc];
})(name, spec));
}
return _results;
})()));
}
};
rx.autoReactify = function(obj) {
var name, type, val;
return rx.reactify(obj, _.object((function() {
var _i, _len, _ref4, _results;
_ref4 = Object.getOwnPropertyNames(obj);
_results = [];
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
name = _ref4[_i];
val = obj[name];
type = _.isFunction(val) ? null : _.isArray(val) ? 'array' : 'cell';
_results.push([
name, {
type: type,
val: val
}
]);
}
return _results;
})()));
};
_.extend(rx, {
cell: function(x) {
return new SrcCell(x);
},
array: function(xs) {
return new SrcArray(xs);
},
map: function(x) {
return new SrcMap(x);
}
});
rx.flatten = function(xs) {
return new DepArray(function() {
var x;
return _((function() {
var _i, _len, _results;
_results = [];
for (_i = 0, _len = xs.length; _i < _len; _i++) {
x = xs[_i];
if (x instanceof ObsArray) {
_results.push(x.raw());
} else if (x instanceof ObsCell) {
_results.push(x.get());
} else {
_results.push(x);
}
}
return _results;
})()).chain().flatten(true).filter(function(x) {
return x != null;
}).value();
});
};
$.fn.rx = function(prop) {
var checked, focused, map, val;
map = this.data('rx-map');
if (map == null) {
this.data('rx-map', map = mkMap());
}
if (prop in map) {
return map[prop];
}
return map[prop] = (function() {
var _this = this;
switch (prop) {
case 'focused':
focused = rx.cell(this.is(':focus'));
this.focus(function() {
return focused.set(true);
});
this.blur(function() {
return focused.set(false);
});
return focused;
case 'val':
val = rx.cell(this.val());
this.change(function() {
return val.set(_this.val());
});
this.on('input', function() {
return val.set(_this.val());
});
return val;
case 'checked':
checked = rx.cell(this.is(':checked'));
this.change(function() {
return checked.set(_this.is(':checked'));
});
return checked;
default:
throw 'Unknown reactive property type';
}
}).call(this);
};
if (typeof exports === 'undefined') {
this.rxt = rxt = {};
} else {
rxt = exports;
}
RawHtml = rxt.RawHtml = (function() {
function RawHtml(html) {
this.html = html;
}
return RawHtml;
})();
events = ["blur", "change", "click", "dblclick", "error", "focus", "focusin", "focusout", "hover", "keydown", "keypress", "keyup", "load", "mousedown", "mouseenter", "mouseleave", "mousemove", "mouseout", "mouseover", "mouseup", "ready", "resize", "scroll", "select", "submit", "toggle", "unload"];
specialAttrs = rxt.specialAttrs = {
init: function(elt, fn) {
return fn.call(elt);
}
};
_fn = function(ev) {
return specialAttrs[ev] = function(elt, fn) {
return elt[ev](function(e) {
return fn.call(elt, e);
});
};
};
for (_i = 0, _len = events.length; _i < _len; _i++) {
ev = events[_i];
_fn(ev);
}
props = ['async', 'autofocus', 'checked', 'location', 'multiple', 'readOnly', 'selected', 'selectedIndex', 'tagName', 'nodeName', 'nodeType', 'ownerDocument', 'defaultChecked', 'defaultSelected'];
propSet = _.object((function() {
var _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = props.length; _j < _len1; _j++) {
prop = props[_j];
_results.push([prop, null]);
}
return _results;
})());
setProp = function(elt, prop, val) {
if (prop === 'value') {
return elt.val(val);
} else if (prop in propSet) {
return elt.prop(prop, val);
} else {
return elt.attr(prop, val);
}
};
rxt.mktag = mktag = function(tag) {
return function(arg1, arg2) {
var attrs, contents, elt, key, name, toNodes, updateContents, value, _ref4, _ref5;
_ref4 = (arg1 == null) && (arg2 == null) ? [{}, null] : arg2 != null ? [arg1, arg2] : _.isString(arg1) || arg1 instanceof RawHtml || _.isArray(arg1) || arg1 instanceof ObsCell || arg1 instanceof ObsArray ? [{}, arg1] : [arg1, null], attrs = _ref4[0], contents = _ref4[1];
elt = $("<" + tag + "/>");
_ref5 = _.omit(attrs, _.keys(specialAttrs));
for (name in _ref5) {
value = _ref5[name];
if (value instanceof ObsCell) {
(function(name) {
return rx.autoSub(value.onSet, function(_arg) {
var old, val;
old = _arg[0], val = _arg[1];
return setProp(elt, name, val);
});
})(name);
} else {
setProp(elt, name, value);
}
}
if (contents != null) {
toNodes = function(contents) {
var child, parsed, _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = contents.length; _j < _len1; _j++) {
child = contents[_j];
if (_.isString(child)) {
_results.push(document.createTextNode(child));
} else if (child instanceof RawHtml) {
parsed = $(child.html);
if (parsed.length) {
throw 'Cannot insert RawHtml of multiple elements';
}
_results.push(parsed[0]);
} else if (child instanceof $) {
_results.push(child[0]);
} else {
throw 'Unknown element type in array: ' + child.constructor.name;
}
}
return _results;
};
updateContents = function(contents) {
var covers, hasWidth, left, node, nodes, top;
elt.html('');
if (_.isArray(contents)) {
nodes = toNodes(contents);
elt.append(nodes);
if (false) {
hasWidth = function(node) {
var e;
try {
return ($(node).width() != null) !== 0;
} catch (_error) {
e = _error;
return false;
}
};
covers = (function() {
var _j, _len1, _ref6, _ref7, _results;
_ref6 = nodes != null ? nodes : [];
_results = [];
for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
node = _ref6[_j];
if (!(hasWidth(node))) {
continue;
}
_ref7 = $(node).offset(), left = _ref7.left, top = _ref7.top;
_results.push($('<div/>').appendTo($('body').first()).addClass('updated-element').offset({
top: top,
left: left
}).width($(node).width()).height($(node).height()));
}
return _results;
})();
return setTimeout((function() {
var cover, _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = covers.length; _j < _len1; _j++) {
cover = covers[_j];
_results.push($(cover).remove());
}
return _results;
}), 2000);
}
} else if (_.isString(contents) || contents instanceof RawHtml) {
return updateContents([contents]);
} else {
throw 'Unknown type for contents: ' + contents.constructor.name;
}
};
if (contents instanceof ObsArray) {
rx.autoSub(contents.onChange, function(_arg) {
var added, index, removed, toAdd;
index = _arg[0], removed = _arg[1], added = _arg[2];
elt.contents().slice(index, index + removed.length).remove();
toAdd = toNodes(added);
if (index === elt.contents().length) {
return elt.append(toAdd);
} else {
return elt.contents().eq(index).before(toAdd);
}
});
} else if (contents instanceof ObsCell) {
rx.autoSub(contents.onSet, function(_arg) {
var old, val;
old = _arg[0], val = _arg[1];
return updateContents(val);
});
} else {
updateContents(contents);
}
}
for (key in attrs) {
if (key in specialAttrs) {
specialAttrs[key](elt, attrs[key], attrs, contents);
}
}
return elt;
};
};
tags = ['html', 'head', 'title', 'base', 'link', 'meta', 'style', 'script', 'noscript', 'body', 'body', 'section', 'nav', 'article', 'aside', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'h1', 'h6', 'header', 'footer', 'address', 'main', 'main', 'p', 'hr', 'pre', 'blockquote', 'ol', 'ul', 'li', 'dl', 'dt', 'dd', 'dd', 'figure', 'figcaption', 'div', 'a', 'em', 'strong', 'small', 's', 'cite', 'q', 'dfn', 'abbr', 'data', 'time', 'code', 'var', 'samp', 'kbd', 'sub', 'sup', 'i', 'b', 'u', 'mark', 'ruby', 'rt', 'rp', 'bdi', 'bdo', 'span', 'br', 'wbr', 'ins', 'del', 'img', 'iframe', 'embed', 'object', 'param', 'object', 'video', 'audio', 'source', 'video', 'audio', 'track', 'video', 'audio', 'canvas', 'map', 'area', 'area', 'map', 'svg', 'math', 'table', 'caption', 'colgroup', 'col', 'tbody', 'thead', 'tfoot', 'tr', 'td', 'th', 'form', 'fieldset', 'legend', 'fieldset', 'label', 'input', 'button', 'select', 'datalist', 'optgroup', 'option', 'select', 'datalist', 'textarea', 'keygen', 'output', 'progress', 'meter', 'details', 'summary', 'details', 'menuitem', 'menu'];
rxt.tags = _.object((function() {
var _j, _len1, _results;
_results = [];
for (_j = 0, _len1 = tags.length; _j < _len1; _j++) {
tag = tags[_j];
_results.push([tag, rxt.mktag(tag)]);
}
return _results;
})());
rxt.rawHtml = function(html) {
return new RawHtml(html);
};
rxt.importTags = function(x) {
return _(x != null ? x : _this).extend(rxt.tags);
};
rxt.cast = function(opts, types) {
var key, newval, value;
return _.object((function() {
var _results;
_results = [];
for (key in opts) {
value = opts[key];
newval = (function() {
switch (types[key]) {
case 'array':
if (value instanceof rx.ObsArray) {
return value;
} else if (_.isArray(value)) {
return new rx.DepArray(function() {
return value;
});
} else if (value instanceof rx.ObsCell) {
return new rx.DepArray(function() {
return value.get();
});
} else {
throw 'Cannot cast to array: ' + value.constructor.name;
}
break;
case 'cell':
if (value instanceof rx.ObsCell) {
return value;
} else {
return bind(function() {
return value;
});
}
break;
default:
return value;
}
})();
_results.push([key, newval]);
}
return _results;
})());
};
rxt.cssify = function(map) {
var k, v;
return ((function() {
var _results;
_results = [];
for (k in map) {
v = map[k];
if (v != null) {
_results.push("" + (_.str.dasherize(k)) + ": " + (_.isNumber(v) ? v + 'px' : v) + ";");
}
}
return _results;
})()).join(' ');
};
}).call(this);
|
packages/material-ui-icons/src/PersonPinCircleOutlined.js
|
kybarg/material-ui
|
import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(
<React.Fragment><path d="M12 1C7.59 1 4 4.59 4 9c0 5.57 6.96 13.34 7.26 13.67l.74.82.74-.82C13.04 22.34 20 14.57 20 9c0-4.41-3.59-8-8-8zm0 19.47C9.82 17.86 6 12.54 6 9c0-3.31 2.69-6 6-6s6 2.69 6 6c0 3.83-4.25 9.36-6 11.47zM12 9c.83 0 1.5-.67 1.5-1.5S12.83 6 12 6s-1.5.68-1.5 1.5c0 .83.67 1.5 1.5 1.5zm0 1c-1 0-3 .5-3 1.5v.12c.73.84 1.8 1.38 3 1.38s2.27-.54 3-1.38v-.12c0-1-2-1.5-3-1.5z" /></React.Fragment>
, 'PersonPinCircleOutlined');
|
client/containers/Profile.js
|
carlbernardo/gut
|
import React from 'react';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
//Actions
import * as authActions from './../actions/authActions';
import * as dinerActions from './../actions/dinerActions';
import * as pollActions from './../actions/pollActions';
import * as viewActions from './../actions/viewActions';
import * as friendActions from './../actions/friendActions';
//Components
import Navigation from './../components/Navigation';
import ProfileHome from './../components/ProfileHome';
import Poll from './../components/Poll';
class Profile extends React.Component {
constructor(){
super();
this.displayProfile = this.displayProfile.bind(this);
}
componentWillMount(){
const { authenticateUser } = this.props.authActions;
authenticateUser(localStorage.token);
}
displayProfile(){
if(this.props.showPoll && this.props.isSubmitting){
return(
<Poll {...this.props} />
)
} else {
return (
<ProfileHome {...this.props} />
)
}
}
render(){
return(
<div>
<Navigation {...this.props} />
<div className='container'>
{this.displayProfile()}
</div>
</div>
)
}
}
const mapStateToProps = (state) => {
return {
//auth state
username: state.authReducer.username,
isLoggedIn: state.authReducer.isLoggedIn,
isFetching: state.authReducer.isFetching,
authErrorMsg: state.authReducer.authErrorMsg,
showPoll: state.authReducer.showPoll,
//poll state
isSubmitting: state.pollReducer.isSubmitting,
selected: state.pollReducer.selected,
unselected: state.pollReducer.unselected,
pollErrorMessage: state.pollReducer.pollErrorMessage,
data: state.pollReducer.data,
isFetchingYelp: state.pollReducer.isFetchingYelp,
//diner state
diners: state.dinerReducer.diners,
location: state.dinerReducer.location,
recommendations: state.dinerReducer.recommendations,
beenTo: state.dinerReducer.beenTo,
topRestaurant: state.dinerReducer.topRestaurant,
index: state.dinerReducer.index,
isLoadingResults: state.dinerReducer.isLoadingResults,
isAddingHistory: state.dinerReducer.isAddingHistory,
uberData: state.dinerReducer.uberData,
isLoadingUberData: state.dinerReducer.isLoadingUberData,
pickupLocation: state.dinerReducer.pickupLocation,
avatarUrl: state.dinerReducer.avatarUrl,
//view state
displayFriendsChoice: state.viewReducer.displayFriendsChoice,
displayLocationChoice: state.viewReducer.displayLocationChoice,
displayResults: state.viewReducer.displayResults,
displayAddFriends: state.viewReducer.displayAddFriends,
displayUberInfo: state.viewReducer.displayUberInfo,
displayPreferences: state.viewReducer.displayPreferences,
displayHistory: state.viewReducer.displayHistory,
displayProfileHome: state.viewReducer.displayProfileHome,
//friend state
userFriends: state.friendReducer.userFriends,
friendSearchQuery: state.friendReducer.friendSearchQuery,
searchResults: state.friendReducer.searchResults,
friendsErrorMsg: state.friendReducer.friendsErrorMsg,
isSearching: state.friendReducer.isSearching,
addCheck: state.friendReducer.addCheck,
removeCheck: state.friendReducer.removeCheck,
isLoadingFriends: state.friendReducer.isLoadingFriends
}
}
const mapDispatchToProps = (dispatch) => {
return {
authActions: bindActionCreators(authActions, dispatch),
dinerActions: bindActionCreators(dinerActions, dispatch),
pollActions: bindActionCreators(pollActions, dispatch),
viewActions: bindActionCreators(viewActions, dispatch),
friendActions: bindActionCreators(friendActions, dispatch)
}
}
export default connect(mapStateToProps, mapDispatchToProps)(Profile);
|
Origami/src/components/inputcomponents/index.js
|
batra-mlp-lab/CloudCVfy-Frontend
|
import React from "react";
import { PropTypes } from "prop-types";
import TextInputShowcaseCard from "./TextInput/TextInputShowcaseCard";
import TypeInput from "./BaseInputComponent/TypeInput";
import ImageInputShowcaseCard from "./ImageInput/ImageInputShowcaseCard";
export function getInputComponentById(
id,
inputModelProps,
calling_context,
socketId,
sendAddr
) {
let labels = [];
let textLabels = [];
let imageLabels = [];
inputModelProps.map((prop, index) => {
if (prop.id === "1") {
textLabels.push(prop.label);
} else if (prop.id === "3") {
imageLabels.push(prop.label);
}
});
return (
<div>
<TypeInput
textLabels={textLabels}
imageLabels={imageLabels}
calling_context={calling_context}
socketId={socketId}
sendAddr={sendAddr}
/>
</div>
);
}
export function getAllInputComponentsForShowcase(data) {
return [
<TextInputShowcaseCard key={Math.random()} demoProps={data} />,
<ImageInputShowcaseCard key={Math.random()} demoProps={data} />
];
}
|
src/components/Posts/ListItem/ListItem.component.js
|
cajacko/RememberWhen
|
// @flow
import React, { Component } from 'react';
import withRouter from '@cajacko/lib/components/HOCs/withRouter';
import PostsListItem from './ListItem.render';
import type { ReactRouter } from '../../../types/General';
import type { PostID, PostContent } from '../../../types/Post';
type Props = ReactRouter & {
id: PostID,
baseRoute: string,
content: PostContent,
date: Date,
};
/**
* Business logic for the posts list item
*
* ATM just handles the routing
*/
class PostsListItemComponent extends Component<Props> {
static defaultProps: {};
/**
* Initialise the class, bind the actions
*
* @param {Object} props The props passed to the component
*
* @return {Void} No return value
*/
constructor(props) {
super(props);
(this: any).action = this.action.bind(this);
}
/**
* Handle the tap action on the list item. Redirects to the post view
*
* @return {Void} No return value
*/
action() {
this.props.history.push(`${this.props.baseRoute}/post/${this.props.id}`);
}
/**
* Render the component
*
* @return {ReactElement} Markup to render
*/
render() {
return <PostsListItem action={this.action} {...this.props} />;
}
}
PostsListItemComponent.defaultProps = {
baseRoute: '',
};
export default withRouter(PostsListItemComponent);
|
matricula/assets/939ddcb4/gridview/jquery.yiigridview.js
|
Proyecto-I/Matricula-Online
|
/**
* jQuery Yii GridView plugin file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright 2008-2010 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
(function ($) {
var selectCheckedRows, methods,
yiiXHR={},
gridSettings = [];
/**
* 1. Selects rows that have checkbox checked (only checkbox that is connected with selecting a row)
* 2. Check if "check all" need to be checked/unchecked
* @return object the jQuery object
*/
selectCheckedRows = function (gridId) {
var settings = gridSettings[gridId],
table = $('#' + gridId).find('.' + settings.tableClass);
table.children('tbody').find('input.select-on-check').filter(':checked').each(function () {
$(this).closest('tr').addClass('selected');
});
table.children('thead').find('th input').filter('[type="checkbox"]').each(function () {
var name = this.name.substring(0, this.name.length - 4) + '[]', //.. remove '_all' and add '[]''
$checks = $("input[name='" + name + "']", table);
this.checked = $checks.length > 0 && $checks.length === $checks.filter(':checked').length;
});
return this;
};
methods = {
/**
* yiiGridView set function.
* @param options map settings for the grid view. Available options are as follows:
* - ajaxUpdate: array, IDs of the containers whose content may be updated by ajax response
* - ajaxVar: string, the name of the request variable indicating the ID of the element triggering the AJAX request
* - ajaxType: string, the type (GET or POST) of the AJAX request
* - pagerClass: string, the CSS class for the pager container
* - tableClass: string, the CSS class for the table
* - selectableRows: integer, the number of rows that can be selected
* - updateSelector: string, the selector for choosing which elements can trigger ajax requests
* - beforeAjaxUpdate: function, the function to be called before ajax request is sent
* - afterAjaxUpdate: function, the function to be called after ajax response is received
* - ajaxUpdateError: function, the function to be called if an ajax error occurs
* - selectionChanged: function, the function to be called after the row selection is changed
* @return object the jQuery object
*/
init: function (options) {
var settings = $.extend({
ajaxUpdate: [],
ajaxVar: 'ajax',
ajaxType: 'GET',
csrfTokenName: null,
csrfToken: null,
pagerClass: 'pager',
loadingClass: 'loading',
filterClass: 'filters',
tableClass: 'items',
selectableRows: 1
// updateSelector: '#id .pager a, '#id .grid thead th a',
// beforeAjaxUpdate: function (id) {},
// afterAjaxUpdate: function (id, data) {},
// selectionChanged: function (id) {},
// url: 'ajax request URL'
}, options || {});
settings.tableClass = settings.tableClass.replace(/\s+/g, '.');
return this.each(function () {
var eventType,
eventTarget,
$grid = $(this),
id = $grid.attr('id'),
pagerSelector = '#' + id + ' .' + settings.pagerClass.replace(/\s+/g, '.') + ' a',
sortSelector = '#' + id + ' .' + settings.tableClass + ' thead th a.sort-link',
inputSelector = '#' + id + ' .' + settings.filterClass + ' input, ' + '#' + id + ' .' + settings.filterClass + ' select';
settings.updateSelector = settings.updateSelector
.replace('{page}', pagerSelector)
.replace('{sort}', sortSelector);
settings.filterSelector = settings.filterSelector
.replace('{filter}', inputSelector);
gridSettings[id] = settings;
if (settings.ajaxUpdate.length > 0) {
$(document).on('click.yiiGridView', settings.updateSelector, function () {
// Check to see if History.js is enabled for our Browser
if (settings.enableHistory && window.History.enabled) {
// Ajaxify this link
var href = $(this).attr('href');
if(href){
var url = href.split('?'),
params = $.deparam.querystring('?'+ (url[1] || ''));
delete params[settings.ajaxVar];
var updateUrl = $.param.querystring(url[0], params);
window.History.pushState({url: updateUrl}, document.title, updateUrl);
}
} else {
$('#' + id).yiiGridView('update', {url: $(this).attr('href')});
}
return false;
});
}
$(document).on('change.yiiGridView keydown.yiiGridView', settings.filterSelector, function (event) {
if (event.type === 'keydown') {
if (event.keyCode !== 13) {
return; // only react to enter key
} else {
eventType = 'keydown';
eventTarget = event.target;
}
} else {
// prevent processing for both keydown and change events on the same element
if (eventType === 'keydown' && eventTarget === event.target) {
eventType = '';
eventTarget = null;
return;
}
}
var data = $(settings.filterSelector).serialize();
if (settings.pageVar !== undefined) {
data += '&' + settings.pageVar + '=1';
}
if (settings.enableHistory && settings.ajaxUpdate !== false && window.History.enabled) {
// Ajaxify this link
var url = $('#' + id).yiiGridView('getUrl'),
params = $.deparam.querystring($.param.querystring(url, data));
delete params[settings.ajaxVar];
var updateUrl = $.param.querystring(url.substr(0, url.indexOf('?')), params);
window.History.pushState({url: updateUrl}, document.title, updateUrl);
} else {
$('#' + id).yiiGridView('update', {data: data});
}
return false;
});
if (settings.enableHistory && settings.ajaxUpdate !== false && window.History.enabled) {
$(window).bind('statechange', function() { // Note: We are using statechange instead of popstate
var State = window.History.getState(); // Note: We are using History.getState() instead of event.state
if (State.data.url === undefined) {
State.data.url = State.url;
}
$('#' + id).yiiGridView('update', State.data);
});
}
if (settings.selectableRows > 0) {
selectCheckedRows(this.id);
$(document).on('click.yiiGridView', '#' + id + ' .' + settings.tableClass + ' > tbody > tr', function (e) {
var $currentGrid, $row, isRowSelected, $checks,
$target = $(e.target);
if ($target.closest('td').is('.empty,.button-column') || (e.target.type === 'checkbox' && !$target.hasClass('select-on-check'))) {
return;
}
$row = $(this);
$currentGrid = $('#' + id);
$checks = $('input.select-on-check', $currentGrid);
isRowSelected = $row.toggleClass('selected').hasClass('selected');
if (settings.selectableRows === 1) {
$row.siblings().removeClass('selected');
$checks.prop('checked', false);
}
$('input.select-on-check', $row).prop('checked', isRowSelected);
$("input.select-on-check-all", $currentGrid).prop('checked', $checks.length === $checks.filter(':checked').length);
if (settings.selectionChanged !== undefined) {
settings.selectionChanged(id);
}
});
if (settings.selectableRows > 1) {
$(document).on('click.yiiGridView', '#' + id + ' .select-on-check-all', function () {
var $currentGrid = $('#' + id),
$checks = $('input.select-on-check', $currentGrid),
$checksAll = $('input.select-on-check-all', $currentGrid),
$rows = $currentGrid.find('.' + settings.tableClass).children('tbody').children();
if (this.checked) {
$rows.addClass('selected');
$checks.prop('checked', true);
$checksAll.prop('checked', true);
} else {
$rows.removeClass('selected');
$checks.prop('checked', false);
$checksAll.prop('checked', false);
}
if (settings.selectionChanged !== undefined) {
settings.selectionChanged(id);
}
});
}
} else {
$(document).on('click.yiiGridView', '#' + id + ' .select-on-check', false);
}
});
},
/**
* Returns the key value for the specified row
* @param row integer the row number (zero-based index)
* @return string the key value
*/
getKey: function (row) {
return this.children('.keys').children('span').eq(row).text();
},
/**
* Returns the URL that generates the grid view content.
* @return string the URL that generates the grid view content.
*/
getUrl: function () {
var sUrl = gridSettings[this.attr('id')].url;
return sUrl || this.children('.keys').attr('title');
},
/**
* Returns the jQuery collection of the cells in the specified row.
* @param row integer the row number (zero-based index)
* @return jQuery the jQuery collection of the cells in the specified row.
*/
getRow: function (row) {
var sClass = gridSettings[this.attr('id')].tableClass;
return this.find('.' + sClass).children('tbody').children('tr').eq(row).children();
},
/**
* Returns the jQuery collection of the cells in the specified column.
* @param column integer the column number (zero-based index)
* @return jQuery the jQuery collection of the cells in the specified column.
*/
getColumn: function (column) {
var sClass = gridSettings[this.attr('id')].tableClass;
return this.find('.' + sClass).children('tbody').children('tr').children('td:nth-child(' + (column + 1) + ')');
},
/**
* Performs an AJAX-based update of the grid view contents.
* @param options map the AJAX request options (see jQuery.ajax API manual). By default,
* the URL to be requested is the one that generates the current content of the grid view.
* @return object the jQuery object
*/
update: function (options) {
var customError;
if (options && options.error !== undefined) {
customError = options.error;
delete options.error;
}
return this.each(function () {
var $form,
$grid = $(this),
id = $grid.attr('id'),
settings = gridSettings[id];
options = $.extend({
type: settings.ajaxType,
url: $grid.yiiGridView('getUrl'),
success: function (data) {
var $data = $('<div>' + data + '</div>');
$.each(settings.ajaxUpdate, function (i, el) {
var updateId = '#' + el;
$(updateId).replaceWith($(updateId, $data));
});
if (settings.afterAjaxUpdate !== undefined) {
settings.afterAjaxUpdate(id, data);
}
if (settings.selectableRows > 0) {
selectCheckedRows(id);
}
},
complete: function () {
yiiXHR[id] = null;
$grid.removeClass(settings.loadingClass);
},
error: function (XHR, textStatus, errorThrown) {
var ret, err;
if (XHR.readyState === 0 || XHR.status === 0) {
return;
}
if (customError !== undefined) {
ret = customError(XHR);
if (ret !== undefined && !ret) {
return;
}
}
switch (textStatus) {
case 'timeout':
err = 'The request timed out!';
break;
case 'parsererror':
err = 'Parser error!';
break;
case 'error':
if (XHR.status && !/^\s*$/.test(XHR.status)) {
err = 'Error ' + XHR.status;
} else {
err = 'Error';
}
if (XHR.responseText && !/^\s*$/.test(XHR.responseText)) {
err = err + ': ' + XHR.responseText;
}
break;
}
if (settings.ajaxUpdateError !== undefined) {
settings.ajaxUpdateError(XHR, textStatus, errorThrown, err, id);
} else if (err) {
alert(err);
}
}
}, options || {});
if (options.type === 'GET') {
if (options.data !== undefined) {
options.url = $.param.querystring(options.url, options.data);
options.data = {};
}
} else {
if (options.data === undefined) {
options.data = {};
$.each($(settings.filterSelector).serializeArray(), function () {
options.data[this.name] = this.value;
});
}
}
if (settings.csrfTokenName && settings.csrfToken) {
if (typeof options.data=='string')
options.data+='&'+settings.csrfTokenName+'='+settings.csrfToken;
else
options.data[settings.csrfTokenName] = settings.csrfToken;
}
if(yiiXHR[id] != null){
yiiXHR[id].abort();
}
//class must be added after yiiXHR.abort otherwise ajax.error will remove it
$grid.addClass(settings.loadingClass);
if (settings.ajaxUpdate !== false) {
if(settings.ajaxVar) {
options.url = $.param.querystring(options.url, settings.ajaxVar + '=' + id);
}
if (settings.beforeAjaxUpdate !== undefined) {
settings.beforeAjaxUpdate(id, options);
}
yiiXHR[id] = $.ajax(options);
} else { // non-ajax mode
if (options.type === 'GET') {
window.location.href = options.url;
} else { // POST mode
$form = $('<form action="' + options.url + '" method="post"></form>').appendTo('body');
if (options.data === undefined) {
options.data = {};
}
if (options.data.returnUrl === undefined) {
options.data.returnUrl = window.location.href;
}
$.each(options.data, function (name, value) {
$form.append($('<input type="hidden" name="t" value="" />').attr('name', name).val(value));
});
$form.submit();
}
}
});
},
/**
* Returns the key values of the currently selected rows.
* @return array the key values of the currently selected rows.
*/
getSelection: function () {
var settings = gridSettings[this.attr('id')],
keys = this.find('.keys span'),
selection = [];
this.find('.' + settings.tableClass).children('tbody').children().each(function (i) {
if ($(this).hasClass('selected')) {
selection.push(keys.eq(i).text());
}
});
return selection;
},
/**
* Returns the key values of the currently checked rows.
* @param column_id string the ID of the column
* @return array the key values of the currently checked rows.
*/
getChecked: function (column_id) {
var settings = gridSettings[this.attr('id')],
keys = this.find('.keys span'),
checked = [];
if (column_id.substring(column_id.length - 2) !== '[]') {
column_id = column_id + '[]';
}
this.find('.' + settings.tableClass).children('tbody').children('tr').children('td').children('input[name="' + column_id + '"]').each(function (i) {
if (this.checked) {
checked.push(keys.eq(i).text());
}
});
return checked;
}
};
$.fn.yiiGridView = function (method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.yiiGridView');
return false;
}
};
/******************************************************************************
*** DEPRECATED METHODS
*** used before Yii 1.1.9
******************************************************************************/
$.fn.yiiGridView.settings = gridSettings;
/**
* Returns the key value for the specified row
* @param id string the ID of the grid view container
* @param row integer the row number (zero-based index)
* @return string the key value
*/
$.fn.yiiGridView.getKey = function (id, row) {
return $('#' + id).yiiGridView('getKey', row);
};
/**
* Returns the URL that generates the grid view content.
* @param id string the ID of the grid view container
* @return string the URL that generates the grid view content.
*/
$.fn.yiiGridView.getUrl = function (id) {
return $('#' + id).yiiGridView('getUrl');
};
/**
* Returns the jQuery collection of the cells in the specified row.
* @param id string the ID of the grid view container
* @param row integer the row number (zero-based index)
* @return jQuery the jQuery collection of the cells in the specified row.
*/
$.fn.yiiGridView.getRow = function (id, row) {
return $('#' + id).yiiGridView('getRow', row);
};
/**
* Returns the jQuery collection of the cells in the specified column.
* @param id string the ID of the grid view container
* @param column integer the column number (zero-based index)
* @return jQuery the jQuery collection of the cells in the specified column.
*/
$.fn.yiiGridView.getColumn = function (id, column) {
return $('#' + id).yiiGridView('getColumn', column);
};
/**
* Performs an AJAX-based update of the grid view contents.
* @param id string the ID of the grid view container
* @param options map the AJAX request options (see jQuery.ajax API manual). By default,
* the URL to be requested is the one that generates the current content of the grid view.
*/
$.fn.yiiGridView.update = function (id, options) {
$('#' + id).yiiGridView('update', options);
};
/**
* Returns the key values of the currently selected rows.
* @param id string the ID of the grid view container
* @return array the key values of the currently selected rows.
*/
$.fn.yiiGridView.getSelection = function (id) {
return $('#' + id).yiiGridView('getSelection');
};
/**
* Returns the key values of the currently checked rows.
* @param id string the ID of the grid view container
* @param column_id string the ID of the column
* @return array the key values of the currently checked rows.
*/
$.fn.yiiGridView.getChecked = function (id, column_id) {
return $('#' + id).yiiGridView('getChecked', column_id);
};
})(jQuery);
|
src/utils/children.js
|
mikedklein/material-ui
|
import React from 'react';
import createFragment from 'react-addons-create-fragment';
export default {
create(fragments) {
let newFragments = {};
let validChildrenCount = 0;
let firstKey;
//Only create non-empty key fragments
for (let key in fragments) {
const currentChild = fragments[key];
if (currentChild) {
if (validChildrenCount === 0) firstKey = key;
newFragments[key] = currentChild;
validChildrenCount++;
}
}
if (validChildrenCount === 0) return undefined;
if (validChildrenCount === 1) return newFragments[firstKey];
return createFragment(newFragments);
},
extend(children, extendedProps, extendedChildren) {
return React.isValidElement(children) ?
React.Children.map(children, (child) => {
const newProps = typeof (extendedProps) === 'function' ?
extendedProps(child) : extendedProps;
const newChildren = typeof (extendedChildren) === 'function' ?
extendedChildren(child) : extendedChildren ?
extendedChildren : child.props.children;
return React.cloneElement(child, newProps, newChildren);
}) : children;
},
};
|
src/MoleHole.js
|
motevets/rewhack
|
import React, { Component } from 'react';
import './MoleHole.css';
class MoleHole extends Component {
calculateClasses(){
let className = "MoleHole";
className += ` level${this.props.level}`;
if(this.props.mole){
className += " withMole";
}
if(this.props.whacked) {
className += " whacked ";
className += this.props.mole ? "hit" : "miss";
}
return className;
}
handleWhack = () => {
const showWhack = this.props.whack;
showWhack();
}
render(){
return (
<div
className={this.calculateClasses()}
onMouseDown={this.handleWhack}
/>
);
}
}
export default MoleHole;
|
ajax/libs/parsley.js/2.1.3/parsley.js
|
him2him2/cdnjs
|
/*!
* Parsleyjs
* Guillaume Potier - <guillaume@wisembly.com>
* Version 2.1.3 - built Wed Jul 29 2015 08:27:00
* MIT Licensed
*
*/
!(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module depending on jQuery.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS
module.exports = factory(require('jquery'));
} else {
// Register plugin with global jQuery object.
factory(jQuery);
}
}(function ($) {
// small hack for requirejs if jquery is loaded through map and not path
// see http://requirejs.org/docs/jquery.html
if ('undefined' === typeof $ && 'undefined' !== typeof window.jQuery)
$ = window.jQuery;
var globalID = 1,
pastWarnings = {};
var ParsleyUtils = {
// Parsley DOM-API
// returns object from dom attributes and values
attr: function ($element, namespace, obj) {
var
attribute, attributes,
regex = new RegExp('^' + namespace, 'i');
if ('undefined' === typeof obj)
obj = {};
else {
// Clear all own properties. This won't affect prototype's values
for (var i in obj) {
if (obj.hasOwnProperty(i))
delete obj[i];
}
}
if ('undefined' === typeof $element || 'undefined' === typeof $element[0])
return obj;
attributes = $element[0].attributes;
for (var i = attributes.length; i--; ) {
attribute = attributes[i];
if (attribute && attribute.specified && regex.test(attribute.name)) {
obj[this.camelize(attribute.name.slice(namespace.length))] = this.deserializeValue(attribute.value);
}
}
return obj;
},
checkAttr: function ($element, namespace, checkAttr) {
return $element.is('[' + namespace + checkAttr + ']');
},
setAttr: function ($element, namespace, attr, value) {
$element[0].setAttribute(this.dasherize(namespace + attr), String(value));
},
generateID: function () {
return '' + globalID++;
},
/** Third party functions **/
// Zepto deserialize function
deserializeValue: function (value) {
var num;
try {
return value ?
value == "true" ||
(value == "false" ? false :
value == "null" ? null :
!isNaN(num = Number(value)) ? num :
/^[\[\{]/.test(value) ? $.parseJSON(value) :
value)
: value;
} catch (e) { return value; }
},
// Zepto camelize function
camelize: function (str) {
return str.replace(/-+(.)?/g, function (match, chr) {
return chr ? chr.toUpperCase() : '';
});
},
// Zepto dasherize function
dasherize: function (str) {
return str.replace(/::/g, '/')
.replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2')
.replace(/([a-z\d])([A-Z])/g, '$1_$2')
.replace(/_/g, '-')
.toLowerCase();
},
warn: function() {
if (window.console && 'function' === typeof window.console.warn)
window.console.warn.apply(window.console, arguments);
},
warnOnce: function(msg) {
if (!pastWarnings[msg]) {
pastWarnings[msg] = true;
this.warn.apply(this, arguments);
}
},
_resetWarnings: function() {
pastWarnings = {};
},
// Object.create polyfill, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create#Polyfill
objectCreate: Object.create || (function () {
var Object = function () {};
return function (prototype) {
if (arguments.length > 1) {
throw Error('Second argument not supported');
}
if (typeof prototype != 'object') {
throw TypeError('Argument must be an object');
}
Object.prototype = prototype;
var result = new Object();
Object.prototype = null;
return result;
};
})()
};
// All these options could be overriden and specified directly in DOM using
// `data-parsley-` default DOM-API
// eg: `inputs` can be set in DOM using `data-parsley-inputs="input, textarea"`
// eg: `data-parsley-stop-on-first-failing-constraint="false"`
var ParsleyDefaults = {
// ### General
// Default data-namespace for DOM API
namespace: 'data-parsley-',
// Supported inputs by default
inputs: 'input, textarea, select',
// Excluded inputs by default
excluded: 'input[type=button], input[type=submit], input[type=reset], input[type=hidden]',
// Stop validating field on highest priority failing constraint
priorityEnabled: true,
// ### Field only
// identifier used to group together inputs (e.g. radio buttons...)
multiple: null,
// identifier (or array of identifiers) used to validate only a select group of inputs
group: null,
// ### UI
// Enable\Disable error messages
uiEnabled: true,
// Key events threshold before validation
validationThreshold: 3,
// Focused field on form validation error. 'first'|'last'|'none'
focus: 'first',
// `$.Event()` that will trigger validation. eg: `keyup`, `change`...
trigger: false,
// Class that would be added on every failing validation Parsley field
errorClass: 'parsley-error',
// Same for success validation
successClass: 'parsley-success',
// Return the `$element` that will receive these above success or error classes
// Could also be (and given directly from DOM) a valid selector like `'#div'`
classHandler: function (ParsleyField) {},
// Return the `$element` where errors will be appended
// Could also be (and given directly from DOM) a valid selector like `'#div'`
errorsContainer: function (ParsleyField) {},
// ul elem that would receive errors' list
errorsWrapper: '<ul class="parsley-errors-list"></ul>',
// li elem that would receive error message
errorTemplate: '<li></li>'
};
var ParsleyAbstract = function () {};
ParsleyAbstract.prototype = {
asyncSupport: false,
actualizeOptions: function () {
ParsleyUtils.attr(this.$element, this.options.namespace, this.domOptions);
if (this.parent && this.parent.actualizeOptions)
this.parent.actualizeOptions();
return this;
},
_resetOptions: function (initOptions) {
this.domOptions = ParsleyUtils.objectCreate(this.parent.options);
this.options = ParsleyUtils.objectCreate(this.domOptions);
// Shallow copy of ownProperties of initOptions:
for (var i in initOptions) {
if (initOptions.hasOwnProperty(i))
this.options[i] = initOptions[i];
}
this.actualizeOptions();
},
// ParsleyValidator validate proxy function . Could be replaced by third party scripts
validateThroughValidator: function (value, constraints, priority) {
return window.ParsleyValidator.validate(value, constraints, priority);
},
_listeners: null,
// Register a callback for the given event name.
// Callback is called with context as the first argument and the `this`.
// The context is the current parsley instance, or window.Parsley if global.
// A return value of `false` will interrupt the calls
on: function (name, fn) {
this._listeners = this._listeners || {};
var queue = this._listeners[name] = this._listeners[name] || [];
queue.push(fn);
return this;
},
// Deprecated. Use `on` instead.
subscribe: function(name, fn) {
$.listenTo(this, name.toLowerCase(), fn);
},
// Unregister a callback (or all if none is given) for the given event name
off: function (name, fn) {
var queue = this._listeners && this._listeners[name];
if (queue) {
if (!fn) {
delete this._listeners[name];
} else {
for(var i = queue.length; i--; )
if (queue[i] === fn)
queue.splice(i, 1);
}
}
return this;
},
// Deprecated. Use `off`
unsubscribe: function(name, fn) {
$.unsubscribeTo(this, name.toLowerCase());
},
// Trigger an event of the given name.
// A return value of `false` interrupts the callback chain.
// Returns false if execution was interrupted.
trigger: function (name, target) {
target = target || this;
var queue = this._listeners && this._listeners[name];
var result, parentResult;
if (queue) {
for(var i = queue.length; i--; ) {
result = queue[i].call(target, target);
if (result === false) return result;
}
}
if (this.parent) {
return this.parent.trigger(name, target);
}
return true;
},
// Reset UI
reset: function () {
// Field case: just emit a reset event for UI
if ('ParsleyForm' !== this.__class__)
return this._trigger('reset');
// Form case: emit a reset event for each field
for (var i = 0; i < this.fields.length; i++)
this.fields[i]._trigger('reset');
this._trigger('reset');
},
// Destroy Parsley instance (+ UI)
destroy: function () {
// Field case: emit destroy event to clean UI and then destroy stored instance
if ('ParsleyForm' !== this.__class__) {
this.$element.removeData('Parsley');
this.$element.removeData('ParsleyFieldMultiple');
this._trigger('destroy');
return;
}
// Form case: destroy all its fields and then destroy stored instance
for (var i = 0; i < this.fields.length; i++)
this.fields[i].destroy();
this.$element.removeData('Parsley');
this._trigger('destroy');
},
_findRelatedMultiple: function() {
return this.parent.$element.find('[' + this.options.namespace + 'multiple="' + this.options.multiple +'"]');
}
};
/*!
* validator.js
* Guillaume Potier - <guillaume@wisembly.com>
* Version 1.0.1 - built Mon Aug 25 2014 16:10:10
* MIT Licensed
*
*/
var Validator = ( function ( ) {
var exports = {};
/**
* Validator
*/
var Validator = function ( options ) {
this.__class__ = 'Validator';
this.__version__ = '1.0.1';
this.options = options || {};
this.bindingKey = this.options.bindingKey || '_validatorjsConstraint';
};
Validator.prototype = {
constructor: Validator,
/*
* Validate string: validate( string, Assert, string ) || validate( string, [ Assert, Assert ], [ string, string ] )
* Validate object: validate( object, Constraint, string ) || validate( object, Constraint, [ string, string ] )
* Validate binded object: validate( object, string ) || validate( object, [ string, string ] )
*/
validate: function ( objectOrString, AssertsOrConstraintOrGroup, group ) {
if ( 'string' !== typeof objectOrString && 'object' !== typeof objectOrString )
throw new Error( 'You must validate an object or a string' );
// string / array validation
if ( 'string' === typeof objectOrString || _isArray(objectOrString) )
return this._validateString( objectOrString, AssertsOrConstraintOrGroup, group );
// binded object validation
if ( this.isBinded( objectOrString ) )
return this._validateBindedObject( objectOrString, AssertsOrConstraintOrGroup );
// regular object validation
return this._validateObject( objectOrString, AssertsOrConstraintOrGroup, group );
},
bind: function ( object, constraint ) {
if ( 'object' !== typeof object )
throw new Error( 'Must bind a Constraint to an object' );
object[ this.bindingKey ] = new Constraint( constraint );
return this;
},
unbind: function ( object ) {
if ( 'undefined' === typeof object._validatorjsConstraint )
return this;
delete object[ this.bindingKey ];
return this;
},
isBinded: function ( object ) {
return 'undefined' !== typeof object[ this.bindingKey ];
},
getBinded: function ( object ) {
return this.isBinded( object ) ? object[ this.bindingKey ] : null;
},
_validateString: function ( string, assert, group ) {
var result, failures = [];
if ( !_isArray( assert ) )
assert = [ assert ];
for ( var i = 0; i < assert.length; i++ ) {
if ( ! ( assert[ i ] instanceof Assert) )
throw new Error( 'You must give an Assert or an Asserts array to validate a string' );
result = assert[ i ].check( string, group );
if ( result instanceof Violation )
failures.push( result );
}
return failures.length ? failures : true;
},
_validateObject: function ( object, constraint, group ) {
if ( 'object' !== typeof constraint )
throw new Error( 'You must give a constraint to validate an object' );
if ( constraint instanceof Constraint )
return constraint.check( object, group );
return new Constraint( constraint ).check( object, group );
},
_validateBindedObject: function ( object, group ) {
return object[ this.bindingKey ].check( object, group );
}
};
Validator.errorCode = {
must_be_a_string: 'must_be_a_string',
must_be_an_array: 'must_be_an_array',
must_be_a_number: 'must_be_a_number',
must_be_a_string_or_array: 'must_be_a_string_or_array'
};
/**
* Constraint
*/
var Constraint = function ( data, options ) {
this.__class__ = 'Constraint';
this.options = options || {};
this.nodes = {};
if ( data ) {
try {
this._bootstrap( data );
} catch ( err ) {
throw new Error( 'Should give a valid mapping object to Constraint', err, data );
}
}
};
Constraint.prototype = {
constructor: Constraint,
check: function ( object, group ) {
var result, failures = {};
// check all constraint nodes.
for ( var property in this.nodes ) {
var isRequired = false;
var constraint = this.get(property);
var constraints = _isArray( constraint ) ? constraint : [constraint];
for (var i = constraints.length - 1; i >= 0; i--) {
if ( 'Required' === constraints[i].__class__ ) {
isRequired = constraints[i].requiresValidation( group );
continue;
}
}
if ( ! this.has( property, object ) && ! this.options.strict && ! isRequired ) {
continue;
}
try {
if (! this.has( property, this.options.strict || isRequired ? object : undefined ) ) {
// we trigger here a HaveProperty Assert violation to have uniform Violation object in the end
new Assert().HaveProperty( property ).validate( object );
}
result = this._check( property, object[ property ], group );
// check returned an array of Violations or an object mapping Violations
if ( ( _isArray( result ) && result.length > 0 ) || ( !_isArray( result ) && !_isEmptyObject( result ) ) ) {
failures[ property ] = result;
}
} catch ( violation ) {
failures[ property ] = violation;
}
}
return _isEmptyObject(failures) ? true : failures;
},
add: function ( node, object ) {
if ( object instanceof Assert || ( _isArray( object ) && object[ 0 ] instanceof Assert ) ) {
this.nodes[ node ] = object;
return this;
}
if ( 'object' === typeof object && !_isArray( object ) ) {
this.nodes[ node ] = object instanceof Constraint ? object : new Constraint( object );
return this;
}
throw new Error( 'Should give an Assert, an Asserts array, a Constraint', object );
},
has: function ( node, nodes ) {
nodes = 'undefined' !== typeof nodes ? nodes : this.nodes;
return 'undefined' !== typeof nodes[ node ];
},
get: function ( node, placeholder ) {
return this.has( node ) ? this.nodes[ node ] : placeholder || null;
},
remove: function ( node ) {
var _nodes = [];
for ( var i in this.nodes )
if ( i !== node )
_nodes[ i ] = this.nodes[ i ];
this.nodes = _nodes;
return this;
},
_bootstrap: function ( data ) {
if ( data instanceof Constraint )
return this.nodes = data.nodes;
for ( var node in data )
this.add( node, data[ node ] );
},
_check: function ( node, value, group ) {
// Assert
if ( this.nodes[ node ] instanceof Assert )
return this._checkAsserts( value, [ this.nodes[ node ] ], group );
// Asserts
if ( _isArray( this.nodes[ node ] ) )
return this._checkAsserts( value, this.nodes[ node ], group );
// Constraint -> check api
if ( this.nodes[ node ] instanceof Constraint )
return this.nodes[ node ].check( value, group );
throw new Error( 'Invalid node', this.nodes[ node ] );
},
_checkAsserts: function ( value, asserts, group ) {
var result, failures = [];
for ( var i = 0; i < asserts.length; i++ ) {
result = asserts[ i ].check( value, group );
if ( 'undefined' !== typeof result && true !== result )
failures.push( result );
// Some asserts (Collection for example) could return an object
// if ( result && ! ( result instanceof Violation ) )
// return result;
//
// // Vast assert majority return Violation
// if ( result instanceof Violation )
// failures.push( result );
}
return failures;
}
};
/**
* Violation
*/
var Violation = function ( assert, value, violation ) {
this.__class__ = 'Violation';
if ( ! ( assert instanceof Assert ) )
throw new Error( 'Should give an assertion implementing the Assert interface' );
this.assert = assert;
this.value = value;
if ( 'undefined' !== typeof violation )
this.violation = violation;
};
Violation.prototype = {
show: function () {
var show = {
assert: this.assert.__class__,
value: this.value
};
if ( this.violation )
show.violation = this.violation;
return show;
},
__toString: function () {
if ( 'undefined' !== typeof this.violation )
this.violation = '", ' + this.getViolation().constraint + ' expected was ' + this.getViolation().expected;
return this.assert.__class__ + ' assert failed for "' + this.value + this.violation || '';
},
getViolation: function () {
var constraint, expected;
for ( constraint in this.violation )
expected = this.violation[ constraint ];
return { constraint: constraint, expected: expected };
}
};
/**
* Assert
*/
var Assert = function ( group ) {
this.__class__ = 'Assert';
this.__parentClass__ = this.__class__;
this.groups = [];
if ( 'undefined' !== typeof group )
this.addGroup( group );
};
Assert.prototype = {
construct: Assert,
requiresValidation: function ( group ) {
if ( group && !this.hasGroup( group ) )
return false;
if ( !group && this.hasGroups() )
return false;
return true;
},
check: function ( value, group ) {
if ( !this.requiresValidation( group ) )
return;
try {
return this.validate( value, group );
} catch ( violation ) {
return violation;
}
},
hasGroup: function ( group ) {
if ( _isArray( group ) )
return this.hasOneOf( group );
// All Asserts respond to "Any" group
if ( 'Any' === group )
return true;
// Asserts with no group also respond to "Default" group. Else return false
if ( !this.hasGroups() )
return 'Default' === group;
return -1 !== this.groups.indexOf( group );
},
hasOneOf: function ( groups ) {
for ( var i = 0; i < groups.length; i++ )
if ( this.hasGroup( groups[ i ] ) )
return true;
return false;
},
hasGroups: function () {
return this.groups.length > 0;
},
addGroup: function ( group ) {
if ( _isArray( group ) )
return this.addGroups( group );
if ( !this.hasGroup( group ) )
this.groups.push( group );
return this;
},
removeGroup: function ( group ) {
var _groups = [];
for ( var i = 0; i < this.groups.length; i++ )
if ( group !== this.groups[ i ] )
_groups.push( this.groups[ i ] );
this.groups = _groups;
return this;
},
addGroups: function ( groups ) {
for ( var i = 0; i < groups.length; i++ )
this.addGroup( groups[ i ] );
return this;
},
/**
* Asserts definitions
*/
HaveProperty: function ( node ) {
this.__class__ = 'HaveProperty';
this.node = node;
this.validate = function ( object ) {
if ( 'undefined' === typeof object[ this.node ] )
throw new Violation( this, object, { value: this.node } );
return true;
};
return this;
},
Blank: function () {
this.__class__ = 'Blank';
this.validate = function ( value ) {
if ( 'string' !== typeof value )
throw new Violation( this, value, { value: Validator.errorCode.must_be_a_string } );
if ( '' !== value.replace( /^\s+/g, '' ).replace( /\s+$/g, '' ) )
throw new Violation( this, value );
return true;
};
return this;
},
Callback: function ( fn ) {
this.__class__ = 'Callback';
this.arguments = Array.prototype.slice.call( arguments );
if ( 1 === this.arguments.length )
this.arguments = [];
else
this.arguments.splice( 0, 1 );
if ( 'function' !== typeof fn )
throw new Error( 'Callback must be instanciated with a function' );
this.fn = fn;
this.validate = function ( value ) {
var result = this.fn.apply( this, [ value ].concat( this.arguments ) );
if ( true !== result )
throw new Violation( this, value, { result: result } );
return true;
};
return this;
},
Choice: function ( list ) {
this.__class__ = 'Choice';
if ( !_isArray( list ) && 'function' !== typeof list )
throw new Error( 'Choice must be instanciated with an array or a function' );
this.list = list;
this.validate = function ( value ) {
var list = 'function' === typeof this.list ? this.list() : this.list;
for ( var i = 0; i < list.length; i++ )
if ( value === list[ i ] )
return true;
throw new Violation( this, value, { choices: list } );
};
return this;
},
Collection: function ( assertOrConstraint ) {
this.__class__ = 'Collection';
this.constraint = 'undefined' !== typeof assertOrConstraint ? (assertOrConstraint instanceof Assert ? assertOrConstraint : new Constraint( assertOrConstraint )) : false;
this.validate = function ( collection, group ) {
var result, validator = new Validator(), count = 0, failures = {}, groups = this.groups.length ? this.groups : group;
if ( !_isArray( collection ) )
throw new Violation( this, collection, { value: Validator.errorCode.must_be_an_array } );
for ( var i = 0; i < collection.length; i++ ) {
result = this.constraint ?
validator.validate( collection[ i ], this.constraint, groups ) :
validator.validate( collection[ i ], groups );
if ( !_isEmptyObject( result ) )
failures[ count ] = result;
count++;
}
return !_isEmptyObject( failures ) ? failures : true;
};
return this;
},
Count: function ( count ) {
this.__class__ = 'Count';
this.count = count;
this.validate = function ( array ) {
if ( !_isArray( array ) )
throw new Violation( this, array, { value: Validator.errorCode.must_be_an_array } );
var count = 'function' === typeof this.count ? this.count( array ) : this.count;
if ( isNaN( Number( count ) ) )
throw new Error( 'Count must be a valid interger', count );
if ( count !== array.length )
throw new Violation( this, array, { count: count } );
return true;
};
return this;
},
Email: function () {
this.__class__ = 'Email';
this.validate = function ( value ) {
var regExp = /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i;
if ( 'string' !== typeof value )
throw new Violation( this, value, { value: Validator.errorCode.must_be_a_string } );
if ( !regExp.test( value ) )
throw new Violation( this, value );
return true;
};
return this;
},
EqualTo: function ( reference ) {
this.__class__ = 'EqualTo';
if ( 'undefined' === typeof reference )
throw new Error( 'EqualTo must be instanciated with a value or a function' );
this.reference = reference;
this.validate = function ( value ) {
var reference = 'function' === typeof this.reference ? this.reference( value ) : this.reference;
if ( reference !== value )
throw new Violation( this, value, { value: reference } );
return true;
};
return this;
},
GreaterThan: function ( threshold ) {
this.__class__ = 'GreaterThan';
if ( 'undefined' === typeof threshold )
throw new Error( 'Should give a threshold value' );
this.threshold = threshold;
this.validate = function ( value ) {
if ( '' === value || isNaN( Number( value ) ) )
throw new Violation( this, value, { value: Validator.errorCode.must_be_a_number } );
if ( this.threshold >= value )
throw new Violation( this, value, { threshold: this.threshold } );
return true;
};
return this;
},
GreaterThanOrEqual: function ( threshold ) {
this.__class__ = 'GreaterThanOrEqual';
if ( 'undefined' === typeof threshold )
throw new Error( 'Should give a threshold value' );
this.threshold = threshold;
this.validate = function ( value ) {
if ( '' === value || isNaN( Number( value ) ) )
throw new Violation( this, value, { value: Validator.errorCode.must_be_a_number } );
if ( this.threshold > value )
throw new Violation( this, value, { threshold: this.threshold } );
return true;
};
return this;
},
InstanceOf: function ( classRef ) {
this.__class__ = 'InstanceOf';
if ( 'undefined' === typeof classRef )
throw new Error( 'InstanceOf must be instanciated with a value' );
this.classRef = classRef;
this.validate = function ( value ) {
if ( true !== (value instanceof this.classRef) )
throw new Violation( this, value, { classRef: this.classRef } );
return true;
};
return this;
},
Length: function ( boundaries ) {
this.__class__ = 'Length';
if ( !boundaries.min && !boundaries.max )
throw new Error( 'Lenth assert must be instanciated with a { min: x, max: y } object' );
this.min = boundaries.min;
this.max = boundaries.max;
this.validate = function ( value ) {
if ( 'string' !== typeof value && !_isArray( value ) )
throw new Violation( this, value, { value: Validator.errorCode.must_be_a_string_or_array } );
if ( 'undefined' !== typeof this.min && this.min === this.max && value.length !== this.min )
throw new Violation( this, value, { min: this.min, max: this.max } );
if ( 'undefined' !== typeof this.max && value.length > this.max )
throw new Violation( this, value, { max: this.max } );
if ( 'undefined' !== typeof this.min && value.length < this.min )
throw new Violation( this, value, { min: this.min } );
return true;
};
return this;
},
LessThan: function ( threshold ) {
this.__class__ = 'LessThan';
if ( 'undefined' === typeof threshold )
throw new Error( 'Should give a threshold value' );
this.threshold = threshold;
this.validate = function ( value ) {
if ( '' === value || isNaN( Number( value ) ) )
throw new Violation( this, value, { value: Validator.errorCode.must_be_a_number } );
if ( this.threshold <= value )
throw new Violation( this, value, { threshold: this.threshold } );
return true;
};
return this;
},
LessThanOrEqual: function ( threshold ) {
this.__class__ = 'LessThanOrEqual';
if ( 'undefined' === typeof threshold )
throw new Error( 'Should give a threshold value' );
this.threshold = threshold;
this.validate = function ( value ) {
if ( '' === value || isNaN( Number( value ) ) )
throw new Violation( this, value, { value: Validator.errorCode.must_be_a_number } );
if ( this.threshold < value )
throw new Violation( this, value, { threshold: this.threshold } );
return true;
};
return this;
},
NotNull: function () {
this.__class__ = 'NotNull';
this.validate = function ( value ) {
if ( null === value || 'undefined' === typeof value )
throw new Violation( this, value );
return true;
};
return this;
},
NotBlank: function () {
this.__class__ = 'NotBlank';
this.validate = function ( value ) {
if ( 'string' !== typeof value )
throw new Violation( this, value, { value: Validator.errorCode.must_be_a_string } );
if ( '' === value.replace( /^\s+/g, '' ).replace( /\s+$/g, '' ) )
throw new Violation( this, value );
return true;
};
return this;
},
Null: function () {
this.__class__ = 'Null';
this.validate = function ( value ) {
if ( null !== value )
throw new Violation( this, value );
return true;
};
return this;
},
Range: function ( min, max ) {
this.__class__ = 'Range';
if ( 'undefined' === typeof min || 'undefined' === typeof max )
throw new Error( 'Range assert expects min and max values' );
this.min = min;
this.max = max;
this.validate = function ( value ) {
try {
// validate strings and objects with their Length
if ( ( 'string' === typeof value && isNaN( Number( value ) ) ) || _isArray( value ) )
new Assert().Length( { min: this.min, max: this.max } ).validate( value );
// validate numbers with their value
else
new Assert().GreaterThanOrEqual( this.min ).validate( value ) && new Assert().LessThanOrEqual( this.max ).validate( value );
return true;
} catch ( violation ) {
throw new Violation( this, value, violation.violation );
}
return true;
};
return this;
},
Regexp: function ( regexp, flag ) {
this.__class__ = 'Regexp';
if ( 'undefined' === typeof regexp )
throw new Error( 'You must give a regexp' );
this.regexp = regexp;
this.flag = flag || '';
this.validate = function ( value ) {
if ( 'string' !== typeof value )
throw new Violation( this, value, { value: Validator.errorCode.must_be_a_string } );
if ( !new RegExp( this.regexp, this.flag ).test( value ) )
throw new Violation( this, value, { regexp: this.regexp, flag: this.flag } );
return true;
};
return this;
},
Required: function () {
this.__class__ = 'Required';
this.validate = function ( value ) {
if ( 'undefined' === typeof value )
throw new Violation( this, value );
try {
if ( 'string' === typeof value )
new Assert().NotNull().validate( value ) && new Assert().NotBlank().validate( value );
else if ( true === _isArray( value ) )
new Assert().Length( { min: 1 } ).validate( value );
} catch ( violation ) {
throw new Violation( this, value );
}
return true;
};
return this;
},
// Unique() or Unique ( { key: foo } )
Unique: function ( object ) {
this.__class__ = 'Unique';
if ( 'object' === typeof object )
this.key = object.key;
this.validate = function ( array ) {
var value, store = [];
if ( !_isArray( array ) )
throw new Violation( this, array, { value: Validator.errorCode.must_be_an_array } );
for ( var i = 0; i < array.length; i++ ) {
value = 'object' === typeof array[ i ] ? array[ i ][ this.key ] : array[ i ];
if ( 'undefined' === typeof value )
continue;
if ( -1 !== store.indexOf( value ) )
throw new Violation( this, array, { value: value } );
store.push( value );
}
return true;
};
return this;
}
};
// expose to the world these awesome classes
exports.Assert = Assert;
exports.Validator = Validator;
exports.Violation = Violation;
exports.Constraint = Constraint;
/**
* Some useful object prototypes / functions here
*/
// IE8<= compatibility
// https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf
if (!Array.prototype.indexOf)
Array.prototype.indexOf = function (searchElement /*, fromIndex */ ) {
"use strict";
if (this === null) {
throw new TypeError();
}
var t = Object(this);
var len = t.length >>> 0;
if (len === 0) {
return -1;
}
var n = 0;
if (arguments.length > 1) {
n = Number(arguments[1]);
if (n != n) { // shortcut for verifying if it's NaN
n = 0;
} else if (n !== 0 && n != Infinity && n != -Infinity) {
n = (n > 0 || -1) * Math.floor(Math.abs(n));
}
}
if (n >= len) {
return -1;
}
var k = n >= 0 ? n : Math.max(len - Math.abs(n), 0);
for (; k < len; k++) {
if (k in t && t[k] === searchElement) {
return k;
}
}
return -1;
};
// Test if object is empty, useful for Constraint violations check
var _isEmptyObject = function ( obj ) {
for ( var property in obj )
return false;
return true;
};
var _isArray = function ( obj ) {
return Object.prototype.toString.call( obj ) === '[object Array]';
};
// AMD export
if ( typeof define === 'function' && define.amd ) {
define( 'vendors/validator.js/dist/validator',[],function() {
return exports;
} );
// commonjs export
} else if ( typeof module !== 'undefined' && module.exports ) {
module.exports = exports;
// browser
} else {
window[ 'undefined' !== typeof validatorjs_ns ? validatorjs_ns : 'Validator' ] = exports;
}
return exports;
} )( );
// This is needed for Browserify usage that requires Validator.js through module.exports
Validator = 'undefined' !== typeof Validator ? Validator : ('undefined' !== typeof module ? module.exports : null);
var ParsleyValidator = function (validators, catalog) {
this.__class__ = 'ParsleyValidator';
this.Validator = Validator;
// Default Parsley locale is en
this.locale = 'en';
this.init(validators || {}, catalog || {});
};
ParsleyValidator.prototype = {
init: function (validators, catalog) {
this.catalog = catalog;
// Copy prototype's validators:
this.validators = $.extend({}, this.validators);
for (var name in validators)
this.addValidator(name, validators[name].fn, validators[name].priority, validators[name].requirementsTransformer);
window.Parsley.trigger('parsley:validator:init');
},
// Set new messages locale if we have dictionary loaded in ParsleyConfig.i18n
setLocale: function (locale) {
if ('undefined' === typeof this.catalog[locale])
throw new Error(locale + ' is not available in the catalog');
this.locale = locale;
return this;
},
// Add a new messages catalog for a given locale. Set locale for this catalog if set === `true`
addCatalog: function (locale, messages, set) {
if ('object' === typeof messages)
this.catalog[locale] = messages;
if (true === set)
return this.setLocale(locale);
return this;
},
// Add a specific message for a given constraint in a given locale
addMessage: function (locale, name, message) {
if ('undefined' === typeof this.catalog[locale])
this.catalog[locale] = {};
this.catalog[locale][name.toLowerCase()] = message;
return this;
},
validate: function (value, constraints, priority) {
return new this.Validator.Validator().validate.apply(new Validator.Validator(), arguments);
},
// Add a new validator
addValidator: function (name, fn, priority, requirementsTransformer) {
if (this.validators[name])
ParsleyUtils.warn('Validator "' + name + '" is already defined.');
else if (ParsleyDefaults.hasOwnProperty(name)) {
ParsleyUtils.warn('"' + name + '" is a restricted keyword and is not a valid validator name.');
return;
};
return this._setValidator(name, fn, priority, requirementsTransformer);
},
updateValidator: function (name, fn, priority, requirementsTransformer) {
if (!this.validators[name]) {
ParsleyUtils.warn('Validator "' + name + '" is not already defined.');
return this.addValidator(name, fn, priority, requirementsTransformer);
}
return this._setValidator(name, fn, priority, requirementsTransformer);
},
removeValidator: function (name) {
if (!this.validators[name])
ParsleyUtils.warn('Validator "' + name + '" is not defined.');
delete this.validators[name];
return this;
},
_setValidator: function (name, fn, priority, requirementsTransformer) {
this.validators[name] = function (requirements) {
return $.extend(new Validator.Assert().Callback(fn, requirements), {
priority: priority,
requirementsTransformer: requirementsTransformer
});
};
return this;
},
getErrorMessage: function (constraint) {
var message;
// Type constraints are a bit different, we have to match their requirements too to find right error message
if ('type' === constraint.name) {
var typeMessages = this.catalog[this.locale][constraint.name] || {};
message = typeMessages[constraint.requirements];
} else
message = this.formatMessage(this.catalog[this.locale][constraint.name], constraint.requirements);
return message || this.catalog[this.locale].defaultMessage || this.catalog.en.defaultMessage;
},
// Kind of light `sprintf()` implementation
formatMessage: function (string, parameters) {
if ('object' === typeof parameters) {
for (var i in parameters)
string = this.formatMessage(string, parameters[i]);
return string;
}
return 'string' === typeof string ? string.replace(new RegExp('%s', 'i'), parameters) : '';
},
// Here is the Parsley default validators list.
// This is basically Validatorjs validators, with different API for some of them
// and a Parsley priority set
validators: {
notblank: function () {
return $.extend(new Validator.Assert().NotBlank(), { priority: 2 });
},
required: function () {
return $.extend(new Validator.Assert().Required(), { priority: 512 });
},
type: function (type) {
var assert;
switch (type) {
case 'email':
assert = new Validator.Assert().Email();
break;
// range type just ensure we have a number here
case 'range':
case 'number':
assert = new Validator.Assert().Regexp('^-?(?:\\d+|\\d{1,3}(?:,\\d{3})+)?(?:\\.\\d+)?$');
break;
case 'integer':
assert = new Validator.Assert().Regexp('^-?\\d+$');
break;
case 'digits':
assert = new Validator.Assert().Regexp('^\\d+$');
break;
case 'alphanum':
assert = new Validator.Assert().Regexp('^\\w+$', 'i');
break;
case 'url':
// Thanks to https://gist.github.com/dperini/729294
// Voted best validator in https://mathiasbynens.be/demo/url-regex
// Modified to make scheme optional and allow local IPs
assert = new Validator.Assert().Regexp(
"^" +
// protocol identifier
"(?:(?:https?|ftp)://)?" + // ** mod: make scheme optional
// user:pass authentication
"(?:\\S+(?::\\S*)?@)?" +
"(?:" +
// IP address exclusion
// private & local networks
// "(?!(?:10|127)(?:\\.\\d{1,3}){3})" + // ** mod: allow local networks
// "(?!(?:169\\.254|192\\.168)(?:\\.\\d{1,3}){2})" + // ** mod: allow local networks
// "(?!172\\.(?:1[6-9]|2\\d|3[0-1])(?:\\.\\d{1,3}){2})" + // ** mod: allow local networks
// IP address dotted notation octets
// excludes loopback network 0.0.0.0
// excludes reserved space >= 224.0.0.0
// excludes network & broacast addresses
// (first & last IP address of each class)
"(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])" +
"(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}" +
"(?:\\.(?:[1-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))" +
"|" +
// host name
"(?:(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)" +
// domain name
"(?:\\.(?:[a-z\\u00a1-\\uffff0-9]-*)*[a-z\\u00a1-\\uffff0-9]+)*" +
// TLD identifier
"(?:\\.(?:[a-z\\u00a1-\\uffff]{2,}))" +
")" +
// port number
"(?::\\d{2,5})?" +
// resource path
"(?:/\\S*)?" +
"$", 'i');
break;
default:
throw new Error('validator type `' + type + '` is not supported');
}
return $.extend(assert, { priority: 256 });
},
pattern: function (regexp) {
var flags = '';
// Test if RegExp is literal, if not, nothing to be done, otherwise, we need to isolate flags and pattern
if (!!(/^\/.*\/(?:[gimy]*)$/.test(regexp))) {
// Replace the regexp literal string with the first match group: ([gimy]*)
// If no flag is present, this will be a blank string
flags = regexp.replace(/.*\/([gimy]*)$/, '$1');
// Again, replace the regexp literal string with the first match group:
// everything excluding the opening and closing slashes and the flags
regexp = regexp.replace(new RegExp('^/(.*?)/' + flags + '$'), '$1');
}
return $.extend(new Validator.Assert().Regexp(regexp, flags), { priority: 64 });
},
minlength: function (value) {
return $.extend(new Validator.Assert().Length({ min: value }), {
priority: 30,
requirementsTransformer: function () {
return 'string' === typeof value && !isNaN(value) ? parseInt(value, 10) : value;
}
});
},
maxlength: function (value) {
return $.extend(new Validator.Assert().Length({ max: value }), {
priority: 30,
requirementsTransformer: function () {
return 'string' === typeof value && !isNaN(value) ? parseInt(value, 10) : value;
}
});
},
length: function (array) {
return $.extend(new Validator.Assert().Length({ min: array[0], max: array[1] }), { priority: 32 });
},
mincheck: function (length) {
return this.minlength(length);
},
maxcheck: function (length) {
return this.maxlength(length);
},
check: function (array) {
return this.length(array);
},
min: function (value) {
return $.extend(new Validator.Assert().GreaterThanOrEqual(value), {
priority: 30,
requirementsTransformer: function () {
return 'string' === typeof value && !isNaN(value) ? parseInt(value, 10) : value;
}
});
},
max: function (value) {
return $.extend(new Validator.Assert().LessThanOrEqual(value), {
priority: 30,
requirementsTransformer: function () {
return 'string' === typeof value && !isNaN(value) ? parseInt(value, 10) : value;
}
});
},
range: function (array) {
return $.extend(new Validator.Assert().Range(array[0], array[1]), {
priority: 32,
requirementsTransformer: function () {
for (var i = 0; i < array.length; i++)
array[i] = 'string' === typeof array[i] && !isNaN(array[i]) ? parseInt(array[i], 10) : array[i];
return array;
}
});
},
equalto: function (value) {
return $.extend(new Validator.Assert().EqualTo(value), {
priority: 256,
requirementsTransformer: function () {
return $(value).length ? $(value).val() : value;
}
});
}
}
};
var ParsleyUI = function (options) {
this.__class__ = 'ParsleyUI';
};
ParsleyUI.prototype = {
listen: function () {
var that = this;
window.Parsley
.on('form:init', function () { that.setupForm (this); } )
.on('field:init', function () { that.setupField(this); } )
.on('field:validated', function () { that.reflow (this); } )
.on('form:validated', function () { that.focus (this); } )
.on('field:reset', function () { that.reset (this); } )
.on('form:destroy', function () { that.destroy (this); } )
.on('field:destroy', function () { that.destroy (this); } );
return this;
},
reflow: function (fieldInstance) {
// If this field has not an active UI (case for multiples) don't bother doing something
if ('undefined' === typeof fieldInstance._ui || false === fieldInstance._ui.active)
return;
// Diff between two validation results
var diff = this._diff(fieldInstance.validationResult, fieldInstance._ui.lastValidationResult);
// Then store current validation result for next reflow
fieldInstance._ui.lastValidationResult = fieldInstance.validationResult;
// Field have been validated at least once if here. Useful for binded key events...
fieldInstance._ui.validatedOnce = true;
// Handle valid / invalid / none field class
this.manageStatusClass(fieldInstance);
// Add, remove, updated errors messages
this.manageErrorsMessages(fieldInstance, diff);
// Triggers impl
this.actualizeTriggers(fieldInstance);
// If field is not valid for the first time, bind keyup trigger to ease UX and quickly inform user
if ((diff.kept.length || diff.added.length) && true !== fieldInstance._ui.failedOnce)
this.manageFailingFieldTrigger(fieldInstance);
},
// Returns an array of field's error message(s)
getErrorsMessages: function (fieldInstance) {
// No error message, field is valid
if (true === fieldInstance.validationResult)
return [];
var messages = [];
for (var i = 0; i < fieldInstance.validationResult.length; i++)
messages.push(this._getErrorMessage(fieldInstance, fieldInstance.validationResult[i].assert));
return messages;
},
manageStatusClass: function (fieldInstance) {
if (fieldInstance.hasConstraints() && fieldInstance.needsValidation() && true === fieldInstance.validationResult)
this._successClass(fieldInstance);
else if (fieldInstance.validationResult.length > 0)
this._errorClass(fieldInstance);
else
this._resetClass(fieldInstance);
},
manageErrorsMessages: function (fieldInstance, diff) {
if ('undefined' !== typeof fieldInstance.options.errorsMessagesDisabled)
return;
// Case where we have errorMessage option that configure an unique field error message, regardless failing validators
if ('undefined' !== typeof fieldInstance.options.errorMessage) {
if ((diff.added.length || diff.kept.length)) {
this._insertErrorWrapper(fieldInstance);
if (0 === fieldInstance._ui.$errorsWrapper.find('.parsley-custom-error-message').length)
fieldInstance._ui.$errorsWrapper
.append(
$(fieldInstance.options.errorTemplate)
.addClass('parsley-custom-error-message')
);
return fieldInstance._ui.$errorsWrapper
.addClass('filled')
.find('.parsley-custom-error-message')
.html(fieldInstance.options.errorMessage);
}
return fieldInstance._ui.$errorsWrapper
.removeClass('filled')
.find('.parsley-custom-error-message')
.remove();
}
// Show, hide, update failing constraints messages
for (var i = 0; i < diff.removed.length; i++)
this.removeError(fieldInstance, diff.removed[i].assert.name, true);
for (i = 0; i < diff.added.length; i++)
this.addError(fieldInstance, diff.added[i].assert.name, undefined, diff.added[i].assert, true);
for (i = 0; i < diff.kept.length; i++)
this.updateError(fieldInstance, diff.kept[i].assert.name, undefined, diff.kept[i].assert, true);
},
// TODO: strange API here, intuitive for manual usage with addError(pslyInstance, 'foo', 'bar')
// but a little bit complex for above internal usage, with forced undefined parameter...
addError: function (fieldInstance, name, message, assert, doNotUpdateClass) {
this._insertErrorWrapper(fieldInstance);
fieldInstance._ui.$errorsWrapper
.addClass('filled')
.append(
$(fieldInstance.options.errorTemplate)
.addClass('parsley-' + name)
.html(message || this._getErrorMessage(fieldInstance, assert))
);
if (true !== doNotUpdateClass)
this._errorClass(fieldInstance);
},
// Same as above
updateError: function (fieldInstance, name, message, assert, doNotUpdateClass) {
fieldInstance._ui.$errorsWrapper
.addClass('filled')
.find('.parsley-' + name)
.html(message || this._getErrorMessage(fieldInstance, assert));
if (true !== doNotUpdateClass)
this._errorClass(fieldInstance);
},
// Same as above twice
removeError: function (fieldInstance, name, doNotUpdateClass) {
fieldInstance._ui.$errorsWrapper
.removeClass('filled')
.find('.parsley-' + name)
.remove();
// edge case possible here: remove a standard Parsley error that is still failing in fieldInstance.validationResult
// but highly improbable cuz' manually removing a well Parsley handled error makes no sense.
if (true !== doNotUpdateClass)
this.manageStatusClass(fieldInstance);
},
focus: function (formInstance) {
formInstance._focusedField = null;
if (true === formInstance.validationResult || 'none' === formInstance.options.focus)
return null;
for (var i = 0; i < formInstance.fields.length; i++) {
var field = formInstance.fields[i];
if (true !== field.validationResult && field.validationResult.length > 0 && 'undefined' === typeof field.options.noFocus) {
formInstance._focusedField = field.$element;
if ('first' === formInstance.options.focus)
break;
}
}
if (null === formInstance._focusedField)
return null;
return formInstance._focusedField.focus();
},
_getErrorMessage: function (fieldInstance, constraint) {
var customConstraintErrorMessage = constraint.name + 'Message';
if ('undefined' !== typeof fieldInstance.options[customConstraintErrorMessage])
return window.ParsleyValidator.formatMessage(fieldInstance.options[customConstraintErrorMessage], constraint.requirements);
return window.ParsleyValidator.getErrorMessage(constraint);
},
_diff: function (newResult, oldResult, deep) {
var
added = [],
kept = [];
for (var i = 0; i < newResult.length; i++) {
var found = false;
for (var j = 0; j < oldResult.length; j++)
if (newResult[i].assert.name === oldResult[j].assert.name) {
found = true;
break;
}
if (found)
kept.push(newResult[i]);
else
added.push(newResult[i]);
}
return {
kept: kept,
added: added,
removed: !deep ? this._diff(oldResult, newResult, true).added : []
};
},
setupForm: function (formInstance) {
formInstance.$element.on('submit.Parsley', false, $.proxy(formInstance.onSubmitValidate, formInstance));
// UI could be disabled
if (false === formInstance.options.uiEnabled)
return;
formInstance.$element.attr('novalidate', '');
},
setupField: function (fieldInstance) {
var _ui = { active: false };
// UI could be disabled
if (false === fieldInstance.options.uiEnabled)
return;
_ui.active = true;
// Give field its Parsley id in DOM
fieldInstance.$element.attr(fieldInstance.options.namespace + 'id', fieldInstance.__id__);
/** Generate important UI elements and store them in fieldInstance **/
// $errorClassHandler is the $element that woul have parsley-error and parsley-success classes
_ui.$errorClassHandler = this._manageClassHandler(fieldInstance);
// $errorsWrapper is a div that would contain the various field errors, it will be appended into $errorsContainer
_ui.errorsWrapperId = 'parsley-id-' + (fieldInstance.options.multiple ? 'multiple-' + fieldInstance.options.multiple : fieldInstance.__id__);
_ui.$errorsWrapper = $(fieldInstance.options.errorsWrapper).attr('id', _ui.errorsWrapperId);
// ValidationResult UI storage to detect what have changed bwt two validations, and update DOM accordingly
_ui.lastValidationResult = [];
_ui.validatedOnce = false;
_ui.validationInformationVisible = false;
// Store it in fieldInstance for later
fieldInstance._ui = _ui;
// Bind triggers first time
this.actualizeTriggers(fieldInstance);
},
// Determine which element will have `parsley-error` and `parsley-success` classes
_manageClassHandler: function (fieldInstance) {
// An element selector could be passed through DOM with `data-parsley-class-handler=#foo`
if ('string' === typeof fieldInstance.options.classHandler && $(fieldInstance.options.classHandler).length)
return $(fieldInstance.options.classHandler);
// Class handled could also be determined by function given in Parsley options
var $handler = fieldInstance.options.classHandler(fieldInstance);
// If this function returned a valid existing DOM element, go for it
if ('undefined' !== typeof $handler && $handler.length)
return $handler;
// Otherwise, if simple element (input, texatrea, select...) it will perfectly host the classes
if (!fieldInstance.options.multiple || fieldInstance.$element.is('select'))
return fieldInstance.$element;
// But if multiple element (radio, checkbox), that would be their parent
return fieldInstance.$element.parent();
},
_insertErrorWrapper: function (fieldInstance) {
var $errorsContainer;
// Nothing to do if already inserted
if (0 !== fieldInstance._ui.$errorsWrapper.parent().length)
return fieldInstance._ui.$errorsWrapper.parent();
if ('string' === typeof fieldInstance.options.errorsContainer) {
if ($(fieldInstance.options.errorsContainer).length)
return $(fieldInstance.options.errorsContainer).append(fieldInstance._ui.$errorsWrapper);
else
ParsleyUtils.warn('The errors container `' + fieldInstance.options.errorsContainer + '` does not exist in DOM');
}
else if ('function' === typeof fieldInstance.options.errorsContainer)
$errorsContainer = fieldInstance.options.errorsContainer(fieldInstance);
if ('undefined' !== typeof $errorsContainer && $errorsContainer.length)
return $errorsContainer.append(fieldInstance._ui.$errorsWrapper);
var $from = fieldInstance.$element;
if (fieldInstance.options.multiple)
$from = $from.parent();
return $from.after(fieldInstance._ui.$errorsWrapper);
},
actualizeTriggers: function (fieldInstance) {
var $toBind = fieldInstance.$element;
if (fieldInstance.options.multiple)
$toBind = $('[' + fieldInstance.options.namespace + 'multiple="' + fieldInstance.options.multiple + '"]');
// Remove Parsley events already binded on this field
$toBind.off('.Parsley');
// If no trigger is set, all good
if (false === fieldInstance.options.trigger)
return;
var triggers = fieldInstance.options.trigger.replace(/^\s+/g , '').replace(/\s+$/g , '');
if ('' === triggers)
return;
// Bind fieldInstance.eventValidate if exists (for parsley.ajax for example), ParsleyUI.eventValidate otherwise
$toBind.on(
triggers.split(' ').join('.Parsley ') + '.Parsley',
$.proxy('function' === typeof fieldInstance.eventValidate ? fieldInstance.eventValidate : this.eventValidate, fieldInstance));
},
// Called through $.proxy with fieldInstance. `this` context is ParsleyField
eventValidate: function (event) {
// For keyup, keypress, keydown... events that could be a little bit obstrusive
// do not validate if val length < min threshold on first validation. Once field have been validated once and info
// about success or failure have been displayed, always validate with this trigger to reflect every yalidation change.
if (new RegExp('key').test(event.type))
if (!this._ui.validationInformationVisible && this.getValue().length <= this.options.validationThreshold)
return;
this._ui.validatedOnce = true;
this.validate();
},
manageFailingFieldTrigger: function (fieldInstance) {
fieldInstance._ui.failedOnce = true;
// Radio and checkboxes fields must bind every field multiple
if (fieldInstance.options.multiple)
$('[' + fieldInstance.options.namespace + 'multiple="' + fieldInstance.options.multiple + '"]').each(function () {
if (!new RegExp('change', 'i').test($(this).parsley().options.trigger || ''))
return $(this).on('change.ParsleyFailedOnce', false, $.proxy(fieldInstance.validate, fieldInstance));
});
// Select case
if (fieldInstance.$element.is('select'))
if (!new RegExp('change', 'i').test(fieldInstance.options.trigger || ''))
return fieldInstance.$element.on('change.ParsleyFailedOnce', false, $.proxy(fieldInstance.validate, fieldInstance));
// All other inputs fields
if (!new RegExp('keyup', 'i').test(fieldInstance.options.trigger || ''))
return fieldInstance.$element.on('keyup.ParsleyFailedOnce', false, $.proxy(fieldInstance.validate, fieldInstance));
},
reset: function (parsleyInstance) {
// Reset all event listeners
this.actualizeTriggers(parsleyInstance);
parsleyInstance.$element.off('.ParsleyFailedOnce');
// Nothing to do if UI never initialized for this field
if ('undefined' === typeof parsleyInstance._ui)
return;
if ('ParsleyForm' === parsleyInstance.__class__)
return;
// Reset all errors' li
parsleyInstance._ui.$errorsWrapper
.removeClass('filled')
.children()
.remove();
// Reset validation class
this._resetClass(parsleyInstance);
// Reset validation flags and last validation result
parsleyInstance._ui.validatedOnce = false;
parsleyInstance._ui.lastValidationResult = [];
parsleyInstance._ui.validationInformationVisible = false;
parsleyInstance._ui.failedOnce = false;
},
destroy: function (parsleyInstance) {
this.reset(parsleyInstance);
if ('ParsleyForm' === parsleyInstance.__class__)
return;
if ('undefined' !== typeof parsleyInstance._ui)
parsleyInstance._ui.$errorsWrapper.remove();
delete parsleyInstance._ui;
},
_successClass: function (fieldInstance) {
fieldInstance._ui.validationInformationVisible = true;
fieldInstance._ui.$errorClassHandler.removeClass(fieldInstance.options.errorClass).addClass(fieldInstance.options.successClass);
},
_errorClass: function (fieldInstance) {
fieldInstance._ui.validationInformationVisible = true;
fieldInstance._ui.$errorClassHandler.removeClass(fieldInstance.options.successClass).addClass(fieldInstance.options.errorClass);
},
_resetClass: function (fieldInstance) {
fieldInstance._ui.$errorClassHandler.removeClass(fieldInstance.options.successClass).removeClass(fieldInstance.options.errorClass);
}
};
var ParsleyForm = function (element, domOptions, options) {
this.__class__ = 'ParsleyForm';
this.__id__ = ParsleyUtils.generateID();
this.$element = $(element);
this.domOptions = domOptions;
this.options = options;
this.parent = window.Parsley;
this.fields = [];
this.validationResult = null;
};
ParsleyForm.prototype = {
onSubmitValidate: function (event) {
this.validate(undefined, undefined, event);
// prevent form submission if validation fails
if ((false === this.validationResult || !this._trigger('submit')) && event instanceof $.Event) {
event.stopImmediatePropagation();
event.preventDefault();
}
return this;
},
// @returns boolean
validate: function (group, force, event) {
this.submitEvent = event;
this.validationResult = true;
var fieldValidationResult = [];
// fire validate event to eventually modify things before very validation
this._trigger('validate');
// Refresh form DOM options and form's fields that could have changed
this._refreshFields();
this._withoutReactualizingFormOptions(function(){
// loop through fields to validate them one by one
for (var i = 0; i < this.fields.length; i++) {
// do not validate a field if not the same as given validation group
if (group && !this._isFieldInGroup(this.fields[i], group))
continue;
fieldValidationResult = this.fields[i].validate(force);
if (true !== fieldValidationResult && fieldValidationResult.length > 0 && this.validationResult)
this.validationResult = false;
}
});
this._trigger(this.validationResult ? 'success' : 'error');
this._trigger('validated');
return this.validationResult;
},
// Iterate over refreshed fields, and stop on first failure
isValid: function (group, force) {
this._refreshFields();
return this._withoutReactualizingFormOptions(function(){
for (var i = 0; i < this.fields.length; i++) {
// do not validate a field if not the same as given validation group
if (group && !this._isFieldInGroup(this.fields[i], group))
continue;
if (false === this.fields[i].isValid(force))
return false;
}
return true;
});
},
_isFieldInGroup: function (field, group) {
if($.isArray(field.options.group))
return -1 !== $.inArray(group, field.options.group);
return field.options.group === group;
},
_refreshFields: function () {
return this.actualizeOptions()._bindFields();
},
_bindFields: function () {
var self = this,
oldFields = this.fields;
this.fields = [];
this.fieldsMappedById = {};
this._withoutReactualizingFormOptions(function(){
this.$element
.find(this.options.inputs)
.not(this.options.excluded)
.each(function () {
var fieldInstance = new Parsley.Factory(this, {}, self);
// Only add valid and not excluded `ParsleyField` and `ParsleyFieldMultiple` children
if (('ParsleyField' === fieldInstance.__class__ || 'ParsleyFieldMultiple' === fieldInstance.__class__) && (true !== fieldInstance.options.excluded))
if ('undefined' === typeof self.fieldsMappedById[fieldInstance.__class__ + '-' + fieldInstance.__id__]) {
self.fieldsMappedById[fieldInstance.__class__ + '-' + fieldInstance.__id__] = fieldInstance;
self.fields.push(fieldInstance);
}
});
$(oldFields).not(self.fields).each(function () {
this._trigger('reset');
});
});
return this;
},
// Internal only.
// Looping on a form's fields to do validation or similar
// will trigger reactualizing options on all of them, which
// in turn will reactualize the form's options.
// To avoid calling actualizeOptions so many times on the form
// for nothing, _withoutReactualizingFormOptions temporarily disables
// the method actualizeOptions on this form while `fn` is called.
_withoutReactualizingFormOptions: function (fn) {
var oldActualizeOptions = this.actualizeOptions;
this.actualizeOptions = function() { return this };
var result = fn.call(this); // Keep the current `this`.
this.actualizeOptions = oldActualizeOptions;
return result;
},
// Internal only.
// Shortcut to trigger an event
// Returns true iff event is not interrupted and default not prevented.
_trigger: function (eventName) {
eventName = 'form:' + eventName;
return this.trigger.apply(this, arguments);
}
};
var ConstraintFactory = function (parsleyField, name, requirements, priority, isDomConstraint) {
var assert = {};
if (!new RegExp('ParsleyField').test(parsleyField.__class__))
throw new Error('ParsleyField or ParsleyFieldMultiple instance expected');
if ('function' === typeof window.ParsleyValidator.validators[name])
assert = window.ParsleyValidator.validators[name](requirements);
if ('Assert' !== assert.__parentClass__)
throw new Error('Valid validator expected');
var getPriority = function () {
if ('undefined' !== typeof parsleyField.options[name + 'Priority'])
return parsleyField.options[name + 'Priority'];
return assert.priority || 2;
};
priority = priority || getPriority();
// If validator have a requirementsTransformer, execute it
if ('function' === typeof assert.requirementsTransformer) {
requirements = assert.requirementsTransformer();
// rebuild assert with new requirements
assert = window.ParsleyValidator.validators[name](requirements);
}
return $.extend(assert, {
name: name,
requirements: requirements,
priority: priority,
groups: [priority],
isDomConstraint: isDomConstraint || ParsleyUtils.checkAttr(parsleyField.$element, parsleyField.options.namespace, name)
});
};
var ParsleyField = function (field, domOptions, options, parsleyFormInstance) {
this.__class__ = 'ParsleyField';
this.__id__ = ParsleyUtils.generateID();
this.$element = $(field);
// Set parent if we have one
if ('undefined' !== typeof parsleyFormInstance) {
this.parent = parsleyFormInstance;
}
this.options = options;
this.domOptions = domOptions;
// Initialize some properties
this.constraints = [];
this.constraintsByName = {};
this.validationResult = [];
// Bind constraints
this._bindConstraints();
};
ParsleyField.prototype = {
// # Public API
// Validate field and trigger some events for mainly `ParsleyUI`
// @returns validationResult:
// - `true` if field valid
// - `[Violation, [Violation...]]` if there were validation errors
validate: function (force) {
this.value = this.getValue();
// Field Validate event. `this.value` could be altered for custom needs
this._trigger('validate');
this._trigger(this.isValid(force, this.value) ? 'success' : 'error');
// Field validated event. `this.validationResult` could be altered for custom needs too
this._trigger('validated');
return this.validationResult;
},
hasConstraints: function () {
return 0 !== this.constraints.length;
},
// An empty optional field does not need validation
needsValidation: function (value) {
if ('undefined' === typeof value)
value = this.getValue();
// If a field is empty and not required, it is valid
// Except if `data-parsley-validate-if-empty` explicitely added, useful for some custom validators
if (!value.length && !this._isRequired() && 'undefined' === typeof this.options.validateIfEmpty)
return false;
return true;
},
// Just validate field. Do not trigger any event
// - `false` if there are constraints and at least one of them failed
// - `true` in all other cases
isValid: function (force, value) {
// Recompute options and rebind constraints to have latest changes
this.refreshConstraints();
this.validationResult = true;
// A field without constraint is valid
if (!this.hasConstraints())
return true;
// Value could be passed as argument, needed to add more power to 'parsley:field:validate'
if ('undefined' === typeof value || null === value)
value = this.getValue();
if (!this.needsValidation(value) && true !== force)
return true;
// If we want to validate field against all constraints, just call Validator and let it do the job
var priorities = ['Any'];
if (false !== this.options.priorityEnabled) {
// Sort priorities to validate more important first
priorities = this._getConstraintsSortedPriorities();
}
// Iterate over priorities one by one, and validate related asserts one by one
for (var i = 0; i < priorities.length; i++)
if (true !== (this.validationResult = this.validateThroughValidator(value, this.constraints, priorities[i])))
return false;
return true;
},
// @returns Parsley field computed value that could be overrided or configured in DOM
getValue: function () {
var value;
// Value could be overriden in DOM or with explicit options
if ('function' === typeof this.options.value)
value = this.options.value(this);
else if ('undefined' !== typeof this.options.value)
value = this.options.value;
else
value = this.$element.val();
// Handle wrong DOM or configurations
if ('undefined' === typeof value || null === value)
return '';
return this._handleWhitespace(value);
},
// Actualize options that could have change since previous validation
// Re-bind accordingly constraints (could be some new, removed or updated)
refreshConstraints: function () {
return this.actualizeOptions()._bindConstraints();
},
/**
* Add a new constraint to a field
*
* @method addConstraint
* @param {String} name
* @param {Mixed} requirements optional
* @param {Number} priority optional
* @param {Boolean} isDomConstraint optional
*/
addConstraint: function (name, requirements, priority, isDomConstraint) {
if ('function' === typeof window.ParsleyValidator.validators[name]) {
var constraint = new ConstraintFactory(this, name, requirements, priority, isDomConstraint);
// if constraint already exist, delete it and push new version
if ('undefined' !== this.constraintsByName[constraint.name])
this.removeConstraint(constraint.name);
this.constraints.push(constraint);
this.constraintsByName[constraint.name] = constraint;
}
return this;
},
// Remove a constraint
removeConstraint: function (name) {
for (var i = 0; i < this.constraints.length; i++)
if (name === this.constraints[i].name) {
this.constraints.splice(i, 1);
break;
}
delete this.constraintsByName[name];
return this;
},
// Update a constraint (Remove + re-add)
updateConstraint: function (name, parameters, priority) {
return this.removeConstraint(name)
.addConstraint(name, parameters, priority);
},
// # Internals
// Internal only.
// Bind constraints from config + options + DOM
_bindConstraints: function () {
var constraints = [], constraintsByName = {};
// clean all existing DOM constraints to only keep javascript user constraints
for (var i = 0; i < this.constraints.length; i++)
if (false === this.constraints[i].isDomConstraint) {
constraints.push(this.constraints[i]);
constraintsByName[this.constraints[i].name] = this.constraints[i];
}
this.constraints = constraints;
this.constraintsByName = constraintsByName;
// then re-add Parsley DOM-API constraints
for (var name in this.options)
this.addConstraint(name, this.options[name]);
// finally, bind special HTML5 constraints
return this._bindHtml5Constraints();
},
// Internal only.
// Bind specific HTML5 constraints to be HTML5 compliant
_bindHtml5Constraints: function () {
// html5 required
if (this.$element.hasClass('required') || this.$element.attr('required'))
this.addConstraint('required', true, undefined, true);
// html5 pattern
if ('string' === typeof this.$element.attr('pattern'))
this.addConstraint('pattern', this.$element.attr('pattern'), undefined, true);
// range
if ('undefined' !== typeof this.$element.attr('min') && 'undefined' !== typeof this.$element.attr('max'))
this.addConstraint('range', [this.$element.attr('min'), this.$element.attr('max')], undefined, true);
// HTML5 min
else if ('undefined' !== typeof this.$element.attr('min'))
this.addConstraint('min', this.$element.attr('min'), undefined, true);
// HTML5 max
else if ('undefined' !== typeof this.$element.attr('max'))
this.addConstraint('max', this.$element.attr('max'), undefined, true);
// length
if ('undefined' !== typeof this.$element.attr('minlength') && 'undefined' !== typeof this.$element.attr('maxlength'))
this.addConstraint('length', [this.$element.attr('minlength'), this.$element.attr('maxlength')], undefined, true);
// HTML5 minlength
else if ('undefined' !== typeof this.$element.attr('minlength'))
this.addConstraint('minlength', this.$element.attr('minlength'), undefined, true);
// HTML5 maxlength
else if ('undefined' !== typeof this.$element.attr('maxlength'))
this.addConstraint('maxlength', this.$element.attr('maxlength'), undefined, true);
// html5 types
var type = this.$element.attr('type');
if ('undefined' === typeof type)
return this;
// Small special case here for HTML5 number: integer validator if step attribute is undefined or an integer value, number otherwise
if ('number' === type) {
if (('undefined' === typeof this.$element.attr('step')) || (0 === parseFloat(this.$element.attr('step')) % 1)) {
return this.addConstraint('type', 'integer', undefined, true);
} else {
return this.addConstraint('type', 'number', undefined, true);
}
// Regular other HTML5 supported types
} else if (/^(email|url|range)$/i.test(type)) {
return this.addConstraint('type', type, undefined, true);
}
return this;
},
// Internal only.
// Field is required if have required constraint without `false` value
_isRequired: function () {
if ('undefined' === typeof this.constraintsByName.required)
return false;
return false !== this.constraintsByName.required.requirements;
},
// Internal only.
// Shortcut to trigger an event
_trigger: function (eventName) {
eventName = 'field:' + eventName;
return this.trigger.apply(this, arguments);
},
// Internal only
// Handles whitespace in a value
// Use `data-parsley-whitespace="squish"` to auto squish input value
// Use `data-parsley-whitespace="trim"` to auto trim input value
_handleWhitespace: function (value) {
if (true === this.options.trimValue)
ParsleyUtils.warnOnce('data-parsley-trim-value="true" is deprecated, please use data-parsley-whitespace="trim"');
if ('squish' === this.options.whitespace)
value = value.replace(/\s{2,}/g, ' ');
if (('trim' === this.options.whitespace) || ('squish' === this.options.whitespace) || (true === this.options.trimValue))
value = value.replace(/^\s+|\s+$/g, '');
return value;
},
// Internal only.
// Sort constraints by priority DESC
_getConstraintsSortedPriorities: function () {
var priorities = [];
// Create array unique of priorities
for (var i = 0; i < this.constraints.length; i++)
if (-1 === priorities.indexOf(this.constraints[i].priority))
priorities.push(this.constraints[i].priority);
// Sort them by priority DESC
priorities.sort(function (a, b) { return b - a; });
return priorities;
}
};
var ParsleyMultiple = function () {
this.__class__ = 'ParsleyFieldMultiple';
};
ParsleyMultiple.prototype = {
// Add new `$element` sibling for multiple field
addElement: function ($element) {
this.$elements.push($element);
return this;
},
// See `ParsleyField.refreshConstraints()`
refreshConstraints: function () {
var fieldConstraints;
this.constraints = [];
// Select multiple special treatment
if (this.$element.is('select')) {
this.actualizeOptions()._bindConstraints();
return this;
}
// Gather all constraints for each input in the multiple group
for (var i = 0; i < this.$elements.length; i++) {
// Check if element have not been dynamically removed since last binding
if (!$('html').has(this.$elements[i]).length) {
this.$elements.splice(i, 1);
continue;
}
fieldConstraints = this.$elements[i].data('ParsleyFieldMultiple').refreshConstraints().constraints;
for (var j = 0; j < fieldConstraints.length; j++)
this.addConstraint(fieldConstraints[j].name, fieldConstraints[j].requirements, fieldConstraints[j].priority, fieldConstraints[j].isDomConstraint);
}
return this;
},
// See `ParsleyField.getValue()`
getValue: function () {
// Value could be overriden in DOM
if ('undefined' !== typeof this.options.value)
return this.options.value;
// Radio input case
if (this.$element.is('input[type=radio]'))
return this._findRelatedMultiple().filter(':checked').val() || '';
// checkbox input case
if (this.$element.is('input[type=checkbox]')) {
var values = [];
this._findRelatedMultiple().filter(':checked').each(function () {
values.push($(this).val());
});
return values;
}
// Select multiple case
if (this.$element.is('select') && null === this.$element.val())
return [];
// Default case that should never happen
return this.$element.val();
},
_init: function () {
this.$elements = [this.$element];
return this;
}
};
var ParsleyFactory = function (element, options, parsleyFormInstance) {
this.$element = $(element);
// If the element has already been bound, returns its saved Parsley instance
var savedparsleyFormInstance = this.$element.data('Parsley');
if (savedparsleyFormInstance) {
// If the saved instance has been bound without a ParsleyForm parent and there is one given in this call, add it
if ('undefined' !== typeof parsleyFormInstance && savedparsleyFormInstance.parent === window.Parsley) {
savedparsleyFormInstance.parent = parsleyFormInstance;
savedparsleyFormInstance._resetOptions(savedparsleyFormInstance.options);
}
return savedparsleyFormInstance;
}
// Parsley must be instantiated with a DOM element or jQuery $element
if (!this.$element.length)
throw new Error('You must bind Parsley on an existing element.');
if ('undefined' !== typeof parsleyFormInstance && 'ParsleyForm' !== parsleyFormInstance.__class__)
throw new Error('Parent instance must be a ParsleyForm instance');
this.parent = parsleyFormInstance || window.Parsley;
return this.init(options);
};
ParsleyFactory.prototype = {
init: function (options) {
this.__class__ = 'Parsley';
this.__version__ = '2.1.3';
this.__id__ = ParsleyUtils.generateID();
// Pre-compute options
this._resetOptions(options);
// A ParsleyForm instance is obviously a `<form>` element but also every node that is not an input and has the `data-parsley-validate` attribute
if (this.$element.is('form') || (ParsleyUtils.checkAttr(this.$element, this.options.namespace, 'validate') && !this.$element.is(this.options.inputs)))
return this.bind('parsleyForm');
// Every other element is bound as a `ParsleyField` or `ParsleyFieldMultiple`
return this.isMultiple() ? this.handleMultiple() : this.bind('parsleyField');
},
isMultiple: function () {
return (this.$element.is('input[type=radio], input[type=checkbox]')) || (this.$element.is('select') && 'undefined' !== typeof this.$element.attr('multiple'));
},
// Multiples fields are a real nightmare :(
// Maybe some refactoring would be appreciated here...
handleMultiple: function () {
var
that = this,
name,
multiple,
parsleyMultipleInstance;
// Handle multiple name
if (this.options.multiple)
; // We already have our 'multiple' identifier
else if ('undefined' !== typeof this.$element.attr('name') && this.$element.attr('name').length)
this.options.multiple = name = this.$element.attr('name');
else if ('undefined' !== typeof this.$element.attr('id') && this.$element.attr('id').length)
this.options.multiple = this.$element.attr('id');
// Special select multiple input
if (this.$element.is('select') && 'undefined' !== typeof this.$element.attr('multiple')) {
this.options.multiple = this.options.multiple || this.__id__;
return this.bind('parsleyFieldMultiple');
// Else for radio / checkboxes, we need a `name` or `data-parsley-multiple` to properly bind it
} else if (!this.options.multiple) {
ParsleyUtils.warn('To be bound by Parsley, a radio, a checkbox and a multiple select input must have either a name or a multiple option.', this.$element);
return this;
}
// Remove special chars
this.options.multiple = this.options.multiple.replace(/(:|\.|\[|\]|\{|\}|\$)/g, '');
// Add proper `data-parsley-multiple` to siblings if we have a valid multiple name
if ('undefined' !== typeof name) {
$('input[name="' + name + '"]').each(function () {
if ($(this).is('input[type=radio], input[type=checkbox]'))
$(this).attr(that.options.namespace + 'multiple', that.options.multiple);
});
}
// Check here if we don't already have a related multiple instance saved
var $previouslyRelated = this._findRelatedMultiple();
for (var i = 0; i < $previouslyRelated.length; i++) {
parsleyMultipleInstance = $($previouslyRelated.get(i)).data('Parsley');
if ('undefined' !== typeof parsleyMultipleInstance) {
if (!this.$element.data('ParsleyFieldMultiple')) {
parsleyMultipleInstance.addElement(this.$element);
}
break;
}
}
// Create a secret ParsleyField instance for every multiple field. It will be stored in `data('ParsleyFieldMultiple')`
// And will be useful later to access classic `ParsleyField` stuff while being in a `ParsleyFieldMultiple` instance
this.bind('parsleyField', true);
return parsleyMultipleInstance || this.bind('parsleyFieldMultiple');
},
// Return proper `ParsleyForm`, `ParsleyField` or `ParsleyFieldMultiple`
bind: function (type, doNotStore) {
var parsleyInstance;
switch (type) {
case 'parsleyForm':
parsleyInstance = $.extend(
new ParsleyForm(this.$element, this.domOptions, this.options),
window.ParsleyExtend
)._bindFields();
break;
case 'parsleyField':
parsleyInstance = $.extend(
new ParsleyField(this.$element, this.domOptions, this.options, this.parent),
window.ParsleyExtend
);
break;
case 'parsleyFieldMultiple':
parsleyInstance = $.extend(
new ParsleyField(this.$element, this.domOptions, this.options, this.parent),
new ParsleyMultiple(),
window.ParsleyExtend
)._init();
break;
default:
throw new Error(type + 'is not a supported Parsley type');
}
if (this.options.multiple)
ParsleyUtils.setAttr(this.$element, this.options.namespace, 'multiple', this.options.multiple);
if ('undefined' !== typeof doNotStore) {
this.$element.data('ParsleyFieldMultiple', parsleyInstance);
return parsleyInstance;
}
// Store the freshly bound instance in a DOM element for later access using jQuery `data()`
this.$element.data('Parsley', parsleyInstance);
// Tell the world we have a new ParsleyForm or ParsleyField instance!
parsleyInstance._trigger('init');
return parsleyInstance;
}
};
var
o = $({}),
deprecated = function () {
ParsleyUtils.warnOnce("Parsley's pubsub module is deprecated; use the 'on' and 'off' methods on parsley instances or window.Parsley");
};
// Returns an event handler that calls `fn` with the arguments it expects
function adapt(fn, context) {
// Store to allow unbinding
if (!fn.parsleyAdaptedCallback) {
fn.parsleyAdaptedCallback = function () {
var args = Array.prototype.slice.call(arguments, 0);
args.unshift(this);
fn.apply(context || o, args);
};
}
return fn.parsleyAdaptedCallback;
}
var eventPrefix = 'parsley:';
// Converts 'parsley:form:validate' into 'form:validate'
function eventName(name) {
if (name.lastIndexOf(eventPrefix, 0) === 0)
return name.substr(eventPrefix.length);
return name;
}
// $.listen is deprecated. Use Parsley.on instead.
$.listen = function (name, callback) {
var context;
deprecated();
if ('object' === typeof arguments[1] && 'function' === typeof arguments[2]) {
context = arguments[1];
callback = arguments[2];
}
if ('function' !== typeof arguments[1])
throw new Error('Wrong parameters');
window.Parsley.on(eventName(name), adapt(callback, context));
};
$.listenTo = function (instance, name, fn) {
deprecated();
if (!(instance instanceof ParsleyField) && !(instance instanceof ParsleyForm))
throw new Error('Must give Parsley instance');
if ('string' !== typeof name || 'function' !== typeof fn)
throw new Error('Wrong parameters');
instance.on(eventName(name), adapt(fn));
};
$.unsubscribe = function (name, fn) {
deprecated();
if ('string' !== typeof name || 'function' !== typeof fn)
throw new Error('Wrong arguments');
window.Parsley.off(eventName(name), fn.parsleyAdaptedCallback);
};
$.unsubscribeTo = function (instance, name) {
deprecated();
if (!(instance instanceof ParsleyField) && !(instance instanceof ParsleyForm))
throw new Error('Must give Parsley instance');
instance.off(eventName(name));
};
$.unsubscribeAll = function (name) {
deprecated();
window.Parsley.off(eventName(name));
$('form,input,textarea,select').each(function() {
var instance = $(this).data('Parsley');
if (instance) {
instance.off(eventName(name));
}
});
};
// $.emit is deprecated. Use jQuery events instead.
$.emit = function (name, instance) {
deprecated();
var instanceGiven = (instance instanceof ParsleyField) || (instance instanceof ParsleyForm);
var args = Array.prototype.slice.call(arguments, instanceGiven ? 2 : 1);
args.unshift(eventName(name));
if (!instanceGiven) {
instance = window.Parsley;
}
instance.trigger.apply(instance, args);
};
// ParsleyConfig definition if not already set
window.ParsleyConfig = window.ParsleyConfig || {};
window.ParsleyConfig.i18n = window.ParsleyConfig.i18n || {};
// Define then the messages
window.ParsleyConfig.i18n.en = jQuery.extend(window.ParsleyConfig.i18n.en || {}, {
defaultMessage: "This value seems to be invalid.",
type: {
email: "This value should be a valid email.",
url: "This value should be a valid url.",
number: "This value should be a valid number.",
integer: "This value should be a valid integer.",
digits: "This value should be digits.",
alphanum: "This value should be alphanumeric."
},
notblank: "This value should not be blank.",
required: "This value is required.",
pattern: "This value seems to be invalid.",
min: "This value should be greater than or equal to %s.",
max: "This value should be lower than or equal to %s.",
range: "This value should be between %s and %s.",
minlength: "This value is too short. It should have %s characters or more.",
maxlength: "This value is too long. It should have %s characters or fewer.",
length: "This value length is invalid. It should be between %s and %s characters long.",
mincheck: "You must select at least %s choices.",
maxcheck: "You must select %s choices or fewer.",
check: "You must select between %s and %s choices.",
equalto: "This value should be the same."
});
// If file is loaded after Parsley main file, auto-load locale
if ('undefined' !== typeof window.ParsleyValidator)
window.ParsleyValidator.addCatalog('en', window.ParsleyConfig.i18n.en, true);
// Parsley.js 2.1.3
// http://parsleyjs.org
// (c) 2012-2015 Guillaume Potier, Wisembly
// Parsley may be freely distributed under the MIT license.
// Inherit `on`, `off` & `trigger` to Parsley:
var Parsley = $.extend(new ParsleyAbstract(), {
$element: $(document),
actualizeOptions: null,
_resetOptions: null,
Factory: ParsleyFactory,
version: '2.1.3'
});
// Supplement ParsleyField and Form with ParsleyAbstract
// This way, the constructors will have access to those methods
$.extend(ParsleyField.prototype, ParsleyAbstract.prototype);
$.extend(ParsleyForm.prototype, ParsleyAbstract.prototype);
// Inherit actualizeOptions and _resetOptions:
$.extend(ParsleyFactory.prototype, ParsleyAbstract.prototype);
// ### jQuery API
// `$('.elem').parsley(options)` or `$('.elem').psly(options)`
$.fn.parsley = $.fn.psly = function (options) {
if (this.length > 1) {
var instances = [];
this.each(function () {
instances.push($(this).parsley(options));
});
return instances;
}
// Return undefined if applied to non existing DOM element
if (!$(this).length) {
ParsleyUtils.warn('You must bind Parsley on an existing element.');
return;
}
return new ParsleyFactory(this, options);
};
// ### ParsleyField and ParsleyForm extension
// Ensure the extension is now defined if it wasn't previously
if ('undefined' === typeof window.ParsleyExtend)
window.ParsleyExtend = {};
// ### Parsley config
// Inherit from ParsleyDefault, and copy over any existing values
Parsley.options = $.extend(ParsleyUtils.objectCreate(ParsleyDefaults), window.ParsleyConfig);
window.ParsleyConfig = Parsley.options; // Old way of accessing global options
// ### Globals
window.Parsley = window.psly = Parsley;
window.ParsleyUtils = ParsleyUtils;
window.ParsleyValidator = new ParsleyValidator(window.ParsleyConfig.validators, window.ParsleyConfig.i18n);
// ### ParsleyUI
// UI is a separate class that only listens to some events and then modifies the DOM accordingly
// Could be overriden by defining a `window.ParsleyConfig.ParsleyUI` appropriate class (with `listen()` method basically)
window.ParsleyUI = 'function' === typeof window.ParsleyConfig.ParsleyUI ?
new window.ParsleyConfig.ParsleyUI().listen() : new ParsleyUI().listen();
// ### PARSLEY auto-binding
// Prevent it by setting `ParsleyConfig.autoBind` to `false`
if (false !== window.ParsleyConfig.autoBind)
$(function () {
// Works only on `data-parsley-validate`.
if ($('[data-parsley-validate]').length)
$('[data-parsley-validate]').parsley();
});
return window.Parsley;
}));
|
src/stories/index.js
|
zeroasterisk/react-iframe-resizer-super
|
import React from 'react';
import { storiesOf, action } from '@kadira/storybook';
import loremipsum from './loremipsum';
import loremipsumAsReact from './loremipsumAsReact';
import IframeResizer from '../index';
// need to pass in checkOrigin=false for our tests
const iframeResizerOptions = {
// log: true,
// autoResize: true,
checkOrigin: false,
// resizeFrom: 'parent',
// heightCalculationMethod: 'max',
// initCallback: () => { console.log('ready!'); },
// resizedCallback: () => { console.log('resized!'); },
};
storiesOf('IframeResizer', module)
.add('defaults with lorem ipsum REACT as content, set as children', () => (
<div>
<p>Content Before Iframe (style unaffected by iframe)</p>
<IframeResizer iframeResizerOptions={iframeResizerOptions}>
{loremipsumAsReact}
</IframeResizer>
<p>Content After Iframe (style unaffected by iframe)</p>
</div>
))
.add('defaults with lorem ipsum REACT as content, set via prop', () => (
<div>
<p>Content Before Iframe (styleeunaffected by iframe)</p>
<IframeResizer iframeResizerOptions={iframeResizerOptions} content={loremipsumAsReact} />
<p>Content After Iframe (style unaffected by iframe)</p>
</div>
))
.add('defaults with lorem ipsum HTML as content, set as children (RAW HTML)', () => (
<div>
<p>Content Before Iframe (style unaffected by iframe)</p>
<IframeResizer iframeResizerOptions={iframeResizerOptions}>
{loremipsum}
</IframeResizer>
<p>Content After Iframe (style unaffected by iframe)</p>
</div>
))
.add('defaults with lorem ipsum HTML as content, set via prop', () => (
<div>
<p>Content Before Iframe (style unaffected by iframe)</p>
<IframeResizer iframeResizerOptions={iframeResizerOptions} content={loremipsum} />
<p>Content After Iframe (style unaffected by iframe)</p>
</div>
))
.add('defaults with example URL as src (mis-matched domains with content JS work)', () => (
<div>
<p>Content Before Iframe (style unaffected by iframe)</p>
<IframeResizer
iframeResizerOptions={iframeResizerOptions}
iframeResizerUrl={false}
src="http://davidjbradshaw.com/iframe-resizer/example/frame.content.html"
/>
<p>Content After Iframe (style unaffected by iframe)</p>
<p>
This <strong>works</strong> <em>because</em> the content <a
href="http://davidjbradshaw.com/iframe-resizer/example/frame.content.html"
target="_blank"
>URL</a> already has the <a
href="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.8/iframeResizer.contentWindow.min.js"
target="_blank"
>iframeResizer.contentWindow.js</a> loaded
</p>
<p>We are setting <code>iframeResizerUrl=false</code> so it doesn't try to inject again</p>
</div>
))
.add('does NOT work with example.com src (mis-matched domains without content JS fail)', () => (
<div>
<p>Content Before Iframe (style unaffected by iframe)</p>
<IframeResizer
iframeResizerOptions={iframeResizerOptions}
frameBorder={1}
src="http://example.com"
/>
<p>Content After Iframe (style unaffected by iframe)</p>
<p><em>
Resize <strong>did not work</strong>,
because the iframe content did not have the <a
href="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.8/iframeResizer.contentWindow.min.js"
target="_blank"
>iframeResizer.contentWindow.js</a> loaded, and it is in a different domain so we could not inject it.
</em></p>
<p>Your console should show an error like the following:</p>
<pre style={{ color: 'darkred' }}>
Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement':<br/>
Blocked a frame with origin "http://<hostname>" from accessing a cross-origin frame.
</pre>
<p><em>Solutions:</em></p>
<p><em>Option 1: Write an iframe and inject via <code>content</code> prop</em></p>
<p><em>Option 2: Edit the iframe src page, and add the iframe helper script <a
href="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.8/iframeResizer.contentWindow.min.js"
target="_blank"
>iframeResizer.contentWindow.js</a> in a script tag.</em></p>
<p><em>Option 3: Proxy the src to a URL on the same domain as the page hosting the iframe; then we should be able to inject the helper script.</em></p>
</div>
))
.add('custom iframe styles', () => {
const style = {
width: 150,
backgroundColor: '#f2f2f2',
textTransform: 'uppercase',
color: '#FF8833',
marginLeft: 30,
};
return (
<div>
<p>Content Before Iframe (style unaffected by iframe)</p>
<IframeResizer
iframeResizerOptions={iframeResizerOptions}
content={loremipsum}
frameBorder={1}
style={style}
>No Support For Iframes</IframeResizer>
<p>Content After Iframe (style unaffected by iframe)</p>
</div>
);
});
// <IframeResizer
// style={style}
// />
|
node_modules/react-scripts/config/paths.js
|
LuoPengFei/todo-app
|
// @remove-on-eject-begin
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/
// @remove-on-eject-end
'use strict';
var path = require('path');
var fs = require('fs');
var url = require('url');
// Make sure any symlinks in the project folder are resolved:
// https://github.com/facebookincubator/create-react-app/issues/637
var appDirectory = fs.realpathSync(process.cwd());
function resolveApp(relativePath) {
return path.resolve(appDirectory, relativePath);
}
// We support resolving modules according to `NODE_PATH`.
// This lets you use absolute paths in imports inside large monorepos:
// https://github.com/facebookincubator/create-react-app/issues/253.
// It works similar to `NODE_PATH` in Node itself:
// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders
// We will export `nodePaths` as an array of absolute paths.
// It will then be used by Webpack configs.
// Jest doesn’t need this because it already handles `NODE_PATH` out of the box.
// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored.
// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims.
// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421
var nodePaths = (process.env.NODE_PATH || '')
.split(process.platform === 'win32' ? ';' : ':')
.filter(Boolean)
.filter(folder => !path.isAbsolute(folder))
.map(resolveApp);
var envPublicUrl = process.env.PUBLIC_URL;
function ensureSlash(path, needsSlash) {
var hasSlash = path.endsWith('/');
if (hasSlash && !needsSlash) {
return path.substr(path, path.length - 1);
} else if (!hasSlash && needsSlash) {
return path + '/';
} else {
return path;
}
}
function getPublicUrl(appPackageJson) {
return envPublicUrl || require(appPackageJson).homepage;
}
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
// "public path" at which the app is served.
// Webpack needs to know it to put the right <script> hrefs into HTML even in
// single-page apps that may serve index.html for nested URLs like /todos/42.
// We can't use a relative path in HTML because we don't want to load something
// like /todos/42/static/js/bundle.7289d.js. We have to know the root.
function getServedPath(appPackageJson) {
var publicUrl = getPublicUrl(appPackageJson);
var servedUrl = envPublicUrl || (
publicUrl ? url.parse(publicUrl).pathname : '/'
);
return ensureSlash(servedUrl, true);
}
// config after eject: we're in ./config/
module.exports = {
appBuild: resolveApp('build'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveApp('src/index.js'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveApp('src/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
nodePaths: nodePaths,
publicUrl: getPublicUrl(resolveApp('package.json')),
servedPath: getServedPath(resolveApp('package.json'))
};
// @remove-on-eject-begin
function resolveOwn(relativePath) {
return path.resolve(__dirname, '..', relativePath);
}
// config before eject: we're in ./node_modules/react-scripts/config/
module.exports = {
appPath: resolveApp('.'),
appBuild: resolveApp('build'),
appPublic: resolveApp('public'),
appHtml: resolveApp('public/index.html'),
appIndexJs: resolveApp('src/index.js'),
appPackageJson: resolveApp('package.json'),
appSrc: resolveApp('src'),
yarnLockFile: resolveApp('yarn.lock'),
testsSetup: resolveApp('src/setupTests.js'),
appNodeModules: resolveApp('node_modules'),
nodePaths: nodePaths,
publicUrl: getPublicUrl(resolveApp('package.json')),
servedPath: getServedPath(resolveApp('package.json')),
// These properties only exist before ejecting:
ownPath: resolveOwn('.'),
ownNodeModules: resolveOwn('node_modules'), // This is empty on npm 3
};
var ownPackageJson = require('../package.json');
var reactScriptsPath = resolveApp(`node_modules/${ownPackageJson.name}`);
var reactScriptsLinked = fs.existsSync(reactScriptsPath) && fs.lstatSync(reactScriptsPath).isSymbolicLink();
// config before publish: we're in ./packages/react-scripts/config/
if (!reactScriptsLinked && __dirname.indexOf(path.join('packages', 'react-scripts', 'config')) !== -1) {
module.exports = {
appPath: resolveApp('.'),
appBuild: resolveOwn('../../build'),
appPublic: resolveOwn('template/public'),
appHtml: resolveOwn('template/public/index.html'),
appIndexJs: resolveOwn('template/src/index.js'),
appPackageJson: resolveOwn('package.json'),
appSrc: resolveOwn('template/src'),
yarnLockFile: resolveOwn('template/yarn.lock'),
testsSetup: resolveOwn('template/src/setupTests.js'),
appNodeModules: resolveOwn('node_modules'),
nodePaths: nodePaths,
publicUrl: getPublicUrl(resolveOwn('package.json')),
servedPath: getServedPath(resolveOwn('package.json')),
// These properties only exist before ejecting:
ownPath: resolveOwn('.'),
ownNodeModules: resolveOwn('node_modules'),
};
}
// @remove-on-eject-end
|
packages/material-ui-icons/src/FitnessCenter.js
|
dsslimshaddy/material-ui
|
import React from 'react';
import pure from 'recompose/pure';
import SvgIcon from 'material-ui/SvgIcon';
let FitnessCenter = props =>
<SvgIcon {...props}>
<path d="M20.57 14.86L22 13.43 20.57 12 17 15.57 8.43 7 12 3.43 10.57 2 9.14 3.43 7.71 2 5.57 4.14 4.14 2.71 2.71 4.14l1.43 1.43L2 7.71l1.43 1.43L2 10.57 3.43 12 7 8.43 15.57 17 12 20.57 13.43 22l1.43-1.43L16.29 22l2.14-2.14 1.43 1.43 1.43-1.43-1.43-1.43L22 16.29z" />
</SvgIcon>;
FitnessCenter = pure(FitnessCenter);
FitnessCenter.muiName = 'SvgIcon';
export default FitnessCenter;
|
ajax/libs/preact/5.1.0-beta.26/preact.min.js
|
dakshshah96/cdnjs
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.preact=e.preact||{})}(this,function(e){function t(e,t,n){this.nodeName=e,this.attributes=t,this.children=n,this.key=t&&t.key}function n(e,t){if(t)for(var n in t)void 0!==t[n]&&(e[n]=t[n]);return e}function r(e){return n({},e)}function o(e){var t={};return function(n){return t[n]||(t[n]=e(n))}}function i(e,t){for(var n=t.split("."),r=0;r<n.length&&e;r++)e=e[n[r]];return e}function a(e,t){return[].slice.call(e,t)}function c(e){return"function"==typeof e}function s(e){return"string"==typeof e}function u(e){return void 0===e||null===e}function l(e){return e===!1||u(e)}function f(e){var t="";for(var n in e){var r=e[n];u(r)||(t&&(t+=" "),t+=te(n),t+=": ",t+=r,"number"!=typeof r||ee[n]||(t+="px"),t+=";")}return t}function p(e){var t="";for(var n in e)e[n]&&(t&&(t+=" "),t+=n);return t}function d(e,t){return v(ie,e,t)}function v(e,t,n,r,o){if(e[t])return e[t](n,r,o)}function h(e,t){do v(e,t);while(e=e._component)}function m(e,n,r){var o,i,a,u=arguments.length;if(u>2){var v=typeof r;if(3===u&&"object"!==v&&"function"!==v)l(r)||(o=[r+""]);else{o=[];for(var h=2;h<u;h++){var _=arguments[h];if(!l(_)){_.join?i=_:(i=ae)[0]=_;for(var y=0;y<i.length;y++){var b=i[y],x=!(l(b)||c(b)||b instanceof t);x&&!s(b)&&(b+=""),x&&a?o[o.length-1]+=b:l(b)||(o.push(b),a=x)}}}}}else if(n&&n.children)return m(e,n,n.children);n&&(n.children&&delete n.children,c(e)||("className"in n&&(n.class=n.className,delete n.className),a=n.class,a&&!s(a)&&(n.class=p(a)),a=n.style,a&&!s(a)&&(n.style=f(a))));var g=new t(e,n||void 0,o);return d("vnode",g),g}function _(e,t){return m(e.nodeName,n(r(e.attributes),t),arguments.length>2?a(arguments,2):e.children)}function y(e,t,n){var r=t.split("."),o=r[0],a=r.length;return function(t){var l,f,p,d=t&&t.currentTarget||this,v=e.state,h=v;if(s(n)?(f=i(t,n),u(f)&&(d=d._component)&&(f=i(d,n))):f=(d.nodeName+d.type).match(/^input(check|rad)/i)?d.checked:d.value,c(f)&&(f=f.call(d)),a>1){for(p=0;p<a-1;p++)h=h[r[p]]||(h[r[p]]={});h[r[p]]=f,f=v[o]}e.setState((l={},l[o]=f,l))}}function b(e){1===ce.push(e)&&(ie.debounceRendering||oe)(x)}function x(){if(ce.length){var e,t=ce;ce=se,se=t;while(e=t.pop())e._dirty&&$(e)}}function g(e){var t=e&&e.nodeName;return t&&c(t)&&!(t.prototype&&t.prototype.render)}function C(e,t){return e.nodeName(U(e),t||X)||""}function N(e,t){return e[Y]||(e[Y]=t||{})}function k(e){return e instanceof Text?3:e instanceof Element?1:0}function w(e){var t=e.parentNode;t&&t.removeChild(e)}function S(e,t,n,r){if(N(e)[t]=n,"key"!==t&&"children"!==t)if("class"!==t||r)if("style"===t)e.style.cssText=n||"";else if("dangerouslySetInnerHTML"===t)n&&(e.innerHTML=n.__html);else if("type"!==t&&!r&&t in e)P(e,t,u(n)?"":n),l(n)&&e.removeAttribute(t);else if("o"===t[0]&&"n"===t[1]){var o=e._listeners||(e._listeners={});t=ne(t.substring(2)),n?o[t]||e.addEventListener(t,M):o[t]&&e.removeEventListener(t,M),o[t]=n}else{var i=r&&t.match(/^xlink\:?(.+)/);l(n)?i?e.removeAttributeNS("http://www.w3.org/1999/xlink",ne(i[1])):e.removeAttribute(t):"object"==typeof n||c(n)||(i?e.setAttributeNS("http://www.w3.org/1999/xlink",ne(i[1]),n):e.setAttribute(t,n))}else e.className=n||""}function P(e,t,n){try{e[t]=n}catch(e){}}function M(e){return this._listeners[e.type](d("event",e)||e)}function T(e){for(var t={},n=e.attributes.length;n--;)t[e.attributes[n].name]=e.attributes[n].value;return t}function B(e,t){if(s(t))return 3===k(e);var n=t.nodeName,r=typeof n;return"string"===r?R(e,n):"function"===r?e._componentConstructor===n||g(t):void 0}function R(e,t){return(e.normalizedNodeName||ne(e.nodeName))===ne(t)}function U(e){var t=e.nodeName.defaultProps,o=r(t||e.attributes);return t&&n(o,e.attributes),e.children&&(o.children=e.children),o}function W(e){E(e);var t=ne(e.nodeName),n=ue[t];n?n.push(e):ue[t]=[e]}function A(e,t){var n=ne(e),r=ue[n]&&ue[n].pop()||(t?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e));return N(r),r.normalizedNodeName=n,r}function E(e){w(e),3!==k(e)&&(N(e,T(e)),e._component=e._componentConstructor=null)}function D(e,t,n,r,o){var i=t.attributes;while(g(t))t=C(t,n);if(s(t)){if(e){if(3===k(e))return e.nodeValue!==t&&(e.nodeValue=t),e;o||W(e)}return document.createTextNode(t)}var a,u=e,l=t.nodeName;if(c(l))return q(e,t,n,r);if(s(l)||(l+=""),a="svg"===ne(l),a&&(le=!0),e){if(!R(e,l)){u=A(l,le);while(e.firstChild)u.appendChild(e.firstChild);o||I(e)}}else u=A(l,le);return L(u,t.children,n,r),V(u,t.attributes),i&&i.ref&&(u[Y].ref=i.ref)(u),a&&(le=!1),u}function L(e,t,n,r){var o=e.firstChild;t&&1===t.length&&"string"==typeof t[0]&&o instanceof Text&&1===e.childNodes.length?o.nodeValue=t[0]:(t||o)&&z(e,t,n,r)}function j(e){var t=e._component;if(t)return t.__key;var n=e[Y];return n?n.key:void 0}function z(e,t,n,r){var o,i,a=e.childNodes,c=[],s={},l=0,f=0,p=a.length,d=0,v=t&&t.length;if(p)for(var m=0;m<p;m++){var _=a[m],y=j(_);(y||0===y)&&v?(l++,s[y]=_):c[d++]=_}if(v)for(var m=0;m<v;m++){var b=t[m],_=void 0;if(l&&b.attributes){var y=b.key;!u(y)&&y in s&&(_=s[y],s[y]=void 0,l--)}if(!_&&f<d)for(o=f;o<d;o++)if(i=c[o],i&&B(i,b)){_=i,c[o]=void 0,o===d-1&&d--,o===f&&f++;break}_=D(_,b,n,r),i=(r||_.parentNode!==e)&&_._component,i&&h(i,"componentWillMount");var x=a[m];x!==_&&a[m+1]!==_&&(x?e.insertBefore(_,x):e.appendChild(_)),i&&h(i,"componentDidMount")}if(l)for(var m in s)s[m]&&(c[f=d++]=s[m]);f<d&&H(c)}function H(e,t){for(var n=e.length;n--;){var r=e[n];r&&I(r,t)}}function I(e,t){var n=e[Y];n&&v(n,"ref",null);var r=e._component;if(r)J(r,!t);else{if(!t){if(1!==k(e))return void w(e);W(e)}var o=e.childNodes;o&&o.length&&H(o,t)}}function V(e,t){var n=e[Y]||T(e);for(var r in n)t&&r in t||S(e,r,null,le);if(t)for(var o in t)o in n&&t[o]==("value"===o||"selected"===o||"checked"===o?e[o]:n[o])||S(e,o,t[o],le)}function F(e){var t=e.constructor.name,n=fe[t];n?n.push(e):fe[t]=[e]}function G(e,t,n,r){var o=new e(t,n),i=!r&&fe[e.name];if(i)for(var a=i.length;a--;)if(i[a].constructor===e){o.nextBase=i[a].base,i.splice(a,1);break}return o}function O(e){e._dirty||(e._dirty=!0,b(e))}function Z(e,t,n,r,o){var i=e._disableRendering===!0,a=e.base;e._disableRendering=!0,(e.__ref=t.ref)&&delete t.ref,(e.__key=t.key)&&delete t.key,u(a)||v(e,"componentWillReceiveProps",t,r),r&&r!==e.context&&(e.prevContext||(e.prevContext=e.context),e.context=r),e.prevProps||(e.prevProps=e.props),e.props=t,e._disableRendering=i,0!==n&&(1!==n&&ie.syncComponentUpdates===!1&&a?O(e):$(e,1,o)),v(e,"__ref",e)}function $(e,t,o){if(!e._disableRendering){var i,a,s=e.props,u=e.state,l=e.context,f=e.prevProps||s,p=e.prevState||u,d=e.prevContext||l,m=e.base,_=m||e.nextBase,y=_&&_._component,b=e._component;if(m&&(e.props=f,e.state=p,e.context=d,2!==t&&v(e,"shouldComponentUpdate",s,u,l)===!1?i=!0:v(e,"componentWillUpdate",s,u,l),e.props=s,e.state=u,e.context=l),e.prevProps=e.prevState=e.prevContext=e.nextBase=null,e._dirty=!1,!i){a=v(e,"render",s,u,l),e.getChildContext&&(l=n(r(l),e.getChildContext()));while(g(a))a=C(a,l);var x,N,k=a&&a.nodeName;if(c(k)&&k.prototype.render){var w=b,S=U(a);w&&w.constructor===k?Z(w,S,1,l):(x=w,w=G(k,S,l,!1),w._parentComponent=e,e._component=w,m&&h(w,"componentWillMount"),Z(w,S,0,l),$(w,1),m&&h(w,"componentDidMount")),N=w.base}else{var P=_;x=b,x&&(P=e._component=null),(_||1===t)&&(P&&(P._component=null),N=D(P,a||"",l,o||!m,!0))}if(_&&N!==_){var M=_.parentNode;M&&N!==M&&M.replaceChild(N,_),x||y!==e||b||(_._component=null,I(_))}if(x&&J(x,!0),e.base=N,N){var T=e,B=e;while(B=B._parentComponent)T=B;N._component=T,N._componentConstructor=T.constructor}m&&v(e,"componentDidUpdate",f,p,d)}var R,W=e._renderCallbacks;if(W)while(R=W.pop())R.call(e);return a}}function q(e,t,n,r){var o=e&&e._component,i=e,a=o&&e._componentConstructor===t.nodeName,c=a,s=U(t);while(o&&!c&&(o=o._parentComponent))c=o.constructor===t.nodeName;return!c||r&&!o._component?(o&&!a&&(J(o,!0),e=i=null),o=G(t.nodeName,s,n),e&&!o.nextBase&&(o.nextBase=e),Z(o,s,1,n,r),e=o.base,i&&e!==i&&(i._component=null,I(i))):(Z(o,s,3,n,r),e=o.base),e}function J(e,t){v(e,"__ref",null),v(e,"componentWillUnmount");var n=e._component;if(n)J(n,t);else{var r=e.base;r&&(t&&(w(r),F(e)),H(r.childNodes,!0,t))}v(e,"componentDidUnmount")}function K(e,t){this._dirty=!0,this._disableRendering=!1,this.prevState=this.prevProps=this.prevContext=this.base=this.nextBase=this._parentComponent=this._component=this.__ref=this.__key=this._linkedStates=this._renderCallbacks=null,this.context=t||{},this.props=e,this.state=v(this,"getInitialState")||{}}function Q(e,t,n){var r=n&&n._component&&n._componentConstructor===e.nodeName,o=D(n,e,{},!1),i=!r&&o._component;return i&&h(i,"componentWillMount"),o.parentNode!==t&&t.appendChild(o),i&&h(i,"componentDidMount"),o}var X={},Y="undefined"!=typeof Symbol?Symbol.for("preactattr"):"__preactattr_",ee={boxFlex:1,boxFlexGroup:1,columnCount:1,fillOpacity:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,strokeOpacity:1,widows:1,zIndex:1,zoom:1},te=o(function(e){return ne(e.replace(/([A-Z])/g,"-$1"))}),ne=o(function(e){return e.toLowerCase()}),re="undefined"!=typeof Promise&&Promise.resolve(),oe=re?function(e){re.then(e)}:setTimeout,ie={vnode:u},ae=[],ce=[],se=[],ue={},le=!1,fe={};n(K.prototype,{linkState:function(e,t){var n=this._linkedStates||(this._linkedStates={}),r=e+"|"+t;return n[r]||(n[r]=y(this,e,t))},setState:function(e,t){var o=this.state;this.prevState||(this.prevState=r(o)),n(o,c(e)?e(o,this.props):e),t&&(this._renderCallbacks=this._renderCallbacks||[]).push(t),O(this)},forceUpdate:function(){$(this,2)},render:function(){return null}}),e.h=m,e.cloneElement=_,e.Component=K,e.render=Q,e.rerender=x,e.options=ie});
//# sourceMappingURL=preact.min.js.map
|
frontend/src/components/page_header.js
|
b1naryth1ef/rowboat
|
import React, { Component } from 'react';
class PageHeader extends Component {
render() {
return (
<div className="row">
<div className="col-lg-12">
<h1 className="page-header">{this.props.name}</h1>
</div>
</div>
);
}
}
export default PageHeader;
|
Veo/node_modules/react-native/Libraries/Text/Text.js
|
JGMorgan/Veo
|
/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule Text
* @flow
*/
'use strict';
const NativeMethodsMixin = require('NativeMethodsMixin');
const Platform = require('Platform');
const React = require('React');
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
const StyleSheetPropType = require('StyleSheetPropType');
const TextStylePropTypes = require('TextStylePropTypes');
const Touchable = require('Touchable');
const createReactNativeComponentClass = require('createReactNativeComponentClass');
const mergeFast = require('mergeFast');
const stylePropType = StyleSheetPropType(TextStylePropTypes);
const viewConfig = {
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
numberOfLines: true,
ellipsizeMode: true,
allowFontScaling: true,
selectable: true,
adjustsFontSizeToFit: true,
minimumFontScale: true,
}),
uiViewClassName: 'RCTText',
};
/**
* A React component for displaying text.
*
* `Text` supports nesting, styling, and touch handling.
*
* In the following example, the nested title and body text will inherit the `fontFamily` from
*`styles.baseText`, but the title provides its own additional styles. The title and body will
* stack on top of each other on account of the literal newlines:
*
* ```ReactNativeWebPlayer
* import React, { Component } from 'react';
* import { AppRegistry, Text, StyleSheet } from 'react-native';
*
* class TextInANest extends Component {
* constructor(props) {
* super(props);
* this.state = {
* titleText: "Bird's Nest",
* bodyText: 'This is not really a bird nest.'
* };
* }
*
* render() {
* return (
* <Text style={styles.baseText}>
* <Text style={styles.titleText} onPress={this.onPressTitle}>
* {this.state.titleText}{'\n'}{'\n'}
* </Text>
* <Text numberOfLines={5}>
* {this.state.bodyText}
* </Text>
* </Text>
* );
* }
* }
*
* const styles = StyleSheet.create({
* baseText: {
* fontFamily: 'Cochin',
* },
* titleText: {
* fontSize: 20,
* fontWeight: 'bold',
* },
* });
*
* // App registration and rendering
* AppRegistry.registerComponent('TextInANest', () => TextInANest);
* ```
*/
const Text = React.createClass({
propTypes: {
/**
* This can be one of the following values:
*
* - `head` - The line is displayed so that the end fits in the container and the missing text
* at the beginning of the line is indicated by an ellipsis glyph. e.g., "...wxyz"
* - `middle` - The line is displayed so that the beginning and end fit in the container and the
* missing text in the middle is indicated by an ellipsis glyph. "ab...yz"
* - `tail` - The line is displayed so that the beginning fits in the container and the
* missing text at the end of the line is indicated by an ellipsis glyph. e.g., "abcd..."
* - `clip` - Lines are not drawn past the edge of the text container.
*
* The default is `tail`.
*
* `numberOfLines` must be set in conjunction with this prop.
*
* > `clip` is working only for iOS
*/
ellipsizeMode: React.PropTypes.oneOf(['head', 'middle', 'tail', 'clip']),
/**
* Used to truncate the text with an ellipsis after computing the text
* layout, including line wrapping, such that the total number of lines
* does not exceed this number.
*
* This prop is commonly used with `ellipsizeMode`.
*/
numberOfLines: React.PropTypes.number,
/**
* Invoked on mount and layout changes with
*
* `{nativeEvent: {layout: {x, y, width, height}}}`
*/
onLayout: React.PropTypes.func,
/**
* This function is called on press.
*
* e.g., `onPress={() => console.log('1st')}``
*/
onPress: React.PropTypes.func,
/**
* This function is called on long press.
*
* e.g., `onLongPress={this.increaseSize}>``
*/
onLongPress: React.PropTypes.func,
/**
* Lets the user select text, to use the native copy and paste functionality.
*/
selectable: React.PropTypes.bool,
/**
* When `true`, no visual change is made when text is pressed down. By
* default, a gray oval highlights the text on press down.
*
* @platform ios
*/
suppressHighlighting: React.PropTypes.bool,
style: stylePropType,
/**
* Used to locate this view in end-to-end tests.
*/
testID: React.PropTypes.string,
/**
* Specifies whether fonts should scale to respect Text Size accessibility setting on iOS. The
* default is `true`.
*
* @platform ios
*/
allowFontScaling: React.PropTypes.bool,
/**
* When set to `true`, indicates that the view is an accessibility element. The default value
* for a `Text` element is `true`.
*
* See the
* [Accessibility guide](/react-native/docs/accessibility.html#accessible-ios-android)
* for more information.
*/
accessible: React.PropTypes.bool,
/**
* Specifies whether font should be scaled down automatically to fit given style constraints.
* @platform ios
*/
adjustsFontSizeToFit: React.PropTypes.bool,
/**
* Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
* @platform ios
*/
minimumFontScale: React.PropTypes.number,
},
getDefaultProps(): Object {
return {
accessible: true,
allowFontScaling: true,
ellipsizeMode: 'tail',
};
},
getInitialState: function(): Object {
return mergeFast(Touchable.Mixin.touchableGetInitialState(), {
isHighlighted: false,
});
},
mixins: [NativeMethodsMixin],
viewConfig: viewConfig,
getChildContext(): Object {
return {isInAParentText: true};
},
childContextTypes: {
isInAParentText: React.PropTypes.bool
},
contextTypes: {
isInAParentText: React.PropTypes.bool
},
/**
* Only assigned if touch is needed.
*/
_handlers: (null: ?Object),
_hasPressHandler(): boolean {
return !!this.props.onPress || !!this.props.onLongPress;
},
/**
* These are assigned lazily the first time the responder is set to make plain
* text nodes as cheap as possible.
*/
touchableHandleActivePressIn: (null: ?Function),
touchableHandleActivePressOut: (null: ?Function),
touchableHandlePress: (null: ?Function),
touchableHandleLongPress: (null: ?Function),
touchableGetPressRectOffset: (null: ?Function),
render(): React.Element<any> {
let newProps = this.props;
if (this.props.onStartShouldSetResponder || this._hasPressHandler()) {
if (!this._handlers) {
this._handlers = {
onStartShouldSetResponder: (): bool => {
const shouldSetFromProps = this.props.onStartShouldSetResponder &&
this.props.onStartShouldSetResponder();
const setResponder = shouldSetFromProps || this._hasPressHandler();
if (setResponder && !this.touchableHandleActivePressIn) {
// Attach and bind all the other handlers only the first time a touch
// actually happens.
for (const key in Touchable.Mixin) {
if (typeof Touchable.Mixin[key] === 'function') {
(this: any)[key] = Touchable.Mixin[key].bind(this);
}
}
this.touchableHandleActivePressIn = () => {
if (this.props.suppressHighlighting || !this._hasPressHandler()) {
return;
}
this.setState({
isHighlighted: true,
});
};
this.touchableHandleActivePressOut = () => {
if (this.props.suppressHighlighting || !this._hasPressHandler()) {
return;
}
this.setState({
isHighlighted: false,
});
};
this.touchableHandlePress = (e: SyntheticEvent) => {
this.props.onPress && this.props.onPress(e);
};
this.touchableHandleLongPress = (e: SyntheticEvent) => {
this.props.onLongPress && this.props.onLongPress(e);
};
this.touchableGetPressRectOffset = function(): RectOffset {
return PRESS_RECT_OFFSET;
};
}
return setResponder;
},
onResponderGrant: function(e: SyntheticEvent, dispatchID: string) {
this.touchableHandleResponderGrant(e, dispatchID);
this.props.onResponderGrant &&
this.props.onResponderGrant.apply(this, arguments);
}.bind(this),
onResponderMove: function(e: SyntheticEvent) {
this.touchableHandleResponderMove(e);
this.props.onResponderMove &&
this.props.onResponderMove.apply(this, arguments);
}.bind(this),
onResponderRelease: function(e: SyntheticEvent) {
this.touchableHandleResponderRelease(e);
this.props.onResponderRelease &&
this.props.onResponderRelease.apply(this, arguments);
}.bind(this),
onResponderTerminate: function(e: SyntheticEvent) {
this.touchableHandleResponderTerminate(e);
this.props.onResponderTerminate &&
this.props.onResponderTerminate.apply(this, arguments);
}.bind(this),
onResponderTerminationRequest: function(): bool {
// Allow touchable or props.onResponderTerminationRequest to deny
// the request
var allowTermination = this.touchableHandleResponderTerminationRequest();
if (allowTermination && this.props.onResponderTerminationRequest) {
allowTermination = this.props.onResponderTerminationRequest.apply(this, arguments);
}
return allowTermination;
}.bind(this),
};
}
newProps = {
...this.props,
...this._handlers,
isHighlighted: this.state.isHighlighted,
};
}
if (Touchable.TOUCH_TARGET_DEBUG && newProps.onPress) {
newProps = {
...newProps,
style: [this.props.style, {color: 'magenta'}],
};
}
if (this.context.isInAParentText) {
return <RCTVirtualText {...newProps} />;
} else {
return <RCTText {...newProps} />;
}
},
});
type RectOffset = {
top: number,
left: number,
right: number,
bottom: number,
}
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
var RCTText = createReactNativeComponentClass(viewConfig);
var RCTVirtualText = RCTText;
if (Platform.OS === 'android') {
RCTVirtualText = createReactNativeComponentClass({
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
isHighlighted: true,
}),
uiViewClassName: 'RCTVirtualText',
});
}
module.exports = Text;
|
ajax/libs/primereact/7.0.0-rc.2/toolbar/toolbar.js
|
cdnjs/cdnjs
|
this.primereact = this.primereact || {};
this.primereact.toolbar = (function (exports, React, core) {
'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _typeof(obj) {
"@babel/helpers - typeof";
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
_typeof = function _typeof(obj) {
return typeof obj;
};
} else {
_typeof = function _typeof(obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
}
return _typeof(obj);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (_typeof(call) === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
var Toolbar = /*#__PURE__*/function (_Component) {
_inherits(Toolbar, _Component);
var _super = _createSuper(Toolbar);
function Toolbar() {
_classCallCheck(this, Toolbar);
return _super.apply(this, arguments);
}
_createClass(Toolbar, [{
key: "render",
value: function render() {
var toolbarClass = core.classNames('p-toolbar p-component', this.props.className);
var left = core.ObjectUtils.getJSXElement(this.props.left, this.props);
var right = core.ObjectUtils.getJSXElement(this.props.right, this.props);
return /*#__PURE__*/React__default['default'].createElement("div", {
id: this.props.id,
className: toolbarClass,
style: this.props.style,
role: "toolbar"
}, /*#__PURE__*/React__default['default'].createElement("div", {
className: "p-toolbar-group-left"
}, left), /*#__PURE__*/React__default['default'].createElement("div", {
className: "p-toolbar-group-right"
}, right));
}
}]);
return Toolbar;
}(React.Component);
_defineProperty(Toolbar, "defaultProps", {
id: null,
style: null,
className: null,
left: null,
right: null
});
exports.Toolbar = Toolbar;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
}({}, React, primereact.core));
|
ajax/libs/angular-google-maps/1.1.7/angular-google-maps.js
|
jacoborus/cdnjs
|
/*! angular-google-maps 1.1.7 2014-07-09
* AngularJS directives for Google Maps
* git: https://github.com/nlaplante/angular-google-maps.git
*/
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
(function() {
angular.module("google-maps.directives.api.utils", []);
angular.module("google-maps.directives.api.managers", []);
angular.module("google-maps.directives.api.models.child", ["google-maps.directives.api.utils"]);
angular.module("google-maps.directives.api.models.parent", ["google-maps.directives.api.managers", "google-maps.directives.api.models.child"]);
angular.module("google-maps.directives.api", ["google-maps.directives.api.models.parent"]);
angular.module("google-maps", ["google-maps.directives.api"]).factory("debounce", [
"$timeout", function($timeout) {
return function(fn) {
var nthCall;
nthCall = 0;
return function() {
var argz, later, that;
that = this;
argz = arguments;
nthCall++;
later = (function(version) {
return function() {
if (version === nthCall) {
return fn.apply(that, argz);
}
};
})(nthCall);
return $timeout(later, 0, true);
};
};
}
]);
}).call(this);
(function() {
angular.element(document).ready(function() {
if (!(google || (typeof google !== "undefined" && google !== null ? google.maps : void 0) || (google.maps.InfoWindow != null))) {
return;
}
google.maps.InfoWindow.prototype._open = google.maps.InfoWindow.prototype.open;
google.maps.InfoWindow.prototype._close = google.maps.InfoWindow.prototype.close;
google.maps.InfoWindow.prototype._isOpen = false;
google.maps.InfoWindow.prototype.open = function(map, anchor) {
this._isOpen = true;
this._open(map, anchor);
};
google.maps.InfoWindow.prototype.close = function() {
this._isOpen = false;
this._close();
};
google.maps.InfoWindow.prototype.isOpen = function(val) {
if (val == null) {
val = void 0;
}
if (val == null) {
return this._isOpen;
} else {
return this._isOpen = val;
}
};
/*
Do the same for InfoBox
TODO: Clean this up so the logic is defined once, wait until develop becomes master as this will be easier
*/
if (!window.InfoBox) {
return;
}
window.InfoBox.prototype._open = window.InfoBox.prototype.open;
window.InfoBox.prototype._close = window.InfoBox.prototype.close;
window.InfoBox.prototype._isOpen = false;
window.InfoBox.prototype.open = function(map, anchor) {
this._isOpen = true;
this._open(map, anchor);
};
window.InfoBox.prototype.close = function() {
this._isOpen = false;
this._close();
};
return window.InfoBox.prototype.isOpen = function(val) {
if (val == null) {
val = void 0;
}
if (val == null) {
return this._isOpen;
} else {
return this._isOpen = val;
}
};
});
}).call(this);
/*
Author Nick McCready
Intersection of Objects if the arrays have something in common each intersecting object will be returned
in an new array.
*/
(function() {
_.intersectionObjects = function(array1, array2, comparison) {
var res,
_this = this;
if (comparison == null) {
comparison = void 0;
}
res = _.map(array1, function(obj1) {
return _.find(array2, function(obj2) {
if (comparison != null) {
return comparison(obj1, obj2);
} else {
return _.isEqual(obj1, obj2);
}
});
});
return _.filter(res, function(o) {
return o != null;
});
};
_.containsObject = _.includeObject = function(obj, target, comparison) {
var _this = this;
if (comparison == null) {
comparison = void 0;
}
if (obj === null) {
return false;
}
return _.any(obj, function(value) {
if (comparison != null) {
return comparison(value, target);
} else {
return _.isEqual(value, target);
}
});
};
_.differenceObjects = function(array1, array2, comparison) {
if (comparison == null) {
comparison = void 0;
}
return _.filter(array1, function(value) {
return !_.containsObject(array2, value);
});
};
_.withoutObjects = function(array, array2) {
return _.differenceObjects(array, array2);
};
_.indexOfObject = function(array, item, comparison, isSorted) {
var i, length;
if (array == null) {
return -1;
}
i = 0;
length = array.length;
if (isSorted) {
if (typeof isSorted === "number") {
i = (isSorted < 0 ? Math.max(0, length + isSorted) : isSorted);
} else {
i = _.sortedIndex(array, item);
return (array[i] === item ? i : -1);
}
}
while (i < length) {
if (comparison != null) {
if (comparison(array[i], item)) {
return i;
}
} else {
if (_.isEqual(array[i], item)) {
return i;
}
}
i++;
}
return -1;
};
_["extends"] = function(arrayOfObjectsToCombine) {
return _.reduce(arrayOfObjectsToCombine, function(combined, toAdd) {
return _.extend(combined, toAdd);
}, {});
};
}).call(this);
/*
Author: Nicholas McCready & jfriend00
_async handles things asynchronous-like :), to allow the UI to be free'd to do other things
Code taken from http://stackoverflow.com/questions/10344498/best-way-to-iterate-over-an-array-without-blocking-the-ui
The design of any funcitonality of _async is to be like lodash/underscore and replicate it but call things
asynchronously underneath. Each should be sufficient for most things to be derrived from.
TODO: Handle Object iteration like underscore and lodash as well.. not that important right now
*/
(function() {
var async;
async = {
each: function(array, callback, doneCallBack, pausedCallBack, chunk, index, pause) {
var doChunk;
if (chunk == null) {
chunk = 20;
}
if (index == null) {
index = 0;
}
if (pause == null) {
pause = 1;
}
if (!pause) {
throw "pause (delay) must be set from _async!";
return;
}
if (array === void 0 || (array != null ? array.length : void 0) <= 0) {
doneCallBack();
return;
}
doChunk = function() {
var cnt, i;
cnt = chunk;
i = index;
while (cnt-- && i < (array ? array.length : i + 1)) {
callback(array[i], i);
++i;
}
if (array) {
if (i < array.length) {
index = i;
if (pausedCallBack != null) {
pausedCallBack();
}
return setTimeout(doChunk, pause);
} else {
if (doneCallBack) {
return doneCallBack();
}
}
}
};
return doChunk();
},
map: function(objs, iterator, doneCallBack, pausedCallBack, chunk) {
var results;
results = [];
if (objs == null) {
return results;
}
return _async.each(objs, function(o) {
return results.push(iterator(o));
}, function() {
return doneCallBack(results);
}, pausedCallBack, chunk);
}
};
window._async = async;
angular.module("google-maps.directives.api.utils").factory("async", function() {
return window._async;
});
}).call(this);
(function() {
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
angular.module("google-maps.directives.api.utils").factory("BaseObject", function() {
var BaseObject, baseObjectKeywords;
baseObjectKeywords = ['extended', 'included'];
BaseObject = (function() {
function BaseObject() {}
BaseObject.extend = function(obj) {
var key, value, _ref;
for (key in obj) {
value = obj[key];
if (__indexOf.call(baseObjectKeywords, key) < 0) {
this[key] = value;
}
}
if ((_ref = obj.extended) != null) {
_ref.apply(this);
}
return this;
};
BaseObject.include = function(obj) {
var key, value, _ref;
for (key in obj) {
value = obj[key];
if (__indexOf.call(baseObjectKeywords, key) < 0) {
this.prototype[key] = value;
}
}
if ((_ref = obj.included) != null) {
_ref.apply(this);
}
return this;
};
return BaseObject;
})();
return BaseObject;
});
}).call(this);
/*
Useful function callbacks that should be defined at later time.
Mainly to be used for specs to verify creation / linking.
This is to lead a common design in notifying child stuff.
*/
(function() {
angular.module("google-maps.directives.api.utils").factory("ChildEvents", function() {
return {
onChildCreation: function(child) {}
};
});
}).call(this);
(function() {
angular.module("google-maps.directives.api.utils").service("EventsHelper", [
"Logger", function($log) {
return {
setEvents: function(marker, scope, model) {
if (angular.isDefined(scope.events) && (scope.events != null) && angular.isObject(scope.events)) {
return _.compact(_.map(scope.events, function(eventHandler, eventName) {
if (scope.events.hasOwnProperty(eventName) && angular.isFunction(scope.events[eventName])) {
return google.maps.event.addListener(marker, eventName, function() {
return eventHandler.apply(scope, [marker, eventName, model, arguments]);
});
} else {
return $log.info("MarkerEventHelper: invalid event listener " + eventName);
}
}));
}
}
};
}
]);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.utils").factory("FitHelper", [
"BaseObject", "Logger", function(BaseObject, $log) {
var FitHelper, _ref;
return FitHelper = (function(_super) {
__extends(FitHelper, _super);
function FitHelper() {
_ref = FitHelper.__super__.constructor.apply(this, arguments);
return _ref;
}
FitHelper.prototype.fit = function(gMarkers, gMap) {
var bounds, everSet,
_this = this;
if (gMap && gMarkers && gMarkers.length > 0) {
bounds = new google.maps.LatLngBounds();
everSet = false;
return _async.each(gMarkers, function(gMarker) {
if (gMarker) {
if (!everSet) {
everSet = true;
}
return bounds.extend(gMarker.getPosition());
}
}, function() {
if (everSet) {
return gMap.fitBounds(bounds);
}
});
}
};
return FitHelper;
})(BaseObject);
}
]);
}).call(this);
(function() {
angular.module("google-maps.directives.api.utils").service("GmapUtil", [
"Logger", "$compile", function(Logger, $compile) {
var getCoords, validateCoords;
getCoords = function(value) {
if (Array.isArray(value) && value.length === 2) {
return new google.maps.LatLng(value[1], value[0]);
} else if (angular.isDefined(value.type) && value.type === "Point") {
return new google.maps.LatLng(value.coordinates[1], value.coordinates[0]);
} else {
return new google.maps.LatLng(value.latitude, value.longitude);
}
};
validateCoords = function(coords) {
if (angular.isUndefined(coords)) {
return false;
}
if (_.isArray(coords)) {
if (coords.length === 2) {
return true;
}
} else if ((coords != null) && (coords != null ? coords.type : void 0)) {
if (coords.type === "Point" && _.isArray(coords.coordinates) && coords.coordinates.length === 2) {
return true;
}
}
if (coords && angular.isDefined((coords != null ? coords.latitude : void 0) && angular.isDefined(coords != null ? coords.longitude : void 0))) {
return true;
}
return false;
};
return {
getLabelPositionPoint: function(anchor) {
var xPos, yPos;
if (anchor === void 0) {
return void 0;
}
anchor = /^([-\d\.]+)\s([-\d\.]+)$/.exec(anchor);
xPos = parseFloat(anchor[1]);
yPos = parseFloat(anchor[2]);
if ((xPos != null) && (yPos != null)) {
return new google.maps.Point(xPos, yPos);
}
},
createMarkerOptions: function(coords, icon, defaults, map) {
var opts;
if (map == null) {
map = void 0;
}
if (defaults == null) {
defaults = {};
}
opts = angular.extend({}, defaults, {
position: defaults.position != null ? defaults.position : getCoords(coords),
icon: defaults.icon != null ? defaults.icon : icon,
visible: defaults.visible != null ? defaults.visible : validateCoords(coords)
});
if (map != null) {
opts.map = map;
}
return opts;
},
createWindowOptions: function(gMarker, scope, content, defaults) {
if ((content != null) && (defaults != null) && ($compile != null)) {
return angular.extend({}, defaults, {
content: this.buildContent(scope, defaults, content),
position: defaults.position != null ? defaults.position : angular.isObject(gMarker) ? gMarker.getPosition() : getCoords(scope.coords)
});
} else {
if (!defaults) {
Logger.error("infoWindow defaults not defined");
if (!content) {
return Logger.error("infoWindow content not defined");
}
} else {
return defaults;
}
}
},
buildContent: function(scope, defaults, content) {
var parsed, ret;
if (defaults.content != null) {
ret = defaults.content;
} else {
if ($compile != null) {
parsed = $compile(content)(scope);
if (parsed.length > 0) {
ret = parsed[0];
}
} else {
ret = content;
}
}
return ret;
},
defaultDelay: 50,
isTrue: function(val) {
return angular.isDefined(val) && val !== null && val === true || val === "1" || val === "y" || val === "true";
},
isFalse: function(value) {
return ['false', 'FALSE', 0, 'n', 'N', 'no', 'NO'].indexOf(value) !== -1;
},
getCoords: getCoords,
validateCoords: validateCoords,
validatePath: function(path) {
var array, i, polygon, trackMaxVertices;
i = 0;
if (angular.isUndefined(path.type)) {
if (!Array.isArray(path) || path.length < 2) {
return false;
}
while (i < path.length) {
if (!((angular.isDefined(path[i].latitude) && angular.isDefined(path[i].longitude)) || (typeof path[i].lat === "function" && typeof path[i].lng === "function"))) {
return false;
}
i++;
}
return true;
} else {
if (angular.isUndefined(path.coordinates)) {
return false;
}
if (path.type === "Polygon") {
if (path.coordinates[0].length < 4) {
return false;
}
array = path.coordinates[0];
} else if (path.type === "MultiPolygon") {
trackMaxVertices = {
max: 0,
index: 0
};
_.forEach(path.coordinates, function(polygon, index) {
if (polygon[0].length > this.max) {
this.max = polygon[0].length;
return this.index = index;
}
}, trackMaxVertices);
polygon = path.coordinates[trackMaxVertices.index];
array = polygon[0];
if (array.length < 4) {
return false;
}
} else if (path.type === "LineString") {
if (path.coordinates.length < 2) {
return false;
}
array = path.coordinates;
} else {
return false;
}
while (i < array.length) {
if (array[i].length !== 2) {
return false;
}
i++;
}
return true;
}
},
convertPathPoints: function(path) {
var array, i, latlng, result, trackMaxVertices;
i = 0;
result = new google.maps.MVCArray();
if (angular.isUndefined(path.type)) {
while (i < path.length) {
latlng;
if (angular.isDefined(path[i].latitude) && angular.isDefined(path[i].longitude)) {
latlng = new google.maps.LatLng(path[i].latitude, path[i].longitude);
} else if (typeof path[i].lat === "function" && typeof path[i].lng === "function") {
latlng = path[i];
}
result.push(latlng);
i++;
}
} else {
array;
if (path.type === "Polygon") {
array = path.coordinates[0];
} else if (path.type === "MultiPolygon") {
trackMaxVertices = {
max: 0,
index: 0
};
_.forEach(path.coordinates, function(polygon, index) {
if (polygon[0].length > this.max) {
this.max = polygon[0].length;
return this.index = index;
}
}, trackMaxVertices);
array = path.coordinates[trackMaxVertices.index][0];
} else if (path.type === "LineString") {
array = path.coordinates;
}
while (i < array.length) {
result.push(new google.maps.LatLng(array[i][1], array[i][0]));
i++;
}
}
return result;
},
extendMapBounds: function(map, points) {
var bounds, i;
bounds = new google.maps.LatLngBounds();
i = 0;
while (i < points.length) {
bounds.extend(points.getAt(i));
i++;
}
return map.fitBounds(bounds);
}
};
}
]);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.utils").factory("Linked", [
"BaseObject", function(BaseObject) {
var Linked;
Linked = (function(_super) {
__extends(Linked, _super);
function Linked(scope, element, attrs, ctrls) {
this.scope = scope;
this.element = element;
this.attrs = attrs;
this.ctrls = ctrls;
}
return Linked;
})(BaseObject);
return Linked;
}
]);
}).call(this);
(function() {
angular.module("google-maps.directives.api.utils").service("Logger", [
"$log", function($log) {
return {
logger: $log,
doLog: false,
info: function(msg) {
if (this.doLog) {
if (this.logger != null) {
return this.logger.info(msg);
} else {
return console.info(msg);
}
}
},
error: function(msg) {
if (this.doLog) {
if (this.logger != null) {
return this.logger.error(msg);
} else {
return console.error(msg);
}
}
},
warn: function(msg) {
if (this.doLog) {
if (this.logger != null) {
return this.logger.warn(msg);
} else {
return console.warn(msg);
}
}
}
};
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.utils").factory("ModelKey", [
"BaseObject", function(BaseObject) {
var ModelKey;
return ModelKey = (function(_super) {
__extends(ModelKey, _super);
function ModelKey(scope) {
this.scope = scope;
this.setIdKey = __bind(this.setIdKey, this);
this.modelKeyComparison = __bind(this.modelKeyComparison, this);
ModelKey.__super__.constructor.call(this);
this.defaultIdKey = "id";
this.idKey = void 0;
}
ModelKey.prototype.evalModelHandle = function(model, modelKey) {
if (model === void 0) {
return void 0;
}
if (modelKey === 'self') {
return model;
} else {
return model[modelKey];
}
};
ModelKey.prototype.modelKeyComparison = function(model1, model2) {
var scope;
scope = this.scope.coords != null ? this.scope : this.parentScope;
if (scope == null) {
throw "No scope or parentScope set!";
}
return this.evalModelHandle(model1, scope.coords).latitude === this.evalModelHandle(model2, scope.coords).latitude && this.evalModelHandle(model1, scope.coords).longitude === this.evalModelHandle(model2, scope.coords).longitude;
};
ModelKey.prototype.setIdKey = function(scope) {
return this.idKey = scope.idKey != null ? scope.idKey : this.defaultIdKey;
};
return ModelKey;
})(BaseObject);
}
]);
}).call(this);
(function() {
angular.module("google-maps.directives.api.utils").factory("ModelsWatcher", [
"Logger", function(Logger) {
return {
figureOutState: function(idKey, scope, childObjects, comparison, callBack) {
var adds, mappedScopeModelIds, removals,
_this = this;
adds = [];
mappedScopeModelIds = {};
removals = [];
return _async.each(scope.models, function(m) {
var child;
if (m[idKey] != null) {
mappedScopeModelIds[m[idKey]] = {};
if (childObjects[m[idKey]] == null) {
return adds.push(m);
} else {
child = childObjects[m[idKey]];
if (!comparison(m, child.model)) {
adds.push(m);
return removals.push(child);
}
}
} else {
return Logger.error("id missing for model " + (m.toString()) + ", can not use do comparison/insertion");
}
}, function() {
return _async.each(childObjects.values(), function(c) {
var id;
if (c == null) {
Logger.error("child undefined in ModelsWatcher.");
return;
}
if (c.model == null) {
Logger.error("child.model undefined in ModelsWatcher.");
return;
}
id = c.model[idKey];
if (mappedScopeModelIds[id] == null) {
return removals.push(c.model[idKey]);
}
}, function() {
return callBack({
adds: adds,
removals: removals
});
});
});
}
};
}
]);
}).call(this);
/*
Simple Object Map with a lenght property to make it easy to track length/size
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
angular.module("google-maps.directives.api.utils").factory("PropMap", function() {
var PropMap, propsToPop;
propsToPop = ['get', 'put', 'remove', 'values', 'keys', 'length'];
PropMap = (function() {
function PropMap() {
this.keys = __bind(this.keys, this);
this.values = __bind(this.values, this);
this.remove = __bind(this.remove, this);
this.put = __bind(this.put, this);
this.get = __bind(this.get, this);
this.length = 0;
}
PropMap.prototype.get = function(key) {
return this[key];
};
PropMap.prototype.put = function(key, value) {
if (this[key] == null) {
this.length++;
}
return this[key] = value;
};
PropMap.prototype.remove = function(key) {
delete this[key];
return this.length--;
};
PropMap.prototype.values = function() {
var all, keys,
_this = this;
all = [];
keys = _.keys(this);
_.each(keys, function(value) {
if (_.indexOf(propsToPop, value) === -1) {
return all.push(_this[value]);
}
});
return all;
};
PropMap.prototype.keys = function() {
var all, keys,
_this = this;
keys = _.keys(this);
all = [];
_.each(keys, function(prop) {
if (_.indexOf(propsToPop, prop) === -1) {
return all.push(prop);
}
});
return all;
};
return PropMap;
})();
return PropMap;
});
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.managers").factory("ClustererMarkerManager", [
"Logger", "FitHelper", function($log, FitHelper) {
var ClustererMarkerManager;
ClustererMarkerManager = (function(_super) {
__extends(ClustererMarkerManager, _super);
function ClustererMarkerManager(gMap, opt_markers, opt_options, opt_events) {
var self;
this.opt_events = opt_events;
this.fit = __bind(this.fit, this);
this.destroy = __bind(this.destroy, this);
this.clear = __bind(this.clear, this);
this.draw = __bind(this.draw, this);
this.removeMany = __bind(this.removeMany, this);
this.remove = __bind(this.remove, this);
this.addMany = __bind(this.addMany, this);
this.add = __bind(this.add, this);
ClustererMarkerManager.__super__.constructor.call(this);
self = this;
this.opt_options = opt_options;
if ((opt_options != null) && opt_markers === void 0) {
this.clusterer = new MarkerClusterer(gMap, void 0, opt_options);
} else if ((opt_options != null) && (opt_markers != null)) {
this.clusterer = new MarkerClusterer(gMap, opt_markers, opt_options);
} else {
this.clusterer = new MarkerClusterer(gMap);
}
this.attachEvents(this.opt_events, "opt_events");
this.clusterer.setIgnoreHidden(true);
this.noDrawOnSingleAddRemoves = true;
$log.info(this);
}
ClustererMarkerManager.prototype.add = function(gMarker) {
return this.clusterer.addMarker(gMarker, this.noDrawOnSingleAddRemoves);
};
ClustererMarkerManager.prototype.addMany = function(gMarkers) {
return this.clusterer.addMarkers(gMarkers);
};
ClustererMarkerManager.prototype.remove = function(gMarker) {
return this.clusterer.removeMarker(gMarker, this.noDrawOnSingleAddRemoves);
};
ClustererMarkerManager.prototype.removeMany = function(gMarkers) {
return this.clusterer.addMarkers(gMarkers);
};
ClustererMarkerManager.prototype.draw = function() {
return this.clusterer.repaint();
};
ClustererMarkerManager.prototype.clear = function() {
this.clusterer.clearMarkers();
return this.clusterer.repaint();
};
ClustererMarkerManager.prototype.attachEvents = function(options, optionsName) {
var eventHandler, eventName, _results;
if (angular.isDefined(options) && (options != null) && angular.isObject(options)) {
_results = [];
for (eventName in options) {
eventHandler = options[eventName];
if (options.hasOwnProperty(eventName) && angular.isFunction(options[eventName])) {
$log.info("" + optionsName + ": Attaching event: " + eventName + " to clusterer");
_results.push(google.maps.event.addListener(this.clusterer, eventName, options[eventName]));
} else {
_results.push(void 0);
}
}
return _results;
}
};
ClustererMarkerManager.prototype.clearEvents = function(options) {
var eventHandler, eventName, _results;
if (angular.isDefined(options) && (options != null) && angular.isObject(options)) {
_results = [];
for (eventName in options) {
eventHandler = options[eventName];
if (options.hasOwnProperty(eventName) && angular.isFunction(options[eventName])) {
$log.info("" + optionsName + ": Clearing event: " + eventName + " to clusterer");
_results.push(google.maps.event.clearListeners(this.clusterer, eventName));
} else {
_results.push(void 0);
}
}
return _results;
}
};
ClustererMarkerManager.prototype.destroy = function() {
this.clearEvents(this.opt_events);
this.clearEvents(this.opt_internal_events);
return this.clear();
};
ClustererMarkerManager.prototype.fit = function() {
return ClustererMarkerManager.__super__.fit.call(this, this.clusterer.getMarkers(), this.clusterer.getMap());
};
return ClustererMarkerManager;
})(FitHelper);
return ClustererMarkerManager;
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.managers").factory("MarkerManager", [
"Logger", "FitHelper", function(Logger, FitHelper) {
var MarkerManager;
MarkerManager = (function(_super) {
__extends(MarkerManager, _super);
MarkerManager.include(FitHelper);
function MarkerManager(gMap, opt_markers, opt_options) {
this.fit = __bind(this.fit, this);
this.handleOptDraw = __bind(this.handleOptDraw, this);
this.clear = __bind(this.clear, this);
this.draw = __bind(this.draw, this);
this.removeMany = __bind(this.removeMany, this);
this.remove = __bind(this.remove, this);
this.addMany = __bind(this.addMany, this);
this.add = __bind(this.add, this);
var self;
MarkerManager.__super__.constructor.call(this);
self = this;
this.gMap = gMap;
this.gMarkers = [];
this.$log = Logger;
this.$log.info(this);
}
MarkerManager.prototype.add = function(gMarker, optDraw, redraw) {
if (redraw == null) {
redraw = true;
}
this.handleOptDraw(gMarker, optDraw, redraw);
return this.gMarkers.push(gMarker);
};
MarkerManager.prototype.addMany = function(gMarkers) {
var gMarker, _i, _len, _results;
_results = [];
for (_i = 0, _len = gMarkers.length; _i < _len; _i++) {
gMarker = gMarkers[_i];
_results.push(this.add(gMarker));
}
return _results;
};
MarkerManager.prototype.remove = function(gMarker, optDraw) {
var index, tempIndex;
this.handleOptDraw(gMarker, optDraw, false);
if (!optDraw) {
return;
}
index = void 0;
if (this.gMarkers.indexOf != null) {
index = this.gMarkers.indexOf(gMarker);
} else {
tempIndex = 0;
_.find(this.gMarkers, function(marker) {
tempIndex += 1;
if (marker === gMarker) {
index = tempIndex;
}
});
}
if (index != null) {
return this.gMarkers.splice(index, 1);
}
};
MarkerManager.prototype.removeMany = function(gMarkers) {
var _this = this;
return this.gMarkers.forEach(function(marker) {
return _this.remove(marker);
});
};
MarkerManager.prototype.draw = function() {
var deletes,
_this = this;
deletes = [];
this.gMarkers.forEach(function(gMarker) {
if (!gMarker.isDrawn) {
if (gMarker.doAdd) {
gMarker.setMap(_this.gMap);
return gMarker.isDrawn = true;
} else {
return deletes.push(gMarker);
}
}
});
return deletes.forEach(function(gMarker) {
gMarker.isDrawn = false;
return _this.remove(gMarker, true);
});
};
MarkerManager.prototype.clear = function() {
var gMarker, _i, _len, _ref;
_ref = this.gMarkers;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
gMarker = _ref[_i];
gMarker.setMap(null);
}
delete this.gMarkers;
return this.gMarkers = [];
};
MarkerManager.prototype.handleOptDraw = function(gMarker, optDraw, doAdd) {
if (optDraw === true) {
if (doAdd) {
gMarker.setMap(this.gMap);
} else {
gMarker.setMap(null);
}
return gMarker.isDrawn = true;
} else {
gMarker.isDrawn = false;
return gMarker.doAdd = doAdd;
}
};
MarkerManager.prototype.fit = function() {
return MarkerManager.__super__.fit.call(this, this.gMarkers, this.gMap);
};
return MarkerManager;
})(FitHelper);
return MarkerManager;
}
]);
}).call(this);
(function() {
angular.module("google-maps").factory("array-sync", [
"add-events", function(mapEvents) {
return function(mapArray, scope, pathEval, pathChangedFn) {
var geojsonArray, geojsonHandlers, geojsonWatcher, isSetFromScope, legacyHandlers, legacyWatcher, mapArrayListener, scopePath, watchListener;
isSetFromScope = false;
scopePath = scope.$eval(pathEval);
if (!scope["static"]) {
legacyHandlers = {
set_at: function(index) {
var value;
if (isSetFromScope) {
return;
}
value = mapArray.getAt(index);
if (!value) {
return;
}
if (!value.lng || !value.lat) {
return scopePath[index] = value;
} else {
scopePath[index].latitude = value.lat();
return scopePath[index].longitude = value.lng();
}
},
insert_at: function(index) {
var value;
if (isSetFromScope) {
return;
}
value = mapArray.getAt(index);
if (!value) {
return;
}
if (!value.lng || !value.lat) {
return scopePath.splice(index, 0, value);
} else {
return scopePath.splice(index, 0, {
latitude: value.lat(),
longitude: value.lng()
});
}
},
remove_at: function(index) {
if (isSetFromScope) {
return;
}
return scopePath.splice(index, 1);
}
};
geojsonArray;
if (scopePath.type === "Polygon") {
geojsonArray = scopePath.coordinates[0];
} else if (scopePath.type === "LineString") {
geojsonArray = scopePath.coordinates;
}
geojsonHandlers = {
set_at: function(index) {
var value;
if (isSetFromScope) {
return;
}
value = mapArray.getAt(index);
if (!value) {
return;
}
if (!value.lng || !value.lat) {
return;
}
geojsonArray[index][1] = value.lat();
return geojsonArray[index][0] = value.lng();
},
insert_at: function(index) {
var value;
if (isSetFromScope) {
return;
}
value = mapArray.getAt(index);
if (!value) {
return;
}
if (!value.lng || !value.lat) {
return;
}
return geojsonArray.splice(index, 0, [value.lng(), value.lat()]);
},
remove_at: function(index) {
if (isSetFromScope) {
return;
}
return geojsonArray.splice(index, 1);
}
};
mapArrayListener = mapEvents(mapArray, angular.isUndefined(scopePath.type) ? legacyHandlers : geojsonHandlers);
}
legacyWatcher = function(newPath) {
var i, l, newLength, newValue, oldArray, oldLength, oldValue;
isSetFromScope = true;
oldArray = mapArray;
if (newPath) {
i = 0;
oldLength = oldArray.getLength();
newLength = newPath.length;
l = Math.min(oldLength, newLength);
newValue = void 0;
while (i < l) {
oldValue = oldArray.getAt(i);
newValue = newPath[i];
if (typeof newValue.equals === "function") {
if (!newValue.equals(oldValue)) {
oldArray.setAt(i, newValue);
}
} else {
if ((oldValue.lat() !== newValue.latitude) || (oldValue.lng() !== newValue.longitude)) {
oldArray.setAt(i, new google.maps.LatLng(newValue.latitude, newValue.longitude));
}
}
i++;
}
while (i < newLength) {
newValue = newPath[i];
if (typeof newValue.lat === "function" && typeof newValue.lng === "function") {
oldArray.push(newValue);
} else {
oldArray.push(new google.maps.LatLng(newValue.latitude, newValue.longitude));
}
i++;
}
while (i < oldLength) {
oldArray.pop();
i++;
}
}
return isSetFromScope = false;
};
geojsonWatcher = function(newPath) {
var array, i, l, newLength, newValue, oldArray, oldLength, oldValue;
isSetFromScope = true;
oldArray = mapArray;
if (newPath) {
array;
if (scopePath.type === "Polygon") {
array = newPath.coordinates[0];
} else if (scopePath.type === "LineString") {
array = newPath.coordinates;
}
i = 0;
oldLength = oldArray.getLength();
newLength = array.length;
l = Math.min(oldLength, newLength);
newValue = void 0;
while (i < l) {
oldValue = oldArray.getAt(i);
newValue = array[i];
if ((oldValue.lat() !== newValue[1]) || (oldValue.lng() !== newValue[0])) {
oldArray.setAt(i, new google.maps.LatLng(newValue[1], newValue[0]));
}
i++;
}
while (i < newLength) {
newValue = array[i];
oldArray.push(new google.maps.LatLng(newValue[1], newValue[0]));
i++;
}
while (i < oldLength) {
oldArray.pop();
i++;
}
}
return isSetFromScope = false;
};
watchListener;
if (!scope["static"]) {
if (angular.isUndefined(scopePath.type)) {
watchListener = scope.$watchCollection(pathEval, legacyWatcher);
} else {
watchListener = scope.$watch(pathEval, geojsonWatcher, true);
}
}
return function() {
if (mapArrayListener) {
mapArrayListener();
mapArrayListener = null;
}
if (watchListener) {
watchListener();
return watchListener = null;
}
};
};
}
]);
}).call(this);
(function() {
angular.module("google-maps").factory("add-events", [
"$timeout", function($timeout) {
var addEvent, addEvents;
addEvent = function(target, eventName, handler) {
return google.maps.event.addListener(target, eventName, function() {
handler.apply(this, arguments);
return $timeout((function() {}), true);
});
};
addEvents = function(target, eventName, handler) {
var remove;
if (handler) {
return addEvent(target, eventName, handler);
}
remove = [];
angular.forEach(eventName, function(_handler, key) {
return remove.push(addEvent(target, key, _handler));
});
return function() {
angular.forEach(remove, function(listener) {
return google.maps.event.removeListener(listener);
});
return remove = null;
};
};
return addEvents;
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.child").factory("MarkerLabelChildModel", [
"BaseObject", "GmapUtil", function(BaseObject, GmapUtil) {
var MarkerLabelChildModel;
MarkerLabelChildModel = (function(_super) {
__extends(MarkerLabelChildModel, _super);
MarkerLabelChildModel.include(GmapUtil);
function MarkerLabelChildModel(gMarker, opt_options) {
this.destroy = __bind(this.destroy, this);
this.draw = __bind(this.draw, this);
this.setPosition = __bind(this.setPosition, this);
this.setZIndex = __bind(this.setZIndex, this);
this.setVisible = __bind(this.setVisible, this);
this.setAnchor = __bind(this.setAnchor, this);
this.setMandatoryStyles = __bind(this.setMandatoryStyles, this);
this.setStyles = __bind(this.setStyles, this);
this.setContent = __bind(this.setContent, this);
this.setTitle = __bind(this.setTitle, this);
this.getSharedCross = __bind(this.getSharedCross, this);
var self, _ref, _ref1;
MarkerLabelChildModel.__super__.constructor.call(this);
self = this;
this.marker = gMarker;
this.marker.set("labelContent", opt_options.labelContent);
this.marker.set("labelAnchor", this.getLabelPositionPoint(opt_options.labelAnchor));
this.marker.set("labelClass", opt_options.labelClass || 'labels');
this.marker.set("labelStyle", opt_options.labelStyle || {
opacity: 100
});
this.marker.set("labelInBackground", opt_options.labelInBackground || false);
if (!opt_options.labelVisible) {
this.marker.set("labelVisible", true);
}
if (!opt_options.raiseOnDrag) {
this.marker.set("raiseOnDrag", true);
}
if (!opt_options.clickable) {
this.marker.set("clickable", true);
}
if (!opt_options.draggable) {
this.marker.set("draggable", false);
}
if (!opt_options.optimized) {
this.marker.set("optimized", false);
}
opt_options.crossImage = (_ref = opt_options.crossImage) != null ? _ref : document.location.protocol + "//maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png";
opt_options.handCursor = (_ref1 = opt_options.handCursor) != null ? _ref1 : document.location.protocol + "//maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur";
this.markerLabel = new MarkerLabel_(this.marker, opt_options.crossImage, opt_options.handCursor);
this.marker.set("setMap", function(theMap) {
google.maps.Marker.prototype.setMap.apply(this, arguments);
return self.markerLabel.setMap(theMap);
});
this.marker.setMap(this.marker.getMap());
}
MarkerLabelChildModel.prototype.getSharedCross = function(crossUrl) {
return this.markerLabel.getSharedCross(crossUrl);
};
MarkerLabelChildModel.prototype.setTitle = function() {
return this.markerLabel.setTitle();
};
MarkerLabelChildModel.prototype.setContent = function() {
return this.markerLabel.setContent();
};
MarkerLabelChildModel.prototype.setStyles = function() {
return this.markerLabel.setStyles();
};
MarkerLabelChildModel.prototype.setMandatoryStyles = function() {
return this.markerLabel.setMandatoryStyles();
};
MarkerLabelChildModel.prototype.setAnchor = function() {
return this.markerLabel.setAnchor();
};
MarkerLabelChildModel.prototype.setVisible = function() {
return this.markerLabel.setVisible();
};
MarkerLabelChildModel.prototype.setZIndex = function() {
return this.markerLabel.setZIndex();
};
MarkerLabelChildModel.prototype.setPosition = function() {
return this.markerLabel.setPosition();
};
MarkerLabelChildModel.prototype.draw = function() {
return this.markerLabel.draw();
};
MarkerLabelChildModel.prototype.destroy = function() {
if ((this.markerLabel.labelDiv_.parentNode != null) && (this.markerLabel.eventDiv_.parentNode != null)) {
return this.markerLabel.onRemove();
}
};
return MarkerLabelChildModel;
})(BaseObject);
return MarkerLabelChildModel;
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.child").factory("MarkerChildModel", [
"ModelKey", "GmapUtil", "Logger", "$injector", "EventsHelper", function(ModelKey, GmapUtil, Logger, $injector, EventsHelper) {
var MarkerChildModel;
MarkerChildModel = (function(_super) {
__extends(MarkerChildModel, _super);
MarkerChildModel.include(GmapUtil);
MarkerChildModel.include(EventsHelper);
function MarkerChildModel(model, parentScope, gMap, $timeout, defaults, doClick, gMarkerManager, idKey) {
var self,
_this = this;
this.model = model;
this.parentScope = parentScope;
this.gMap = gMap;
this.$timeout = $timeout;
this.defaults = defaults;
this.doClick = doClick;
this.gMarkerManager = gMarkerManager;
this.idKey = idKey;
this.watchDestroy = __bind(this.watchDestroy, this);
this.setLabelOptions = __bind(this.setLabelOptions, this);
this.isLabelDefined = __bind(this.isLabelDefined, this);
this.setOptions = __bind(this.setOptions, this);
this.setIcon = __bind(this.setIcon, this);
this.setCoords = __bind(this.setCoords, this);
this.destroy = __bind(this.destroy, this);
this.maybeSetScopeValue = __bind(this.maybeSetScopeValue, this);
this.createMarker = __bind(this.createMarker, this);
this.setMyScope = __bind(this.setMyScope, this);
self = this;
if (this.model[this.idKey]) {
this.id = this.model[this.idKey];
}
this.iconKey = this.parentScope.icon;
this.coordsKey = this.parentScope.coords;
this.clickKey = this.parentScope.click();
this.labelContentKey = this.parentScope.labelContent;
this.optionsKey = this.parentScope.options;
this.labelOptionsKey = this.parentScope.labelOptions;
MarkerChildModel.__super__.constructor.call(this, this.parentScope.$new(false));
this.scope.model = this.model;
this.setMyScope(this.model, void 0, true);
this.createMarker(this.model);
this.scope.$watch('model', function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.setMyScope(newValue, oldValue);
}
}, true);
this.$log = Logger;
this.$log.info(self);
this.watchDestroy(this.scope);
}
MarkerChildModel.prototype.setMyScope = function(model, oldModel, isInit) {
var _this = this;
if (oldModel == null) {
oldModel = void 0;
}
if (isInit == null) {
isInit = false;
}
this.maybeSetScopeValue('icon', model, oldModel, this.iconKey, this.evalModelHandle, isInit, this.setIcon);
this.maybeSetScopeValue('coords', model, oldModel, this.coordsKey, this.evalModelHandle, isInit, this.setCoords);
this.maybeSetScopeValue('labelContent', model, oldModel, this.labelContentKey, this.evalModelHandle, isInit);
if (_.isFunction(this.clickKey) && $injector) {
return this.scope.click = function() {
return $injector.invoke(_this.clickKey, void 0, {
"$markerModel": model
});
};
} else {
this.maybeSetScopeValue('click', model, oldModel, this.clickKey, this.evalModelHandle, isInit);
return this.createMarker(model, oldModel, isInit);
}
};
MarkerChildModel.prototype.createMarker = function(model, oldModel, isInit) {
var _this = this;
if (oldModel == null) {
oldModel = void 0;
}
if (isInit == null) {
isInit = false;
}
return this.maybeSetScopeValue('options', model, oldModel, this.optionsKey, function(lModel, lModelKey) {
var value;
if (lModel === void 0) {
return void 0;
}
value = lModelKey === 'self' ? lModel : lModel[lModelKey];
if (value === void 0) {
return value = lModelKey === void 0 ? _this.defaults : _this.scope.options;
} else {
return value;
}
}, isInit, this.setOptions);
};
MarkerChildModel.prototype.maybeSetScopeValue = function(scopePropName, model, oldModel, modelKey, evaluate, isInit, gSetter) {
var newValue, oldVal;
if (gSetter == null) {
gSetter = void 0;
}
if (oldModel === void 0) {
this.scope[scopePropName] = evaluate(model, modelKey);
if (!isInit) {
if (gSetter != null) {
gSetter(this.scope);
}
}
return;
}
oldVal = evaluate(oldModel, modelKey);
newValue = evaluate(model, modelKey);
if (newValue !== oldVal && this.scope[scopePropName] !== newValue) {
this.scope[scopePropName] = newValue;
if (!isInit) {
if (gSetter != null) {
gSetter(this.scope);
}
return this.gMarkerManager.draw();
}
}
};
MarkerChildModel.prototype.destroy = function() {
return this.scope.$destroy();
};
MarkerChildModel.prototype.setCoords = function(scope) {
if (scope.$id !== this.scope.$id || this.gMarker === void 0) {
return;
}
if ((scope.coords != null)) {
if (!this.validateCoords(this.scope.coords)) {
this.$log.error("MarkerChildMarker cannot render marker as scope.coords as no position on marker: " + (JSON.stringify(this.model)));
return;
}
this.gMarker.setPosition(this.getCoords(scope.coords));
this.gMarker.setVisible(this.validateCoords(scope.coords));
this.gMarkerManager.remove(this.gMarker);
return this.gMarkerManager.add(this.gMarker);
} else {
return this.gMarkerManager.remove(this.gMarker);
}
};
MarkerChildModel.prototype.setIcon = function(scope) {
if (scope.$id !== this.scope.$id || this.gMarker === void 0) {
return;
}
this.gMarkerManager.remove(this.gMarker);
this.gMarker.setIcon(scope.icon);
this.gMarkerManager.add(this.gMarker);
this.gMarker.setPosition(this.getCoords(scope.coords));
return this.gMarker.setVisible(this.validateCoords(scope.coords));
};
MarkerChildModel.prototype.setOptions = function(scope) {
var _ref,
_this = this;
if (scope.$id !== this.scope.$id) {
return;
}
if (this.gMarker != null) {
this.gMarkerManager.remove(this.gMarker);
delete this.gMarker;
}
if (!((_ref = scope.coords) != null ? _ref : typeof scope.icon === "function" ? scope.icon(scope.options != null) : void 0)) {
return;
}
this.opts = this.createMarkerOptions(scope.coords, scope.icon, scope.options);
delete this.gMarker;
if (this.isLabelDefined(scope)) {
this.gMarker = new MarkerWithLabel(this.setLabelOptions(this.opts, scope));
} else {
this.gMarker = new google.maps.Marker(this.opts);
}
this.setEvents(this.gMarker, this.parentScope, this.model);
if (this.id) {
this.gMarker.key = this.id;
}
this.gMarkerManager.add(this.gMarker);
return google.maps.event.addListener(this.gMarker, 'click', function() {
if (_this.doClick && (_this.scope.click != null)) {
return _this.scope.click();
}
});
};
MarkerChildModel.prototype.isLabelDefined = function(scope) {
return scope.labelContent != null;
};
MarkerChildModel.prototype.setLabelOptions = function(opts, scope) {
opts.labelAnchor = this.getLabelPositionPoint(scope.labelAnchor);
opts.labelClass = scope.labelClass;
opts.labelContent = scope.labelContent;
return opts;
};
MarkerChildModel.prototype.watchDestroy = function(scope) {
var _this = this;
return scope.$on("$destroy", function() {
var self, _ref;
if (_this.gMarker != null) {
google.maps.event.clearListeners(_this.gMarker, 'click');
if (((_ref = _this.parentScope) != null ? _ref.events : void 0) && _.isArray(_this.parentScope.events)) {
_this.parentScope.events.forEach(function(event, eventName) {
return google.maps.event.clearListeners(this.gMarker, eventName);
});
}
_this.gMarkerManager.remove(_this.gMarker, true);
delete _this.gMarker;
}
return self = void 0;
});
};
return MarkerChildModel;
})(ModelKey);
return MarkerChildModel;
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("PolylineChildModel", [
"BaseObject", "Logger", "$timeout", "array-sync", "GmapUtil", function(BaseObject, Logger, $timeout, arraySync, GmapUtil) {
var $log, PolylineChildModel;
$log = Logger;
return PolylineChildModel = (function(_super) {
__extends(PolylineChildModel, _super);
PolylineChildModel.include(GmapUtil);
function PolylineChildModel(scope, attrs, map, defaults, model) {
var arraySyncer, pathPoints,
_this = this;
this.scope = scope;
this.attrs = attrs;
this.map = map;
this.defaults = defaults;
this.model = model;
this.buildOpts = __bind(this.buildOpts, this);
pathPoints = this.convertPathPoints(scope.path);
this.polyline = new google.maps.Polyline(this.buildOpts(pathPoints));
if (scope.fit) {
GmapUtil.extendMapBounds(map, pathPoints);
}
if (!scope["static"] && angular.isDefined(scope.editable)) {
scope.$watch("editable", function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.polyline.setEditable(newValue);
}
});
}
if (angular.isDefined(scope.draggable)) {
scope.$watch("draggable", function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.polyline.setDraggable(newValue);
}
});
}
if (angular.isDefined(scope.visible)) {
scope.$watch("visible", function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.polyline.setVisible(newValue);
}
});
}
if (angular.isDefined(scope.geodesic)) {
scope.$watch("geodesic", function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
}
});
}
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.weight)) {
scope.$watch("stroke.weight", function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
}
});
}
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.color)) {
scope.$watch("stroke.color", function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
}
});
}
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.opacity)) {
scope.$watch("stroke.opacity", function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
}
});
}
if (angular.isDefined(scope.icons)) {
scope.$watch("icons", function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.polyline.setOptions(_this.buildOpts(_this.polyline.getPath()));
}
});
}
arraySyncer = arraySync(this.polyline.getPath(), scope, "path", function(pathPoints) {
if (scope.fit) {
return GmapUtil.extendMapBounds(map, pathPoints);
}
});
scope.$on("$destroy", function() {
_this.polyline.setMap(null);
_this.polyline = null;
_this.scope = null;
if (arraySyncer) {
arraySyncer();
return arraySyncer = null;
}
});
$log.info(this);
}
PolylineChildModel.prototype.buildOpts = function(pathPoints) {
var opts,
_this = this;
opts = angular.extend({}, this.defaults, {
map: this.map,
path: pathPoints,
icons: this.scope.icons,
strokeColor: this.scope.stroke && this.scope.stroke.color,
strokeOpacity: this.scope.stroke && this.scope.stroke.opacity,
strokeWeight: this.scope.stroke && this.scope.stroke.weight
});
angular.forEach({
clickable: true,
draggable: false,
editable: false,
geodesic: false,
visible: true,
"static": false,
fit: false
}, function(defaultValue, key) {
if (angular.isUndefined(_this.scope[key]) || _this.scope[key] === null) {
return opts[key] = defaultValue;
} else {
return opts[key] = _this.scope[key];
}
});
if (opts["static"]) {
opts.editable = false;
}
return opts;
};
PolylineChildModel.prototype.destroy = function() {
return this.scope.$destroy();
};
return PolylineChildModel;
})(BaseObject);
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.child").factory("WindowChildModel", [
"BaseObject", "GmapUtil", "Logger", "$compile", "$http", "$templateCache", function(BaseObject, GmapUtil, Logger, $compile, $http, $templateCache) {
var WindowChildModel;
WindowChildModel = (function(_super) {
__extends(WindowChildModel, _super);
WindowChildModel.include(GmapUtil);
function WindowChildModel(model, scope, opts, isIconVisibleOnClick, mapCtrl, markerCtrl, element, needToManualDestroy, markerIsVisibleAfterWindowClose) {
this.model = model;
this.scope = scope;
this.opts = opts;
this.isIconVisibleOnClick = isIconVisibleOnClick;
this.mapCtrl = mapCtrl;
this.markerCtrl = markerCtrl;
this.element = element;
this.needToManualDestroy = needToManualDestroy != null ? needToManualDestroy : false;
this.markerIsVisibleAfterWindowClose = markerIsVisibleAfterWindowClose != null ? markerIsVisibleAfterWindowClose : true;
this.destroy = __bind(this.destroy, this);
this.remove = __bind(this.remove, this);
this.hideWindow = __bind(this.hideWindow, this);
this.getLatestPosition = __bind(this.getLatestPosition, this);
this.showWindow = __bind(this.showWindow, this);
this.handleClick = __bind(this.handleClick, this);
this.watchCoords = __bind(this.watchCoords, this);
this.watchShow = __bind(this.watchShow, this);
this.createGWin = __bind(this.createGWin, this);
this.watchElement = __bind(this.watchElement, this);
this.googleMapsHandles = [];
this.$log = Logger;
this.createGWin();
if (this.markerCtrl != null) {
this.markerCtrl.setClickable(true);
}
this.handleClick();
this.watchElement();
this.watchShow();
this.watchCoords();
this.$log.info(this);
}
WindowChildModel.prototype.watchElement = function() {
var _this = this;
return this.scope.$watch(function() {
var _ref;
if (!_this.element || !_this.html) {
return;
}
if (_this.html !== _this.element.html()) {
if (_this.gWin) {
if ((_ref = _this.opts) != null) {
_ref.content = void 0;
}
_this.remove();
_this.createGWin();
return _this.showHide();
}
}
});
};
WindowChildModel.prototype.createGWin = function() {
var defaults,
_this = this;
if (this.gWin == null) {
defaults = {};
if (this.opts != null) {
if (this.scope.coords) {
this.opts.position = this.getCoords(this.scope.coords);
}
defaults = this.opts;
}
if (this.element) {
this.html = _.isObject(this.element) ? this.element.html() : this.element;
}
this.opts = this.createWindowOptions(this.markerCtrl, this.scope, this.html, defaults);
}
if ((this.opts != null) && !this.gWin) {
if (this.opts.boxClass && (window.InfoBox && typeof window.InfoBox === 'function')) {
this.gWin = new window.InfoBox(this.opts);
} else {
this.gWin = new google.maps.InfoWindow(this.opts);
}
return this.googleMapsHandles.push(google.maps.event.addListener(this.gWin, 'closeclick', function() {
var _ref;
if ((_ref = _this.markerCtrl) != null) {
_ref.setVisible(_this.markerIsVisibleAfterWindowClose);
}
_this.gWin.isOpen(false);
if (_this.scope.closeClick != null) {
return _this.scope.closeClick();
}
}));
}
};
WindowChildModel.prototype.watchShow = function() {
var _this = this;
return this.scope.$watch('show', function(newValue, oldValue) {
if (newValue !== oldValue) {
if (newValue) {
return _this.showWindow();
} else {
return _this.hideWindow();
}
} else {
if (_this.gWin != null) {
if (newValue && !_this.gWin.getMap()) {
return _this.showWindow();
}
}
}
}, true);
};
WindowChildModel.prototype.watchCoords = function() {
var scope,
_this = this;
scope = this.markerCtrl != null ? this.scope.$parent : this.scope;
return scope.$watch('coords', function(newValue, oldValue) {
var pos;
if (newValue !== oldValue) {
if (newValue == null) {
return _this.hideWindow();
} else {
if (!_this.validateCoords(newValue)) {
_this.$log.error("WindowChildMarker cannot render marker as scope.coords as no position on marker: " + (JSON.stringify(_this.model)));
return;
}
pos = _this.getCoords(newValue);
_this.gWin.setPosition(pos);
if (_this.opts) {
return _this.opts.position = pos;
}
}
}
}, true);
};
WindowChildModel.prototype.handleClick = function() {
var _this = this;
if (this.markerCtrl != null) {
return this.googleMapsHandles.push(google.maps.event.addListener(this.markerCtrl, 'click', function() {
var pos;
if (_this.gWin == null) {
_this.createGWin();
}
pos = _this.markerCtrl.getPosition();
if (_this.gWin != null) {
_this.gWin.setPosition(pos);
if (_this.opts) {
_this.opts.position = pos;
}
_this.showWindow();
}
_this.initialMarkerVisibility = _this.markerCtrl.getVisible();
return _this.markerCtrl.setVisible(_this.isIconVisibleOnClick);
}));
}
};
WindowChildModel.prototype.showWindow = function() {
var show,
_this = this;
show = function() {
if (_this.gWin) {
if ((_this.scope.show || (_this.scope.show == null)) && !_this.gWin.isOpen()) {
return _this.gWin.open(_this.mapCtrl);
}
}
};
if (this.scope.templateUrl) {
if (this.gWin) {
$http.get(this.scope.templateUrl, {
cache: $templateCache
}).then(function(content) {
var compiled, templateScope;
templateScope = _this.scope.$new();
if (angular.isDefined(_this.scope.templateParameter)) {
templateScope.parameter = _this.scope.templateParameter;
}
compiled = $compile(content.data)(templateScope);
return _this.gWin.setContent(compiled[0]);
});
}
return show();
} else {
return show();
}
};
WindowChildModel.prototype.showHide = function() {
if (this.scope.show) {
return this.showWindow();
} else {
return this.hideWindow();
}
};
WindowChildModel.prototype.getLatestPosition = function() {
if ((this.gWin != null) && (this.markerCtrl != null)) {
return this.gWin.setPosition(this.markerCtrl.getPosition());
}
};
WindowChildModel.prototype.hideWindow = function() {
if ((this.gWin != null) && this.gWin.isOpen()) {
return this.gWin.close();
}
};
WindowChildModel.prototype.remove = function() {
this.hideWindow();
_.each(this.googleMapsHandles, function(h) {
return google.maps.event.removeListener(h);
});
this.googleMapsHandles.length = 0;
return delete this.gWin;
};
WindowChildModel.prototype.destroy = function(manualOverride) {
var self;
if (manualOverride == null) {
manualOverride = false;
}
this.remove();
if ((this.scope != null) && (this.needToManualDestroy || manualOverride)) {
this.scope.$destroy();
}
return self = void 0;
};
return WindowChildModel;
})(BaseObject);
return WindowChildModel;
}
]);
}).call(this);
/*
- interface for all markers to derrive from
- to enforce a minimum set of requirements
- attributes
- coords
- icon
- implementation needed on watches
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.parent").factory("IMarkerParentModel", [
"ModelKey", "Logger", function(ModelKey, Logger) {
var IMarkerParentModel;
IMarkerParentModel = (function(_super) {
__extends(IMarkerParentModel, _super);
IMarkerParentModel.prototype.DEFAULTS = {};
function IMarkerParentModel(scope, element, attrs, mapCtrl, $timeout) {
var self,
_this = this;
this.scope = scope;
this.element = element;
this.attrs = attrs;
this.mapCtrl = mapCtrl;
this.$timeout = $timeout;
this.linkInit = __bind(this.linkInit, this);
this.onDestroy = __bind(this.onDestroy, this);
this.onWatch = __bind(this.onWatch, this);
this.watch = __bind(this.watch, this);
this.validateScope = __bind(this.validateScope, this);
this.onTimeOut = __bind(this.onTimeOut, this);
IMarkerParentModel.__super__.constructor.call(this, this.scope);
self = this;
this.$log = Logger;
if (!this.validateScope(scope)) {
throw new String("Unable to construct IMarkerParentModel due to invalid scope");
}
this.doClick = angular.isDefined(attrs.click);
if (scope.options != null) {
this.DEFAULTS = scope.options;
}
this.$timeout(function() {
_this.onTimeOut(scope);
_this.watch('coords', _this.scope);
_this.watch('icon', _this.scope);
_this.watch('options', _this.scope);
return scope.$on("$destroy", function() {
return _this.onDestroy(scope);
});
});
}
IMarkerParentModel.prototype.onTimeOut = function(scope) {};
IMarkerParentModel.prototype.validateScope = function(scope) {
var ret;
if (scope == null) {
this.$log.error(this.constructor.name + ": invalid scope used");
return false;
}
ret = scope.coords != null;
if (!ret) {
this.$log.error(this.constructor.name + ": no valid coords attribute found");
return false;
}
return ret;
};
IMarkerParentModel.prototype.watch = function(propNameToWatch, scope) {
var watchFunc,
_this = this;
watchFunc = function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.onWatch(propNameToWatch, scope, newValue, oldValue);
}
};
return scope.$watch(propNameToWatch, watchFunc, true);
};
IMarkerParentModel.prototype.onWatch = function(propNameToWatch, scope, newValue, oldValue) {
throw new String("OnWatch Not Implemented!!");
};
IMarkerParentModel.prototype.onDestroy = function(scope) {
throw new String("OnDestroy Not Implemented!!");
};
IMarkerParentModel.prototype.linkInit = function(element, mapCtrl, scope, animate) {
throw new String("LinkInit Not Implemented!!");
};
return IMarkerParentModel;
})(ModelKey);
return IMarkerParentModel;
}
]);
}).call(this);
/*
- interface directive for all window(s) to derrive from
*/
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.parent").factory("IWindowParentModel", [
"ModelKey", "GmapUtil", "Logger", function(ModelKey, GmapUtil, Logger) {
var IWindowParentModel;
IWindowParentModel = (function(_super) {
__extends(IWindowParentModel, _super);
IWindowParentModel.include(GmapUtil);
IWindowParentModel.prototype.DEFAULTS = {};
function IWindowParentModel(scope, element, attrs, ctrls, $timeout, $compile, $http, $templateCache) {
var self;
IWindowParentModel.__super__.constructor.call(this, scope);
self = this;
this.$log = Logger;
this.$timeout = $timeout;
this.$compile = $compile;
this.$http = $http;
this.$templateCache = $templateCache;
if (scope.options != null) {
this.DEFAULTS = scope.options;
}
}
return IWindowParentModel;
})(ModelKey);
return IWindowParentModel;
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.parent").factory("LayerParentModel", [
"BaseObject", "Logger", function(BaseObject, Logger) {
var LayerParentModel;
LayerParentModel = (function(_super) {
__extends(LayerParentModel, _super);
function LayerParentModel(scope, element, attrs, mapCtrl, $timeout, onLayerCreated, $log) {
var _this = this;
this.scope = scope;
this.element = element;
this.attrs = attrs;
this.mapCtrl = mapCtrl;
this.$timeout = $timeout;
this.onLayerCreated = onLayerCreated != null ? onLayerCreated : void 0;
this.$log = $log != null ? $log : Logger;
this.createGoogleLayer = __bind(this.createGoogleLayer, this);
if (this.attrs.type == null) {
this.$log.info("type attribute for the layer directive is mandatory. Layer creation aborted!!");
return;
}
this.createGoogleLayer();
this.gMap = void 0;
this.doShow = true;
this.$timeout(function() {
_this.gMap = mapCtrl.getMap();
if (angular.isDefined(_this.attrs.show)) {
_this.doShow = _this.scope.show;
}
if (_this.doShow && (_this.gMap != null)) {
_this.layer.setMap(_this.gMap);
}
_this.scope.$watch("show", function(newValue, oldValue) {
if (newValue !== oldValue) {
_this.doShow = newValue;
if (newValue) {
return _this.layer.setMap(_this.gMap);
} else {
return _this.layer.setMap(null);
}
}
}, true);
_this.scope.$watch("options", function(newValue, oldValue) {
if (newValue !== oldValue) {
_this.layer.setMap(null);
_this.layer = null;
return _this.createGoogleLayer();
}
}, true);
return _this.scope.$on("$destroy", function() {
return _this.layer.setMap(null);
});
});
}
LayerParentModel.prototype.createGoogleLayer = function() {
var _this = this;
if (this.attrs.options == null) {
this.layer = this.attrs.namespace === void 0 ? new google.maps[this.attrs.type]() : new google.maps[this.attrs.namespace][this.attrs.type]();
} else {
this.layer = this.attrs.namespace === void 0 ? new google.maps[this.attrs.type](this.scope.options) : new google.maps[this.attrs.namespace][this.attrs.type](this.scope.options);
}
return this.$timeout(function() {
var fn;
if ((_this.layer != null) && (_this.onLayerCreated != null)) {
fn = _this.onLayerCreated(_this.scope, _this.layer);
if (fn) {
return fn(_this.layer);
}
}
});
};
return LayerParentModel;
})(BaseObject);
return LayerParentModel;
}
]);
}).call(this);
/*
Basic Directive api for a marker. Basic in the sense that this directive contains 1:1 on scope and model.
Thus there will be one html element per marker within the directive.
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.parent").factory("MarkerParentModel", [
"IMarkerParentModel", "GmapUtil", "EventsHelper", function(IMarkerParentModel, GmapUtil, EventsHelper) {
var MarkerParentModel;
MarkerParentModel = (function(_super) {
__extends(MarkerParentModel, _super);
MarkerParentModel.include(GmapUtil);
MarkerParentModel.include(EventsHelper);
function MarkerParentModel(scope, element, attrs, mapCtrl, $timeout, gMarkerManager, doFit) {
var self;
this.gMarkerManager = gMarkerManager;
this.doFit = doFit;
this.onDestroy = __bind(this.onDestroy, this);
this.setGMarker = __bind(this.setGMarker, this);
this.onWatch = __bind(this.onWatch, this);
this.onTimeOut = __bind(this.onTimeOut, this);
MarkerParentModel.__super__.constructor.call(this, scope, element, attrs, mapCtrl, $timeout);
self = this;
}
MarkerParentModel.prototype.onTimeOut = function(scope) {
var opts,
_this = this;
opts = this.createMarkerOptions(scope.coords, scope.icon, scope.options, this.mapCtrl.getMap());
this.setGMarker(new google.maps.Marker(opts));
google.maps.event.addListener(this.scope.gMarker, 'click', function() {
if (_this.doClick && (scope.click != null)) {
return _this.$timeout(function() {
return _this.scope.click();
});
}
});
this.setEvents(this.scope.gMarker, scope, scope);
return this.$log.info(this);
};
MarkerParentModel.prototype.onWatch = function(propNameToWatch, scope) {
switch (propNameToWatch) {
case 'coords':
if (this.validateCoords(scope.coords) && (this.scope.gMarker != null)) {
this.scope.gMarker.setMap(this.mapCtrl.getMap());
this.scope.gMarker.setPosition(this.getCoords(scope.coords));
this.scope.gMarker.setVisible(this.validateCoords(scope.coords));
return this.scope.gMarker.setOptions(scope.options);
} else {
return this.scope.gMarker.setMap(null);
}
break;
case 'icon':
if ((scope.icon != null) && this.validateCoords(scope.coords) && (this.scope.gMarker != null)) {
this.scope.gMarker.setOptions(scope.options);
this.scope.gMarker.setIcon(scope.icon);
this.scope.gMarker.setMap(null);
this.scope.gMarker.setMap(this.mapCtrl.getMap());
this.scope.gMarker.setPosition(this.getCoords(scope.coords));
return this.scope.gMarker.setVisible(this.validateCoords(scope.coords));
}
break;
case 'options':
if (this.validateCoords(scope.coords) && (scope.icon != null) && scope.options) {
if (this.scope.gMarker != null) {
this.scope.gMarker.setMap(null);
}
return this.setGMarker(new google.maps.Marker(this.createMarkerOptions(scope.coords, scope.icon, scope.options, this.mapCtrl.getMap())));
}
}
};
MarkerParentModel.prototype.setGMarker = function(gMarker) {
if (this.scope.gMarker) {
delete this.scope.gMarker;
this.gMarkerManager.remove(this.scope.gMarker, false);
}
this.scope.gMarker = gMarker;
if (this.scope.gMarker) {
this.gMarkerManager.add(this.scope.gMarker, false);
if (this.doFit) {
return this.gMarkerManager.fit();
}
}
};
MarkerParentModel.prototype.onDestroy = function(scope) {
var self;
if (!this.scope.gMarker) {
self = void 0;
return;
}
this.scope.gMarker.setMap(null);
this.gMarkerManager.remove(this.scope.gMarker, false);
delete this.scope.gMarker;
return self = void 0;
};
return MarkerParentModel;
})(IMarkerParentModel);
return MarkerParentModel;
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.parent").factory("MarkersParentModel", [
"IMarkerParentModel", "ModelsWatcher", "PropMap", "MarkerChildModel", "ClustererMarkerManager", "MarkerManager", function(IMarkerParentModel, ModelsWatcher, PropMap, MarkerChildModel, ClustererMarkerManager, MarkerManager) {
var MarkersParentModel;
MarkersParentModel = (function(_super) {
__extends(MarkersParentModel, _super);
MarkersParentModel.include(ModelsWatcher);
function MarkersParentModel(scope, element, attrs, mapCtrl, $timeout) {
this.onDestroy = __bind(this.onDestroy, this);
this.newChildMarker = __bind(this.newChildMarker, this);
this.pieceMealMarkers = __bind(this.pieceMealMarkers, this);
this.reBuildMarkers = __bind(this.reBuildMarkers, this);
this.createMarkersFromScratch = __bind(this.createMarkersFromScratch, this);
this.validateScope = __bind(this.validateScope, this);
this.onWatch = __bind(this.onWatch, this);
this.onTimeOut = __bind(this.onTimeOut, this);
var self,
_this = this;
MarkersParentModel.__super__.constructor.call(this, scope, element, attrs, mapCtrl, $timeout);
self = this;
this.scope.markerModels = new PropMap();
this.$timeout = $timeout;
this.$log.info(this);
this.doRebuildAll = this.scope.doRebuildAll != null ? this.scope.doRebuildAll : false;
this.setIdKey(scope);
this.scope.$watch('doRebuildAll', function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.doRebuildAll = newValue;
}
});
}
MarkersParentModel.prototype.onTimeOut = function(scope) {
this.watch('models', scope);
this.watch('doCluster', scope);
this.watch('clusterOptions', scope);
this.watch('clusterEvents', scope);
this.watch('fit', scope);
this.watch('idKey', scope);
this.gMarkerManager = void 0;
return this.createMarkersFromScratch(scope);
};
MarkersParentModel.prototype.onWatch = function(propNameToWatch, scope, newValue, oldValue) {
if (propNameToWatch === "idKey" && newValue !== oldValue) {
this.idKey = newValue;
}
if (this.doRebuildAll) {
return this.reBuildMarkers(scope);
} else {
return this.pieceMealMarkers(scope);
}
};
MarkersParentModel.prototype.validateScope = function(scope) {
var modelsNotDefined;
modelsNotDefined = angular.isUndefined(scope.models) || scope.models === void 0;
if (modelsNotDefined) {
this.$log.error(this.constructor.name + ": no valid models attribute found");
}
return MarkersParentModel.__super__.validateScope.call(this, scope) || modelsNotDefined;
};
MarkersParentModel.prototype.createMarkersFromScratch = function(scope) {
var _this = this;
if (scope.doCluster) {
if (scope.clusterEvents) {
this.clusterInternalOptions = _.once(function() {
var self, _ref, _ref1, _ref2;
self = _this;
if (!_this.origClusterEvents) {
_this.origClusterEvents = {
click: (_ref = scope.clusterEvents) != null ? _ref.click : void 0,
mouseout: (_ref1 = scope.clusterEvents) != null ? _ref1.mouseout : void 0,
mouseover: (_ref2 = scope.clusterEvents) != null ? _ref2.mouseover : void 0
};
return _.extend(scope.clusterEvents, {
click: function(cluster) {
return self.maybeExecMappedEvent(cluster, "click");
},
mouseout: function(cluster) {
return self.maybeExecMappedEvent(cluster, "mouseout");
},
mouseover: function(cluster) {
return self.maybeExecMappedEvent(cluster, "mouseover");
}
});
}
})();
}
if (scope.clusterOptions || scope.clusterEvents) {
if (this.gMarkerManager === void 0) {
this.gMarkerManager = new ClustererMarkerManager(this.mapCtrl.getMap(), void 0, scope.clusterOptions, this.clusterInternalOptions);
} else {
if (this.gMarkerManager.opt_options !== scope.clusterOptions) {
this.gMarkerManager = new ClustererMarkerManager(this.mapCtrl.getMap(), void 0, scope.clusterOptions, this.clusterInternalOptions);
}
}
} else {
this.gMarkerManager = new ClustererMarkerManager(this.mapCtrl.getMap());
}
} else {
this.gMarkerManager = new MarkerManager(this.mapCtrl.getMap());
}
return _async.each(scope.models, function(model) {
return _this.newChildMarker(model, scope);
}, function() {
_this.gMarkerManager.draw();
if (scope.fit) {
return _this.gMarkerManager.fit();
}
});
};
MarkersParentModel.prototype.reBuildMarkers = function(scope) {
if (!scope.doRebuild && scope.doRebuild !== void 0) {
return;
}
this.onDestroy(scope);
return this.createMarkersFromScratch(scope);
};
MarkersParentModel.prototype.pieceMealMarkers = function(scope) {
var _this = this;
if ((this.scope.models != null) && this.scope.models.length > 0 && this.scope.markerModels.length > 0) {
return this.figureOutState(this.idKey, scope, this.scope.markerModels, this.modelKeyComparison, function(state) {
var payload;
payload = state;
return _async.each(payload.removals, function(child) {
if (child != null) {
if (child.destroy != null) {
child.destroy();
}
return _this.scope.markerModels.remove(child.id);
}
}, function() {
return _async.each(payload.adds, function(modelToAdd) {
return _this.newChildMarker(modelToAdd, scope);
}, function() {
if (payload.adds.length > 0 || payload.removals.length > 0) {
_this.gMarkerManager.draw();
return scope.markerModels = _this.scope.markerModels;
}
});
});
});
} else {
return this.reBuildMarkers(scope);
}
};
MarkersParentModel.prototype.newChildMarker = function(model, scope) {
var child;
if (model[this.idKey] == null) {
this.$log.error("Marker model has no id to assign a child to. This is required for performance. Please assign id, or redirect id to a different key.");
return;
}
this.$log.info('child', child, 'markers', this.scope.markerModels);
child = new MarkerChildModel(model, scope, this.mapCtrl, this.$timeout, this.DEFAULTS, this.doClick, this.gMarkerManager, this.idKey);
this.scope.markerModels.put(model[this.idKey], child);
return child;
};
MarkersParentModel.prototype.onDestroy = function(scope) {
_.each(this.scope.markerModels.values(), function(model) {
if (model != null) {
return model.destroy();
}
});
delete this.scope.markerModels;
this.scope.markerModels = new PropMap();
if (this.gMarkerManager != null) {
return this.gMarkerManager.clear();
}
};
MarkersParentModel.prototype.maybeExecMappedEvent = function(cluster, fnName) {
var pair, _ref;
if (_.isFunction((_ref = this.scope.clusterEvents) != null ? _ref[fnName] : void 0)) {
pair = this.mapClusterToMarkerModels(cluster);
if (this.origClusterEvents[fnName]) {
return this.origClusterEvents[fnName](pair.cluster, pair.mapped);
}
}
};
MarkersParentModel.prototype.mapClusterToMarkerModels = function(cluster) {
var gMarkers, mapped,
_this = this;
gMarkers = cluster.getMarkers();
mapped = gMarkers.map(function(g) {
return _this.scope.markerModels[g.key].model;
});
return {
cluster: cluster,
mapped: mapped
};
};
return MarkersParentModel;
})(IMarkerParentModel);
return MarkersParentModel;
}
]);
}).call(this);
/*
Windows directive where many windows map to the models property
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.parent").factory("PolylinesParentModel", [
"$timeout", "Logger", "ModelKey", "ModelsWatcher", "PropMap", "PolylineChildModel", function($timeout, Logger, ModelKey, ModelsWatcher, PropMap, PolylineChildModel) {
var PolylinesParentModel;
return PolylinesParentModel = (function(_super) {
__extends(PolylinesParentModel, _super);
PolylinesParentModel.include(ModelsWatcher);
function PolylinesParentModel(scope, element, attrs, gMap, defaults) {
var self,
_this = this;
this.scope = scope;
this.element = element;
this.attrs = attrs;
this.gMap = gMap;
this.defaults = defaults;
this.modelKeyComparison = __bind(this.modelKeyComparison, this);
this.setChildScope = __bind(this.setChildScope, this);
this.createChild = __bind(this.createChild, this);
this.pieceMeal = __bind(this.pieceMeal, this);
this.createAllNew = __bind(this.createAllNew, this);
this.watchIdKey = __bind(this.watchIdKey, this);
this.createChildScopes = __bind(this.createChildScopes, this);
this.watchOurScope = __bind(this.watchOurScope, this);
this.watchDestroy = __bind(this.watchDestroy, this);
this.rebuildAll = __bind(this.rebuildAll, this);
this.doINeedToWipe = __bind(this.doINeedToWipe, this);
this.watchModels = __bind(this.watchModels, this);
this.watch = __bind(this.watch, this);
PolylinesParentModel.__super__.constructor.call(this, scope);
self = this;
this.$log = Logger;
this.plurals = new PropMap();
this.scopePropNames = ['path', 'stroke', 'clickable', 'draggable', 'editable', 'geodesic', 'icons', 'visible'];
_.each(this.scopePropNames, function(name) {
return _this[name + 'Key'] = void 0;
});
this.models = void 0;
this.firstTime = true;
this.$log.info(this);
$timeout(function() {
_this.watchOurScope(scope);
return _this.createChildScopes();
});
}
PolylinesParentModel.prototype.watch = function(scope, name, nameKey) {
var _this = this;
return scope.$watch(name, function(newValue, oldValue) {
if (newValue !== oldValue) {
_this[nameKey] = typeof newValue === 'function' ? newValue() : newValue;
return _async.each(_.values(_this.plurals), function(model) {
return model.scope[name] = _this[nameKey] === 'self' ? model : model[_this[nameKey]];
}, function() {});
}
});
};
PolylinesParentModel.prototype.watchModels = function(scope) {
var _this = this;
return scope.$watch('models', function(newValue, oldValue) {
if (!_.isEqual(newValue, oldValue)) {
if (_this.doINeedToWipe(newValue)) {
return _this.rebuildAll(scope, true, true);
} else {
return _this.createChildScopes(false);
}
}
}, true);
};
PolylinesParentModel.prototype.doINeedToWipe = function(newValue) {
var newValueIsEmpty;
newValueIsEmpty = newValue != null ? newValue.length === 0 : true;
return this.plurals.length > 0 && newValueIsEmpty;
};
PolylinesParentModel.prototype.rebuildAll = function(scope, doCreate, doDelete) {
var _this = this;
return _async.each(this.plurals.values(), function(model) {
return model.destroy();
}, function() {
if (doDelete) {
delete _this.plurals;
}
_this.plurals = new PropMap();
if (doCreate) {
return _this.createChildScopes();
}
});
};
PolylinesParentModel.prototype.watchDestroy = function(scope) {
var _this = this;
return scope.$on("$destroy", function() {
return _this.rebuildAll(scope, false, true);
});
};
PolylinesParentModel.prototype.watchOurScope = function(scope) {
var _this = this;
return _.each(this.scopePropNames, function(name) {
var nameKey;
nameKey = name + 'Key';
_this[nameKey] = typeof scope[name] === 'function' ? scope[name]() : scope[name];
return _this.watch(scope, name, nameKey);
});
};
PolylinesParentModel.prototype.createChildScopes = function(isCreatingFromScratch) {
if (isCreatingFromScratch == null) {
isCreatingFromScratch = true;
}
if (angular.isUndefined(this.scope.models)) {
this.$log.error("No models to create polylines from! I Need direct models!");
return;
}
if (this.gMap != null) {
if (this.scope.models != null) {
this.watchIdKey(this.scope);
if (isCreatingFromScratch) {
return this.createAllNew(this.scope, false);
} else {
return this.pieceMeal(this.scope, false);
}
}
}
};
PolylinesParentModel.prototype.watchIdKey = function(scope) {
var _this = this;
this.setIdKey(scope);
return scope.$watch('idKey', function(newValue, oldValue) {
if (newValue !== oldValue && (newValue == null)) {
_this.idKey = newValue;
return _this.rebuildAll(scope, true, true);
}
});
};
PolylinesParentModel.prototype.createAllNew = function(scope, isArray) {
var _this = this;
if (isArray == null) {
isArray = false;
}
this.models = scope.models;
if (this.firstTime) {
this.watchModels(scope);
this.watchDestroy(scope);
}
return _async.each(scope.models, function(model) {
return _this.createChild(model, _this.gMap);
}, function() {
return _this.firstTime = false;
});
};
PolylinesParentModel.prototype.pieceMeal = function(scope, isArray) {
var _this = this;
if (isArray == null) {
isArray = true;
}
this.models = scope.models;
if ((scope != null) && (scope.models != null) && scope.models.length > 0 && this.plurals.length > 0) {
return this.figureOutState(this.idKey, scope, this.plurals, this.modelKeyComparison, function(state) {
var payload;
payload = state;
return _async.each(payload.removals, function(id) {
var child;
child = _this.plurals[id];
if (child != null) {
child.destroy();
return _this.plurals.remove(id);
}
}, function() {
return _async.each(payload.adds, function(modelToAdd) {
return _this.createChild(modelToAdd, _this.gMap);
}, function() {});
});
});
} else {
return this.rebuildAll(this.scope, true, true);
}
};
PolylinesParentModel.prototype.createChild = function(model, gMap) {
var child, childScope,
_this = this;
childScope = this.scope.$new(false);
this.setChildScope(childScope, model);
childScope.$watch('model', function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.setChildScope(childScope, newValue);
}
}, true);
childScope["static"] = this.scope["static"];
child = new PolylineChildModel(childScope, this.attrs, gMap, this.defaults, model);
if (model[this.idKey] == null) {
this.$log.error("Polyline model has no id to assign a child to. This is required for performance. Please assign id, or redirect id to a different key.");
return;
}
this.plurals.put(model[this.idKey], child);
return child;
};
PolylinesParentModel.prototype.setChildScope = function(childScope, model) {
var _this = this;
_.each(this.scopePropNames, function(name) {
var nameKey, newValue;
nameKey = name + 'Key';
newValue = _this[nameKey] === 'self' ? model : model[_this[nameKey]];
if (newValue !== childScope[name]) {
return childScope[name] = newValue;
}
});
return childScope.model = model;
};
PolylinesParentModel.prototype.modelKeyComparison = function(model1, model2) {
return _.isEqual(this.evalModelHandle(model1, this.scope.path), this.evalModelHandle(model2, this.scope.path));
};
return PolylinesParentModel;
})(ModelKey);
}
]);
}).call(this);
/*
Windows directive where many windows map to the models property
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api.models.parent").factory("WindowsParentModel", [
"IWindowParentModel", "ModelsWatcher", "PropMap", "WindowChildModel", "Linked", function(IWindowParentModel, ModelsWatcher, PropMap, WindowChildModel, Linked) {
var WindowsParentModel;
WindowsParentModel = (function(_super) {
__extends(WindowsParentModel, _super);
WindowsParentModel.include(ModelsWatcher);
function WindowsParentModel(scope, element, attrs, ctrls, $timeout, $compile, $http, $templateCache, $interpolate) {
var self,
_this = this;
this.$interpolate = $interpolate;
this.interpolateContent = __bind(this.interpolateContent, this);
this.setChildScope = __bind(this.setChildScope, this);
this.createWindow = __bind(this.createWindow, this);
this.setContentKeys = __bind(this.setContentKeys, this);
this.pieceMealWindows = __bind(this.pieceMealWindows, this);
this.createAllNewWindows = __bind(this.createAllNewWindows, this);
this.watchIdKey = __bind(this.watchIdKey, this);
this.createChildScopesWindows = __bind(this.createChildScopesWindows, this);
this.watchOurScope = __bind(this.watchOurScope, this);
this.watchDestroy = __bind(this.watchDestroy, this);
this.rebuildAll = __bind(this.rebuildAll, this);
this.doINeedToWipe = __bind(this.doINeedToWipe, this);
this.watchModels = __bind(this.watchModels, this);
this.watch = __bind(this.watch, this);
WindowsParentModel.__super__.constructor.call(this, scope, element, attrs, ctrls, $timeout, $compile, $http, $templateCache);
self = this;
this.windows = new PropMap();
this.scopePropNames = ['show', 'coords', 'templateUrl', 'templateParameter', 'isIconVisibleOnClick', 'closeClick'];
_.each(this.scopePropNames, function(name) {
return _this[name + 'Key'] = void 0;
});
this.linked = new Linked(scope, element, attrs, ctrls);
this.models = void 0;
this.contentKeys = void 0;
this.isIconVisibleOnClick = void 0;
this.firstTime = true;
this.$log.info(self);
this.parentScope = void 0;
this.$timeout(function() {
_this.watchOurScope(scope);
_this.doRebuildAll = _this.scope.doRebuildAll != null ? _this.scope.doRebuildAll : false;
scope.$watch('doRebuildAll', function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.doRebuildAll = newValue;
}
});
return _this.createChildScopesWindows();
}, 50);
}
WindowsParentModel.prototype.watch = function(scope, name, nameKey) {
var _this = this;
return scope.$watch(name, function(newValue, oldValue) {
if (newValue !== oldValue) {
_this[nameKey] = typeof newValue === 'function' ? newValue() : newValue;
return _async.each(_.values(_this.windows), function(model) {
return model.scope[name] = _this[nameKey] === 'self' ? model : model[_this[nameKey]];
}, function() {});
}
});
};
WindowsParentModel.prototype.watchModels = function(scope) {
var _this = this;
return scope.$watch('models', function(newValue, oldValue) {
if (!_.isEqual(newValue, oldValue)) {
if (_this.doRebuildAll || _this.doINeedToWipe(newValue)) {
return _this.rebuildAll(scope, true, true);
} else {
return _this.createChildScopesWindows(false);
}
}
});
};
WindowsParentModel.prototype.doINeedToWipe = function(newValue) {
var newValueIsEmpty;
newValueIsEmpty = newValue != null ? newValue.length === 0 : true;
return this.windows.length > 0 && newValueIsEmpty;
};
WindowsParentModel.prototype.rebuildAll = function(scope, doCreate, doDelete) {
var _this = this;
return _async.each(this.windows.values(), function(model) {
return model.destroy();
}, function() {
if (doDelete) {
delete _this.windows;
}
_this.windows = new PropMap();
if (doCreate) {
return _this.createChildScopesWindows();
}
});
};
WindowsParentModel.prototype.watchDestroy = function(scope) {
var _this = this;
return scope.$on("$destroy", function() {
return _this.rebuildAll(scope, false, true);
});
};
WindowsParentModel.prototype.watchOurScope = function(scope) {
var _this = this;
return _.each(this.scopePropNames, function(name) {
var nameKey;
nameKey = name + 'Key';
_this[nameKey] = typeof scope[name] === 'function' ? scope[name]() : scope[name];
return _this.watch(scope, name, nameKey);
});
};
WindowsParentModel.prototype.createChildScopesWindows = function(isCreatingFromScratch) {
var markersScope, modelsNotDefined;
if (isCreatingFromScratch == null) {
isCreatingFromScratch = true;
}
/*
being that we cannot tell the difference in Key String vs. a normal value string (TemplateUrl)
we will assume that all scope values are string expressions either pointing to a key (propName) or using
'self' to point the model as container/object of interest.
This may force redundant information into the model, but this appears to be the most flexible approach.
*/
this.isIconVisibleOnClick = true;
if (angular.isDefined(this.linked.attrs.isiconvisibleonclick)) {
this.isIconVisibleOnClick = this.linked.scope.isIconVisibleOnClick;
}
this.gMap = this.linked.ctrls[0].getMap();
if (this.linked.ctrls[1] != null) {
markersScope = this.linked.ctrls.length > 1 ? this.linked.ctrls[1].getMarkersScope() : void 0;
}
modelsNotDefined = angular.isUndefined(this.linked.scope.models);
if (modelsNotDefined && (markersScope === void 0 || (markersScope.markerModels === void 0 || markersScope.models === void 0))) {
this.$log.error("No models to create windows from! Need direct models or models derrived from markers!");
return;
}
if (this.gMap != null) {
if (this.linked.scope.models != null) {
this.watchIdKey(this.linked.scope);
if (isCreatingFromScratch) {
return this.createAllNewWindows(this.linked.scope, false);
} else {
return this.pieceMealWindows(this.linked.scope, false);
}
} else {
this.parentScope = markersScope;
this.watchIdKey(this.parentScope);
if (isCreatingFromScratch) {
return this.createAllNewWindows(markersScope, true, 'markerModels', false);
} else {
return this.pieceMealWindows(markersScope, true, 'markerModels', false);
}
}
}
};
WindowsParentModel.prototype.watchIdKey = function(scope) {
var _this = this;
this.setIdKey(scope);
return scope.$watch('idKey', function(newValue, oldValue) {
if (newValue !== oldValue && (newValue == null)) {
_this.idKey = newValue;
return _this.rebuildAll(scope, true, true);
}
});
};
WindowsParentModel.prototype.createAllNewWindows = function(scope, hasGMarker, modelsPropToIterate, isArray) {
var _this = this;
if (modelsPropToIterate == null) {
modelsPropToIterate = 'models';
}
if (isArray == null) {
isArray = false;
}
this.models = scope.models;
if (this.firstTime) {
this.watchModels(scope);
this.watchDestroy(scope);
}
this.setContentKeys(scope.models);
return _async.each(scope.models, function(model) {
var gMarker;
gMarker = hasGMarker ? scope[modelsPropToIterate][[model[_this.idKey]]].gMarker : void 0;
return _this.createWindow(model, gMarker, _this.gMap);
}, function() {
return _this.firstTime = false;
});
};
WindowsParentModel.prototype.pieceMealWindows = function(scope, hasGMarker, modelsPropToIterate, isArray) {
var _this = this;
if (modelsPropToIterate == null) {
modelsPropToIterate = 'models';
}
if (isArray == null) {
isArray = true;
}
this.models = scope.models;
if ((scope != null) && (scope.models != null) && scope.models.length > 0 && this.windows.length > 0) {
return this.figureOutState(this.idKey, scope, this.windows, this.modelKeyComparison, function(state) {
var payload;
payload = state;
return _async.each(payload.removals, function(child) {
if (child != null) {
if (child.destroy != null) {
child.destroy();
}
return _this.windows.remove(child.id);
}
}, function() {
return _async.each(payload.adds, function(modelToAdd) {
var gMarker;
gMarker = scope[modelsPropToIterate][modelToAdd[_this.idKey]].gMarker;
return _this.createWindow(modelToAdd, gMarker, _this.gMap);
}, function() {});
});
});
} else {
return this.rebuildAll(this.scope, true, true);
}
};
WindowsParentModel.prototype.setContentKeys = function(models) {
if (models.length > 0) {
return this.contentKeys = Object.keys(models[0]);
}
};
WindowsParentModel.prototype.createWindow = function(model, gMarker, gMap) {
var child, childScope, fakeElement, opts,
_this = this;
childScope = this.linked.scope.$new(false);
this.setChildScope(childScope, model);
childScope.$watch('model', function(newValue, oldValue) {
if (newValue !== oldValue) {
return _this.setChildScope(childScope, newValue);
}
}, true);
fakeElement = {
html: function() {
return _this.interpolateContent(_this.linked.element.html(), model);
}
};
opts = this.createWindowOptions(gMarker, childScope, fakeElement.html(), this.DEFAULTS);
child = new WindowChildModel(model, childScope, opts, this.isIconVisibleOnClick, gMap, gMarker, fakeElement, true, true);
if (model[this.idKey] == null) {
this.$log.error("Window model has no id to assign a child to. This is required for performance. Please assign id, or redirect id to a different key.");
return;
}
this.windows.put(model[this.idKey], child);
return child;
};
WindowsParentModel.prototype.setChildScope = function(childScope, model) {
var _this = this;
_.each(this.scopePropNames, function(name) {
var nameKey, newValue;
nameKey = name + 'Key';
newValue = _this[nameKey] === 'self' ? model : model[_this[nameKey]];
if (newValue !== childScope[name]) {
return childScope[name] = newValue;
}
});
return childScope.model = model;
};
WindowsParentModel.prototype.interpolateContent = function(content, model) {
var exp, interpModel, key, _i, _len, _ref;
if (this.contentKeys === void 0 || this.contentKeys.length === 0) {
return;
}
exp = this.$interpolate(content);
interpModel = {};
_ref = this.contentKeys;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
key = _ref[_i];
interpModel[key] = model[key];
}
return exp(interpModel);
};
return WindowsParentModel;
})(IWindowParentModel);
return WindowsParentModel;
}
]);
}).call(this);
/*
- interface for all labels to derrive from
- to enforce a minimum set of requirements
- attributes
- content
- anchor
- implementation needed on watches
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("ILabel", [
"BaseObject", "Logger", function(BaseObject, Logger) {
var ILabel;
return ILabel = (function(_super) {
__extends(ILabel, _super);
function ILabel($timeout) {
this.link = __bind(this.link, this);
var self;
self = this;
this.restrict = 'ECMA';
this.replace = true;
this.template = void 0;
this.require = void 0;
this.transclude = true;
this.priority = -100;
this.scope = {
labelContent: '=content',
labelAnchor: '@anchor',
labelClass: '@class',
labelStyle: '=style'
};
this.$log = Logger;
this.$timeout = $timeout;
}
ILabel.prototype.link = function(scope, element, attrs, ctrl) {
throw new Exception("Not Implemented!!");
};
return ILabel;
})(BaseObject);
}
]);
}).call(this);
/*
- interface for all markers to derrive from
- to enforce a minimum set of requirements
- attributes
- coords
- icon
- implementation needed on watches
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("IMarker", [
"Logger", "BaseObject", function(Logger, BaseObject) {
var IMarker;
return IMarker = (function(_super) {
__extends(IMarker, _super);
function IMarker($timeout) {
this.link = __bind(this.link, this);
var self;
self = this;
this.$log = Logger;
this.$timeout = $timeout;
this.restrict = 'ECMA';
this.require = '^googleMap';
this.priority = -1;
this.transclude = true;
this.replace = true;
this.scope = {
coords: '=coords',
icon: '=icon',
click: '&click',
options: '=options',
events: '=events',
fit: '=fit'
};
}
IMarker.prototype.controller = [
'$scope', '$element', function($scope, $element) {
throw new Exception("Not Implemented!!");
}
];
IMarker.prototype.link = function(scope, element, attrs, ctrl) {
throw new Exception("Not implemented!!");
};
return IMarker;
})(BaseObject);
}
]);
}).call(this);
(function() {
var __hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("IPolyline", [
"GmapUtil", "BaseObject", "Logger", function(GmapUtil, BaseObject, Logger) {
var IPolyline;
return IPolyline = (function(_super) {
__extends(IPolyline, _super);
IPolyline.include(GmapUtil);
function IPolyline() {
var self;
self = this;
}
IPolyline.prototype.restrict = "ECA";
IPolyline.prototype.replace = true;
IPolyline.prototype.require = "^googleMap";
IPolyline.prototype.scope = {
path: "=",
stroke: "=",
clickable: "=",
draggable: "=",
editable: "=",
geodesic: "=",
icons: "=",
visible: "=",
"static": "=",
fit: "="
};
IPolyline.prototype.DEFAULTS = {};
IPolyline.prototype.$log = Logger;
return IPolyline;
})(BaseObject);
}
]);
}).call(this);
/*
- interface directive for all window(s) to derrive from
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("IWindow", [
"BaseObject", "ChildEvents", "Logger", function(BaseObject, ChildEvents, Logger) {
var IWindow;
return IWindow = (function(_super) {
__extends(IWindow, _super);
IWindow.include(ChildEvents);
function IWindow($timeout, $compile, $http, $templateCache) {
var self;
this.$timeout = $timeout;
this.$compile = $compile;
this.$http = $http;
this.$templateCache = $templateCache;
this.link = __bind(this.link, this);
self = this;
this.restrict = 'ECMA';
this.template = void 0;
this.transclude = true;
this.priority = -100;
this.require = void 0;
this.replace = true;
this.scope = {
coords: '=coords',
show: '=show',
templateUrl: '=templateurl',
templateParameter: '=templateparameter',
isIconVisibleOnClick: '=isiconvisibleonclick',
closeClick: '&closeclick',
options: '=options'
};
this.$log = Logger;
}
IWindow.prototype.link = function(scope, element, attrs, ctrls) {
throw new Exception("Not Implemented!!");
};
return IWindow;
})(BaseObject);
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("Map", [
"$timeout", "Logger", "GmapUtil", "BaseObject", function($timeout, Logger, GmapUtil, BaseObject) {
"use strict";
var $log, DEFAULTS, Map;
$log = Logger;
DEFAULTS = {
mapTypeId: google.maps.MapTypeId.ROADMAP
};
return Map = (function(_super) {
__extends(Map, _super);
Map.include(GmapUtil);
function Map() {
this.link = __bind(this.link, this);
var self;
self = this;
}
Map.prototype.restrict = "ECMA";
Map.prototype.transclude = true;
Map.prototype.replace = false;
Map.prototype.template = "<div class=\"angular-google-map\"><div class=\"angular-google-map-container\"></div><div ng-transclude style=\"display: none\"></div></div>";
Map.prototype.scope = {
center: "=center",
zoom: "=zoom",
dragging: "=dragging",
control: "=",
windows: "=windows",
options: "=options",
events: "=events",
styles: "=styles",
bounds: "=bounds"
};
Map.prototype.controller = [
"$scope", function($scope) {
return {
getMap: function() {
return $scope.map;
}
};
}
];
/*
@param scope
@param element
@param attrs
*/
Map.prototype.link = function(scope, element, attrs) {
var dragging, el, eventName, getEventHandler, opts, settingCenterFromScope, type, _m,
_this = this;
if (!this.validateCoords(scope.center)) {
$log.error("angular-google-maps: could not find a valid center property");
return;
}
if (!angular.isDefined(scope.zoom)) {
$log.error("angular-google-maps: map zoom property not set");
return;
}
el = angular.element(element);
el.addClass("angular-google-map");
opts = {
options: {}
};
if (attrs.options) {
opts.options = scope.options;
}
if (attrs.styles) {
opts.styles = scope.styles;
}
if (attrs.type) {
type = attrs.type.toUpperCase();
if (google.maps.MapTypeId.hasOwnProperty(type)) {
opts.mapTypeId = google.maps.MapTypeId[attrs.type.toUpperCase()];
} else {
$log.error("angular-google-maps: invalid map type \"" + attrs.type + "\"");
}
}
_m = new google.maps.Map(el.find("div")[1], angular.extend({}, DEFAULTS, opts, {
center: this.getCoords(scope.center),
draggable: this.isTrue(attrs.draggable),
zoom: scope.zoom,
bounds: scope.bounds
}));
dragging = false;
google.maps.event.addListener(_m, "dragstart", function() {
dragging = true;
return _.defer(function() {
return scope.$apply(function(s) {
if (s.dragging != null) {
return s.dragging = dragging;
}
});
});
});
google.maps.event.addListener(_m, "dragend", function() {
dragging = false;
return _.defer(function() {
return scope.$apply(function(s) {
if (s.dragging != null) {
return s.dragging = dragging;
}
});
});
});
google.maps.event.addListener(_m, "drag", function() {
var c;
c = _m.center;
return _.defer(function() {
return scope.$apply(function(s) {
if (angular.isDefined(s.center.type)) {
s.center.coordinates[1] = c.lat();
return s.center.coordinates[0] = c.lng();
} else {
s.center.latitude = c.lat();
return s.center.longitude = c.lng();
}
});
});
});
google.maps.event.addListener(_m, "zoom_changed", function() {
if (scope.zoom !== _m.zoom) {
return _.defer(function() {
return scope.$apply(function(s) {
return s.zoom = _m.zoom;
});
});
}
});
settingCenterFromScope = false;
google.maps.event.addListener(_m, "center_changed", function() {
var c;
c = _m.center;
if (settingCenterFromScope) {
return;
}
return _.defer(function() {
return scope.$apply(function(s) {
if (!_m.dragging) {
if (angular.isDefined(s.center.type)) {
if (s.center.coordinates[1] !== c.lat()) {
s.center.coordinates[1] = c.lat();
}
if (s.center.coordinates[0] !== c.lng()) {
return s.center.coordinates[0] = c.lng();
}
} else {
if (s.center.latitude !== c.lat()) {
s.center.latitude = c.lat();
}
if (s.center.longitude !== c.lng()) {
return s.center.longitude = c.lng();
}
}
}
});
});
});
google.maps.event.addListener(_m, "idle", function() {
var b, ne, sw;
b = _m.getBounds();
ne = b.getNorthEast();
sw = b.getSouthWest();
return _.defer(function() {
return scope.$apply(function(s) {
if (s.bounds !== null && s.bounds !== undefined && s.bounds !== void 0) {
s.bounds.northeast = {
latitude: ne.lat(),
longitude: ne.lng()
};
return s.bounds.southwest = {
latitude: sw.lat(),
longitude: sw.lng()
};
}
});
});
});
if (angular.isDefined(scope.events) && scope.events !== null && angular.isObject(scope.events)) {
getEventHandler = function(eventName) {
return function() {
return scope.events[eventName].apply(scope, [_m, eventName, arguments]);
};
};
for (eventName in scope.events) {
if (scope.events.hasOwnProperty(eventName) && angular.isFunction(scope.events[eventName])) {
google.maps.event.addListener(_m, eventName, getEventHandler(eventName));
}
}
}
scope.map = _m;
if ((attrs.control != null) && (scope.control != null)) {
scope.control.refresh = function(maybeCoords) {
var coords;
if (_m == null) {
return;
}
google.maps.event.trigger(_m, "resize");
if (((maybeCoords != null ? maybeCoords.latitude : void 0) != null) && ((maybeCoords != null ? maybeCoords.latitude : void 0) != null)) {
coords = _this.getCoords(maybeCoords);
if (_this.isTrue(attrs.pan)) {
return _m.panTo(coords);
} else {
return _m.setCenter(coords);
}
}
};
/*
I am sure you all will love this. You want the instance here you go.. BOOM!
*/
scope.control.getGMap = function() {
return _m;
};
}
scope.$watch("center", (function(newValue, oldValue) {
var coords;
coords = _this.getCoords(newValue);
if (coords.lat() === _m.center.lat() && coords.lng() === _m.center.lng()) {
return;
}
settingCenterFromScope = true;
if (!dragging) {
if (!_this.validateCoords(newValue)) {
$log.error("Invalid center for newValue: " + (JSON.stringify(newValue)));
}
if (_this.isTrue(attrs.pan) && scope.zoom === _m.zoom) {
_m.panTo(coords);
} else {
_m.setCenter(coords);
}
}
return settingCenterFromScope = false;
}), true);
scope.$watch("zoom", function(newValue, oldValue) {
if (newValue === _m.zoom) {
return;
}
return _.defer(function() {
return _m.setZoom(newValue);
});
});
scope.$watch("bounds", function(newValue, oldValue) {
var bounds, ne, sw;
if (newValue === oldValue) {
return;
}
if ((newValue.northeast.latitude == null) || (newValue.northeast.longitude == null) || (newValue.southwest.latitude == null) || (newValue.southwest.longitude == null)) {
$log.error("Invalid map bounds for new value: " + (JSON.stringify(newValue)));
return;
}
ne = new google.maps.LatLng(newValue.northeast.latitude, newValue.northeast.longitude);
sw = new google.maps.LatLng(newValue.southwest.latitude, newValue.southwest.longitude);
bounds = new google.maps.LatLngBounds(sw, ne);
return _m.fitBounds(bounds);
});
scope.$watch("options", function(newValue, oldValue) {
if (!_.isEqual(newValue, oldValue)) {
opts.options = newValue;
if (_m != null) {
return _m.setOptions(opts);
}
}
}, true);
return scope.$watch("styles", function(newValue, oldValue) {
if (!_.isEqual(newValue, oldValue)) {
opts.styles = newValue;
if (_m != null) {
return _m.setOptions(opts);
}
}
}, true);
};
return Map;
})(BaseObject);
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("Marker", [
"IMarker", "MarkerParentModel", "MarkerManager", function(IMarker, MarkerParentModel, MarkerManager) {
var Marker;
return Marker = (function(_super) {
__extends(Marker, _super);
function Marker($timeout) {
this.link = __bind(this.link, this);
var self;
Marker.__super__.constructor.call(this, $timeout);
self = this;
this.template = '<span class="angular-google-map-marker" ng-transclude></span>';
this.$log.info(this);
}
Marker.prototype.controller = [
'$scope', '$element', function($scope, $element) {
return {
getMarkerScope: function() {
return $scope;
}
};
}
];
Marker.prototype.link = function(scope, element, attrs, ctrl) {
var doFit;
if (scope.fit) {
doFit = true;
}
if (!this.gMarkerManager) {
this.gMarkerManager = new MarkerManager(ctrl.getMap());
}
return new MarkerParentModel(scope, element, attrs, ctrl, this.$timeout, this.gMarkerManager, doFit);
};
return Marker;
})(IMarker);
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("Markers", [
"IMarker", "MarkersParentModel", function(IMarker, MarkersParentModel) {
var Markers;
return Markers = (function(_super) {
__extends(Markers, _super);
function Markers($timeout) {
this.link = __bind(this.link, this);
var self;
Markers.__super__.constructor.call(this, $timeout);
this.template = '<span class="angular-google-map-markers" ng-transclude></span>';
this.scope.idKey = '=idkey';
this.scope.doRebuildAll = '=dorebuildall';
this.scope.models = '=models';
this.scope.doCluster = '=docluster';
this.scope.clusterOptions = '=clusteroptions';
this.scope.clusterEvents = '=clusterevents';
this.scope.labelContent = '=labelcontent';
this.scope.labelAnchor = '@labelanchor';
this.scope.labelClass = '@labelclass';
this.$timeout = $timeout;
self = this;
this.$log.info(this);
}
Markers.prototype.controller = [
'$scope', '$element', function($scope, $element) {
return {
getMarkersScope: function() {
return $scope;
}
};
}
];
Markers.prototype.link = function(scope, element, attrs, ctrl) {
return new MarkersParentModel(scope, element, attrs, ctrl, this.$timeout);
};
return Markers;
})(IMarker);
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("Polyline", [
"IPolyline", "$timeout", "array-sync", "PolylineChildModel", function(IPolyline, $timeout, arraySync, PolylineChildModel) {
var Polyline, _ref;
return Polyline = (function(_super) {
__extends(Polyline, _super);
function Polyline() {
this.link = __bind(this.link, this);
_ref = Polyline.__super__.constructor.apply(this, arguments);
return _ref;
}
Polyline.prototype.link = function(scope, element, attrs, mapCtrl) {
var _this = this;
if (angular.isUndefined(scope.path) || scope.path === null || !this.validatePath(scope.path)) {
this.$log.error("polyline: no valid path attribute found");
return;
}
return $timeout(function() {
return new PolylineChildModel(scope, attrs, mapCtrl.getMap(), _this.DEFAULTS);
});
};
return Polyline;
})(IPolyline);
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("Polylines", [
"IPolyline", "$timeout", "array-sync", "PolylinesParentModel", function(IPolyline, $timeout, arraySync, PolylinesParentModel) {
var Polylines;
return Polylines = (function(_super) {
__extends(Polylines, _super);
function Polylines() {
this.link = __bind(this.link, this);
Polylines.__super__.constructor.call(this);
this.scope.idKey = '=idkey';
this.scope.models = '=models';
this.$log.info(this);
}
Polylines.prototype.link = function(scope, element, attrs, mapCtrl) {
var _this = this;
if (angular.isUndefined(scope.path) || scope.path === null) {
this.$log.error("polylines: no valid path attribute found");
return;
}
if (!scope.models) {
this.$log.error("polylines: no models found to create from");
return;
}
return $timeout(function() {
return new PolylinesParentModel(scope, element, attrs, mapCtrl.getMap(), _this.DEFAULTS);
});
};
return Polylines;
})(IPolyline);
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("Window", [
"IWindow", "GmapUtil", "WindowChildModel", function(IWindow, GmapUtil, WindowChildModel) {
var Window;
return Window = (function(_super) {
__extends(Window, _super);
Window.include(GmapUtil);
function Window($timeout, $compile, $http, $templateCache) {
this.link = __bind(this.link, this);
var self;
Window.__super__.constructor.call(this, $timeout, $compile, $http, $templateCache);
self = this;
this.require = ['^googleMap', '^?marker'];
this.template = '<span class="angular-google-maps-window" ng-transclude></span>';
this.$log.info(self);
}
Window.prototype.link = function(scope, element, attrs, ctrls) {
var _this = this;
return this.$timeout(function() {
var defaults, hasScopeCoords, isIconVisibleOnClick, mapCtrl, markerCtrl, markerScope, opts, window;
isIconVisibleOnClick = true;
if (angular.isDefined(attrs.isiconvisibleonclick)) {
isIconVisibleOnClick = scope.isIconVisibleOnClick;
}
mapCtrl = ctrls[0].getMap();
markerCtrl = ctrls.length > 1 && (ctrls[1] != null) ? ctrls[1].getMarkerScope().gMarker : void 0;
defaults = scope.options != null ? scope.options : {};
hasScopeCoords = (scope != null) && _this.validateCoords(scope.coords);
opts = hasScopeCoords ? _this.createWindowOptions(markerCtrl, scope, element.html(), defaults) : defaults;
if (mapCtrl != null) {
window = new WindowChildModel({}, scope, opts, isIconVisibleOnClick, mapCtrl, markerCtrl, element);
}
scope.$on("$destroy", function() {
return window.destroy();
});
if (ctrls[1] != null) {
markerScope = ctrls[1].getMarkerScope();
markerScope.$watch('coords', function(newValue, oldValue) {
if (!_this.validateCoords(newValue)) {
return window.hideWindow();
}
if (!angular.equals(newValue, oldValue)) {
return window.getLatestPosition();
}
}, true);
}
if ((_this.onChildCreation != null) && (window != null)) {
return _this.onChildCreation(window);
}
}, GmapUtil.defaultDelay + 25);
};
return Window;
})(IWindow);
}
]);
}).call(this);
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps.directives.api").factory("Windows", [
"IWindow", "WindowsParentModel", function(IWindow, WindowsParentModel) {
/*
Windows directive where many windows map to the models property
*/
var Windows;
return Windows = (function(_super) {
__extends(Windows, _super);
function Windows($timeout, $compile, $http, $templateCache, $interpolate) {
this.link = __bind(this.link, this);
var self;
Windows.__super__.constructor.call(this, $timeout, $compile, $http, $templateCache);
self = this;
this.$interpolate = $interpolate;
this.require = ['^googleMap', '^?markers'];
this.template = '<span class="angular-google-maps-windows" ng-transclude></span>';
this.scope.idKey = '=idkey';
this.scope.doRebuildAll = '=dorebuildall';
this.scope.models = '=models';
this.$log.info(this);
}
Windows.prototype.link = function(scope, element, attrs, ctrls) {
return new WindowsParentModel(scope, element, attrs, ctrls, this.$timeout, this.$compile, this.$http, this.$templateCache, this.$interpolate);
};
return Windows;
})(IWindow);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
Nick Baugh - https://github.com/niftylettuce
*/
(function() {
angular.module("google-maps").directive("googleMap", [
"Map", function(Map) {
return new Map();
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map marker directive
This directive is used to create a marker on an existing map.
This directive creates a new scope.
{attribute coords required} object containing latitude and longitude properties
{attribute icon optional} string url to image used for marker icon
{attribute animate optional} if set to false, the marker won't be animated (on by default)
*/
(function() {
angular.module("google-maps").directive("marker", [
"$timeout", "Marker", function($timeout, Marker) {
return new Marker($timeout);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map marker directive
This directive is used to create a marker on an existing map.
This directive creates a new scope.
{attribute coords required} object containing latitude and longitude properties
{attribute icon optional} string url to image used for marker icon
{attribute animate optional} if set to false, the marker won't be animated (on by default)
*/
(function() {
angular.module("google-maps").directive("markers", [
"$timeout", "Markers", function($timeout, Markers) {
return new Markers($timeout);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors Bruno Queiroz, creativelikeadog@gmail.com
*/
/*
Marker label directive
This directive is used to create a marker label on an existing map.
{attribute content required} content of the label
{attribute anchor required} string that contains the x and y point position of the label
{attribute class optional} class to DOM object
{attribute style optional} style for the label
*/
/*
Basic Directive api for a label. Basic in the sense that this directive contains 1:1 on scope and model.
Thus there will be one html element per marker within the directive.
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
angular.module("google-maps").directive("markerLabel", [
"$timeout", "ILabel", "MarkerLabelChildModel", "GmapUtil", function($timeout, ILabel, MarkerLabelChildModel, GmapUtil) {
var Label;
Label = (function(_super) {
__extends(Label, _super);
function Label($timeout) {
this.link = __bind(this.link, this);
var self;
Label.__super__.constructor.call(this, $timeout);
self = this;
this.require = '^marker';
this.template = '<span class="angular-google-maps-marker-label" ng-transclude></span>';
this.$log.info(this);
}
Label.prototype.link = function(scope, element, attrs, ctrl) {
var _this = this;
return this.$timeout(function() {
var label, markerCtrl;
markerCtrl = ctrl.getMarkerScope().gMarker;
if (markerCtrl != null) {
label = new MarkerLabelChildModel(markerCtrl, scope);
}
return scope.$on("$destroy", function() {
return label.destroy();
});
}, GmapUtil.defaultDelay + 25);
};
return Label;
})(ILabel);
return new Label($timeout);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
Rick Huizinga - https://plus.google.com/+RickHuizinga
*/
(function() {
angular.module("google-maps").directive("polygon", [
"$log", "$timeout", "array-sync", "GmapUtil", function($log, $timeout, arraySync, GmapUtil) {
/*
Check if a value is true
*/
var DEFAULTS, isTrue;
isTrue = function(val) {
return angular.isDefined(val) && val !== null && val === true || val === "1" || val === "y" || val === "true";
};
"use strict";
DEFAULTS = {};
return {
restrict: "ECA",
replace: true,
require: "^googleMap",
scope: {
path: "=path",
stroke: "=stroke",
clickable: "=",
draggable: "=",
editable: "=",
geodesic: "=",
fill: "=",
icons: "=icons",
visible: "=",
"static": "=",
events: "=",
zIndex: "=zindex",
fit: "="
},
link: function(scope, element, attrs, mapCtrl) {
if (angular.isUndefined(scope.path) || scope.path === null || !GmapUtil.validatePath(scope.path)) {
$log.error("polygon: no valid path attribute found");
return;
}
return $timeout(function() {
var arraySyncer, buildOpts, eventName, getEventHandler, map, pathPoints, polygon;
buildOpts = function(pathPoints) {
var opts;
opts = angular.extend({}, DEFAULTS, {
map: map,
path: pathPoints,
strokeColor: scope.stroke && scope.stroke.color,
strokeOpacity: scope.stroke && scope.stroke.opacity,
strokeWeight: scope.stroke && scope.stroke.weight,
fillColor: scope.fill && scope.fill.color,
fillOpacity: scope.fill && scope.fill.opacity
});
angular.forEach({
clickable: true,
draggable: false,
editable: false,
geodesic: false,
visible: true,
"static": false,
fit: false,
zIndex: 0
}, function(defaultValue, key) {
if (angular.isUndefined(scope[key]) || scope[key] === null) {
return opts[key] = defaultValue;
} else {
return opts[key] = scope[key];
}
});
if (opts["static"]) {
opts.editable = false;
}
return opts;
};
map = mapCtrl.getMap();
pathPoints = GmapUtil.convertPathPoints(scope.path);
polygon = new google.maps.Polygon(buildOpts(pathPoints));
if (scope.fit) {
GmapUtil.extendMapBounds(map, pathPoints);
}
if (!scope["static"] && angular.isDefined(scope.editable)) {
scope.$watch("editable", function(newValue, oldValue) {
if (newValue !== oldValue) {
return polygon.setEditable(newValue);
}
});
}
if (angular.isDefined(scope.draggable)) {
scope.$watch("draggable", function(newValue, oldValue) {
if (newValue !== oldValue) {
return polygon.setDraggable(newValue);
}
});
}
if (angular.isDefined(scope.visible)) {
scope.$watch("visible", function(newValue, oldValue) {
if (newValue !== oldValue) {
return polygon.setVisible(newValue);
}
});
}
if (angular.isDefined(scope.geodesic)) {
scope.$watch("geodesic", function(newValue, oldValue) {
if (newValue !== oldValue) {
return polygon.setOptions(buildOpts(polygon.getPath()));
}
});
}
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.opacity)) {
scope.$watch("stroke.opacity", function(newValue, oldValue) {
return polygon.setOptions(buildOpts(polygon.getPath()));
});
}
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.weight)) {
scope.$watch("stroke.weight", function(newValue, oldValue) {
if (newValue !== oldValue) {
return polygon.setOptions(buildOpts(polygon.getPath()));
}
});
}
if (angular.isDefined(scope.stroke) && angular.isDefined(scope.stroke.color)) {
scope.$watch("stroke.color", function(newValue, oldValue) {
if (newValue !== oldValue) {
return polygon.setOptions(buildOpts(polygon.getPath()));
}
});
}
if (angular.isDefined(scope.fill) && angular.isDefined(scope.fill.color)) {
scope.$watch("fill.color", function(newValue, oldValue) {
if (newValue !== oldValue) {
return polygon.setOptions(buildOpts(polygon.getPath()));
}
});
}
if (angular.isDefined(scope.fill) && angular.isDefined(scope.fill.opacity)) {
scope.$watch("fill.opacity", function(newValue, oldValue) {
if (newValue !== oldValue) {
return polygon.setOptions(buildOpts(polygon.getPath()));
}
});
}
if (angular.isDefined(scope.zIndex)) {
scope.$watch("zIndex", function(newValue, oldValue) {
if (newValue !== oldValue) {
return polygon.setOptions(buildOpts(polygon.getPath()));
}
});
}
if (angular.isDefined(scope.events) && scope.events !== null && angular.isObject(scope.events)) {
getEventHandler = function(eventName) {
return function() {
return scope.events[eventName].apply(scope, [polygon, eventName, arguments]);
};
};
for (eventName in scope.events) {
if (scope.events.hasOwnProperty(eventName) && angular.isFunction(scope.events[eventName])) {
polygon.addListener(eventName, getEventHandler(eventName));
}
}
}
arraySyncer = arraySync(polygon.getPath(), scope, "path", function(pathPoints) {
if (scope.fit) {
return GmapUtil.extendMapBounds(map, pathPoints);
}
});
return scope.$on("$destroy", function() {
polygon.setMap(null);
if (arraySyncer) {
arraySyncer();
return arraySyncer = null;
}
});
});
}
};
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
@authors
Julian Popescu - https://github.com/jpopesculian
Rick Huizinga - https://plus.google.com/+RickHuizinga
*/
(function() {
angular.module("google-maps").directive("circle", [
"$log", "$timeout", "GmapUtil", "EventsHelper", function($log, $timeout, GmapUtil, EventsHelper) {
"use strict";
var DEFAULTS;
DEFAULTS = {};
return {
restrict: "ECA",
replace: true,
require: "^googleMap",
scope: {
center: "=center",
radius: "=radius",
stroke: "=stroke",
fill: "=fill",
clickable: "=",
draggable: "=",
editable: "=",
geodesic: "=",
icons: "=icons",
visible: "=",
events: "="
},
link: function(scope, element, attrs, mapCtrl) {
return $timeout(function() {
var buildOpts, circle, map;
buildOpts = function() {
var opts;
if (!GmapUtil.validateCoords(scope.center)) {
$log.error("circle: no valid center attribute found");
return;
}
opts = angular.extend({}, DEFAULTS, {
map: map,
center: GmapUtil.getCoords(scope.center),
radius: scope.radius,
strokeColor: scope.stroke && scope.stroke.color,
strokeOpacity: scope.stroke && scope.stroke.opacity,
strokeWeight: scope.stroke && scope.stroke.weight,
fillColor: scope.fill && scope.fill.color,
fillOpacity: scope.fill && scope.fill.opacity
});
angular.forEach({
clickable: true,
draggable: false,
editable: false,
geodesic: false,
visible: true
}, function(defaultValue, key) {
if (angular.isUndefined(scope[key]) || scope[key] === null) {
return opts[key] = defaultValue;
} else {
return opts[key] = scope[key];
}
});
return opts;
};
map = mapCtrl.getMap();
circle = new google.maps.Circle(buildOpts());
scope.$watchCollection('center', function(newVals, oldVals) {
if (newVals !== oldVals) {
return circle.setOptions(buildOpts());
}
});
scope.$watchCollection('stroke', function(newVals, oldVals) {
if (newVals !== oldVals) {
return circle.setOptions(buildOpts());
}
});
scope.$watchCollection('fill', function(newVals, oldVals) {
if (newVals !== oldVals) {
return circle.setOptions(buildOpts());
}
});
scope.$watch('radius', function(newVal, oldVal) {
if (newVal !== oldVal) {
return circle.setOptions(buildOpts());
}
});
scope.$watch('clickable', function(newVal, oldVal) {
if (newVal !== oldVal) {
return circle.setOptions(buildOpts());
}
});
scope.$watch('editable', function(newVal, oldVal) {
if (newVal !== oldVal) {
return circle.setOptions(buildOpts());
}
});
scope.$watch('draggable', function(newVal, oldVal) {
if (newVal !== oldVal) {
return circle.setOptions(buildOpts());
}
});
scope.$watch('visible', function(newVal, oldVal) {
if (newVal !== oldVal) {
return circle.setOptions(buildOpts());
}
});
scope.$watch('geodesic', function(newVal, oldVal) {
if (newVal !== oldVal) {
return circle.setOptions(buildOpts());
}
});
EventsHelper.setEvents(circle, scope, scope);
google.maps.event.addListener(circle, 'radius_changed', function() {
scope.radius = circle.getRadius();
return $timeout(function() {
return scope.$apply();
});
});
google.maps.event.addListener(circle, 'center_changed', function() {
if (angular.isDefined(scope.center.type)) {
scope.center.coordinates[1] = circle.getCenter().lat();
scope.center.coordinates[0] = circle.getCenter().lng();
} else {
scope.center.latitude = circle.getCenter().lat();
scope.center.longitude = circle.getCenter().lng();
}
return $timeout(function() {
return scope.$apply();
});
});
return scope.$on("$destroy", function() {
return circle.setMap(null);
});
});
}
};
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
(function() {
angular.module("google-maps").directive("polyline", [
"Polyline", function(Polyline) {
return new Polyline();
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
(function() {
angular.module("google-maps").directive("polylines", [
"Polylines", function(Polylines) {
return new Polylines();
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
Chentsu Lin - https://github.com/ChenTsuLin
*/
(function() {
angular.module("google-maps").directive("rectangle", [
"$log", "$timeout", function($log, $timeout) {
var DEFAULTS, convertBoundPoints, fitMapBounds, isTrue, validateBoundPoints;
validateBoundPoints = function(bounds) {
if (angular.isUndefined(bounds.sw.latitude) || angular.isUndefined(bounds.sw.longitude) || angular.isUndefined(bounds.ne.latitude) || angular.isUndefined(bounds.ne.longitude)) {
return false;
}
return true;
};
convertBoundPoints = function(bounds) {
var result;
result = new google.maps.LatLngBounds(new google.maps.LatLng(bounds.sw.latitude, bounds.sw.longitude), new google.maps.LatLng(bounds.ne.latitude, bounds.ne.longitude));
return result;
};
fitMapBounds = function(map, bounds) {
return map.fitBounds(bounds);
};
/*
Check if a value is true
*/
isTrue = function(val) {
return angular.isDefined(val) && val !== null && val === true || val === "1" || val === "y" || val === "true";
};
"use strict";
DEFAULTS = {};
return {
restrict: "ECA",
require: "^googleMap",
replace: true,
scope: {
bounds: "=",
stroke: "=",
clickable: "=",
draggable: "=",
editable: "=",
fill: "=",
visible: "="
},
link: function(scope, element, attrs, mapCtrl) {
if (angular.isUndefined(scope.bounds) || scope.bounds === null || angular.isUndefined(scope.bounds.sw) || scope.bounds.sw === null || angular.isUndefined(scope.bounds.ne) || scope.bounds.ne === null || !validateBoundPoints(scope.bounds)) {
$log.error("rectangle: no valid bound attribute found");
return;
}
return $timeout(function() {
var buildOpts, dragging, map, rectangle, settingBoundsFromScope;
buildOpts = function(bounds) {
var opts;
opts = angular.extend({}, DEFAULTS, {
map: map,
bounds: bounds,
strokeColor: scope.stroke && scope.stroke.color,
strokeOpacity: scope.stroke && scope.stroke.opacity,
strokeWeight: scope.stroke && scope.stroke.weight,
fillColor: scope.fill && scope.fill.color,
fillOpacity: scope.fill && scope.fill.opacity
});
angular.forEach({
clickable: true,
draggable: false,
editable: false,
visible: true
}, function(defaultValue, key) {
if (angular.isUndefined(scope[key]) || scope[key] === null) {
return opts[key] = defaultValue;
} else {
return opts[key] = scope[key];
}
});
return opts;
};
map = mapCtrl.getMap();
rectangle = new google.maps.Rectangle(buildOpts(convertBoundPoints(scope.bounds)));
if (isTrue(attrs.fit)) {
fitMapBounds(map, bounds);
}
dragging = false;
google.maps.event.addListener(rectangle, "mousedown", function() {
google.maps.event.addListener(rectangle, "mousemove", function() {
dragging = true;
return _.defer(function() {
return scope.$apply(function(s) {
if (s.dragging != null) {
return s.dragging = dragging;
}
});
});
});
google.maps.event.addListener(rectangle, "mouseup", function() {
google.maps.event.clearListeners(rectangle, 'mousemove');
google.maps.event.clearListeners(rectangle, 'mouseup');
dragging = false;
return _.defer(function() {
return scope.$apply(function(s) {
if (s.dragging != null) {
return s.dragging = dragging;
}
});
});
});
});
settingBoundsFromScope = false;
google.maps.event.addListener(rectangle, "bounds_changed", function() {
var b, ne, sw;
b = rectangle.getBounds();
ne = b.getNorthEast();
sw = b.getSouthWest();
if (settingBoundsFromScope) {
return;
}
return _.defer(function() {
return scope.$apply(function(s) {
if (!rectangle.dragging) {
if (s.bounds !== null && s.bounds !== undefined && s.bounds !== void 0) {
s.bounds.ne = {
latitude: ne.lat(),
longitude: ne.lng()
};
s.bounds.sw = {
latitude: sw.lat(),
longitude: sw.lng()
};
}
}
});
});
});
scope.$watch("bounds", (function(newValue, oldValue) {
var bounds;
if (_.isEqual(newValue, oldValue)) {
return;
}
settingBoundsFromScope = true;
if (!dragging) {
if ((newValue.sw.latitude == null) || (newValue.sw.longitude == null) || (newValue.ne.latitude == null) || (newValue.ne.longitude == null)) {
$log.error("Invalid bounds for newValue: " + (JSON.stringify(newValue)));
}
bounds = new google.maps.LatLngBounds(new google.maps.LatLng(newValue.sw.latitude, newValue.sw.longitude), new google.maps.LatLng(newValue.ne.latitude, newValue.ne.longitude));
rectangle.setBounds(bounds);
}
return settingBoundsFromScope = false;
}), true);
if (angular.isDefined(scope.editable)) {
scope.$watch("editable", function(newValue, oldValue) {
return rectangle.setEditable(newValue);
});
}
if (angular.isDefined(scope.draggable)) {
scope.$watch("draggable", function(newValue, oldValue) {
return rectangle.setDraggable(newValue);
});
}
if (angular.isDefined(scope.visible)) {
scope.$watch("visible", function(newValue, oldValue) {
return rectangle.setVisible(newValue);
});
}
if (angular.isDefined(scope.stroke)) {
if (angular.isDefined(scope.stroke.color)) {
scope.$watch("stroke.color", function(newValue, oldValue) {
return rectangle.setOptions(buildOpts(rectangle.getBounds()));
});
}
if (angular.isDefined(scope.stroke.weight)) {
scope.$watch("stroke.weight", function(newValue, oldValue) {
return rectangle.setOptions(buildOpts(rectangle.getBounds()));
});
}
if (angular.isDefined(scope.stroke.opacity)) {
scope.$watch("stroke.opacity", function(newValue, oldValue) {
return rectangle.setOptions(buildOpts(rectangle.getBounds()));
});
}
}
if (angular.isDefined(scope.fill)) {
if (angular.isDefined(scope.fill.color)) {
scope.$watch("fill.color", function(newValue, oldValue) {
return rectangle.setOptions(buildOpts(rectangle.getBounds()));
});
}
if (angular.isDefined(scope.fill.opacity)) {
scope.$watch("fill.opacity", function(newValue, oldValue) {
return rectangle.setOptions(buildOpts(rectangle.getBounds()));
});
}
}
return scope.$on("$destroy", function() {
return rectangle.setMap(null);
});
});
}
};
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map info window directive
This directive is used to create an info window on an existing map.
This directive creates a new scope.
{attribute coords required} object containing latitude and longitude properties
{attribute show optional} map will show when this expression returns true
*/
(function() {
angular.module("google-maps").directive("window", [
"$timeout", "$compile", "$http", "$templateCache", "Window", function($timeout, $compile, $http, $templateCache, Window) {
return new Window($timeout, $compile, $http, $templateCache);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors
Nicolas Laplante - https://plus.google.com/108189012221374960701
Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map info window directive
This directive is used to create an info window on an existing map.
This directive creates a new scope.
{attribute coords required} object containing latitude and longitude properties
{attribute show optional} map will show when this expression returns true
*/
(function() {
angular.module("google-maps").directive("windows", [
"$timeout", "$compile", "$http", "$templateCache", "$interpolate", "Windows", function($timeout, $compile, $http, $templateCache, $interpolate, Windows) {
return new Windows($timeout, $compile, $http, $templateCache, $interpolate);
}
]);
}).call(this);
/*
!
The MIT License
Copyright (c) 2010-2013 Google, Inc. http://angularjs.org
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.
angular-google-maps
https://github.com/nlaplante/angular-google-maps
@authors:
- Nicolas Laplante https://plus.google.com/108189012221374960701
- Nicholas McCready - https://twitter.com/nmccready
*/
/*
Map Layer directive
This directive is used to create any type of Layer from the google maps sdk.
This directive creates a new scope.
{attribute show optional} true (default) shows the trafficlayer otherwise it is hidden
*/
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
angular.module("google-maps").directive("layer", [
"$timeout", "Logger", "LayerParentModel", function($timeout, Logger, LayerParentModel) {
var Layer;
Layer = (function() {
function Layer($timeout) {
this.$timeout = $timeout;
this.link = __bind(this.link, this);
this.$log = Logger;
this.restrict = "ECMA";
this.require = "^googleMap";
this.priority = -1;
this.transclude = true;
this.template = '<span class=\"angular-google-map-layer\" ng-transclude></span>';
this.replace = true;
this.scope = {
show: "=show",
type: "=type",
namespace: "=namespace",
options: '=options',
onCreated: '&oncreated'
};
}
Layer.prototype.link = function(scope, element, attrs, mapCtrl) {
if (attrs.oncreated != null) {
return new LayerParentModel(scope, element, attrs, mapCtrl, this.$timeout, scope.onCreated);
} else {
return new LayerParentModel(scope, element, attrs, mapCtrl, this.$timeout);
}
};
return Layer;
})();
return new Layer($timeout);
}
]);
}).call(this);
;/**
* @name InfoBox
* @version 1.1.12 [December 11, 2012]
* @author Gary Little (inspired by proof-of-concept code from Pamela Fox of Google)
* @copyright Copyright 2010 Gary Little [gary at luxcentral.com]
* @fileoverview InfoBox extends the Google Maps JavaScript API V3 <tt>OverlayView</tt> class.
* <p>
* An InfoBox behaves like a <tt>google.maps.InfoWindow</tt>, but it supports several
* additional properties for advanced styling. An InfoBox can also be used as a map label.
* <p>
* An InfoBox also fires the same events as a <tt>google.maps.InfoWindow</tt>.
*/
/*!
*
* 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.
*/
/*jslint browser:true */
/*global google */
/**
* @name InfoBoxOptions
* @class This class represents the optional parameter passed to the {@link InfoBox} constructor.
* @property {string|Node} content The content of the InfoBox (plain text or an HTML DOM node).
* @property {boolean} [disableAutoPan=false] Disable auto-pan on <tt>open</tt>.
* @property {number} maxWidth The maximum width (in pixels) of the InfoBox. Set to 0 if no maximum.
* @property {Size} pixelOffset The offset (in pixels) from the top left corner of the InfoBox
* (or the bottom left corner if the <code>alignBottom</code> property is <code>true</code>)
* to the map pixel corresponding to <tt>position</tt>.
* @property {LatLng} position The geographic location at which to display the InfoBox.
* @property {number} zIndex The CSS z-index style value for the InfoBox.
* Note: This value overrides a zIndex setting specified in the <tt>boxStyle</tt> property.
* @property {string} [boxClass="infoBox"] The name of the CSS class defining the styles for the InfoBox container.
* @property {Object} [boxStyle] An object literal whose properties define specific CSS
* style values to be applied to the InfoBox. Style values defined here override those that may
* be defined in the <code>boxClass</code> style sheet. If this property is changed after the
* InfoBox has been created, all previously set styles (except those defined in the style sheet)
* are removed from the InfoBox before the new style values are applied.
* @property {string} closeBoxMargin The CSS margin style value for the close box.
* The default is "2px" (a 2-pixel margin on all sides).
* @property {string} closeBoxURL The URL of the image representing the close box.
* Note: The default is the URL for Google's standard close box.
* Set this property to "" if no close box is required.
* @property {Size} infoBoxClearance Minimum offset (in pixels) from the InfoBox to the
* map edge after an auto-pan.
* @property {boolean} [isHidden=false] Hide the InfoBox on <tt>open</tt>.
* [Deprecated in favor of the <tt>visible</tt> property.]
* @property {boolean} [visible=true] Show the InfoBox on <tt>open</tt>.
* @property {boolean} alignBottom Align the bottom left corner of the InfoBox to the <code>position</code>
* location (default is <tt>false</tt> which means that the top left corner of the InfoBox is aligned).
* @property {string} pane The pane where the InfoBox is to appear (default is "floatPane").
* Set the pane to "mapPane" if the InfoBox is being used as a map label.
* Valid pane names are the property names for the <tt>google.maps.MapPanes</tt> object.
* @property {boolean} enableEventPropagation Propagate mousedown, mousemove, mouseover, mouseout,
* mouseup, click, dblclick, touchstart, touchend, touchmove, and contextmenu events in the InfoBox
* (default is <tt>false</tt> to mimic the behavior of a <tt>google.maps.InfoWindow</tt>). Set
* this property to <tt>true</tt> if the InfoBox is being used as a map label.
*/
/**
* Creates an InfoBox with the options specified in {@link InfoBoxOptions}.
* Call <tt>InfoBox.open</tt> to add the box to the map.
* @constructor
* @param {InfoBoxOptions} [opt_opts]
*/
function InfoBox(opt_opts) {
opt_opts = opt_opts || {};
google.maps.OverlayView.apply(this, arguments);
// Standard options (in common with google.maps.InfoWindow):
//
this.content_ = opt_opts.content || "";
this.disableAutoPan_ = opt_opts.disableAutoPan || false;
this.maxWidth_ = opt_opts.maxWidth || 0;
this.pixelOffset_ = opt_opts.pixelOffset || new google.maps.Size(0, 0);
this.position_ = opt_opts.position || new google.maps.LatLng(0, 0);
this.zIndex_ = opt_opts.zIndex || null;
// Additional options (unique to InfoBox):
//
this.boxClass_ = opt_opts.boxClass || "infoBox";
this.boxStyle_ = opt_opts.boxStyle || {};
this.closeBoxMargin_ = opt_opts.closeBoxMargin || "2px";
this.closeBoxURL_ = opt_opts.closeBoxURL || "http://www.google.com/intl/en_us/mapfiles/close.gif";
if (opt_opts.closeBoxURL === "") {
this.closeBoxURL_ = "";
}
this.infoBoxClearance_ = opt_opts.infoBoxClearance || new google.maps.Size(1, 1);
if (typeof opt_opts.visible === "undefined") {
if (typeof opt_opts.isHidden === "undefined") {
opt_opts.visible = true;
} else {
opt_opts.visible = !opt_opts.isHidden;
}
}
this.isHidden_ = !opt_opts.visible;
this.alignBottom_ = opt_opts.alignBottom || false;
this.pane_ = opt_opts.pane || "floatPane";
this.enableEventPropagation_ = opt_opts.enableEventPropagation || false;
this.div_ = null;
this.closeListener_ = null;
this.moveListener_ = null;
this.contextListener_ = null;
this.eventListeners_ = null;
this.fixedWidthSet_ = null;
}
/* InfoBox extends OverlayView in the Google Maps API v3.
*/
InfoBox.prototype = new google.maps.OverlayView();
/**
* Creates the DIV representing the InfoBox.
* @private
*/
InfoBox.prototype.createInfoBoxDiv_ = function () {
var i;
var events;
var bw;
var me = this;
// This handler prevents an event in the InfoBox from being passed on to the map.
//
var cancelHandler = function (e) {
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
};
// This handler ignores the current event in the InfoBox and conditionally prevents
// the event from being passed on to the map. It is used for the contextmenu event.
//
var ignoreHandler = function (e) {
e.returnValue = false;
if (e.preventDefault) {
e.preventDefault();
}
if (!me.enableEventPropagation_) {
cancelHandler(e);
}
};
if (!this.div_) {
this.div_ = document.createElement("div");
this.setBoxStyle_();
if (typeof this.content_.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + this.content_;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(this.content_);
}
// Add the InfoBox DIV to the DOM
this.getPanes()[this.pane_].appendChild(this.div_);
this.addClickHandler_();
if (this.div_.style.width) {
this.fixedWidthSet_ = true;
} else {
if (this.maxWidth_ !== 0 && this.div_.offsetWidth > this.maxWidth_) {
this.div_.style.width = this.maxWidth_;
this.div_.style.overflow = "auto";
this.fixedWidthSet_ = true;
} else { // The following code is needed to overcome problems with MSIE
bw = this.getBoxWidths_();
this.div_.style.width = (this.div_.offsetWidth - bw.left - bw.right) + "px";
this.fixedWidthSet_ = false;
}
}
this.panBox_(this.disableAutoPan_);
if (!this.enableEventPropagation_) {
this.eventListeners_ = [];
// Cancel event propagation.
//
// Note: mousemove not included (to resolve Issue 152)
events = ["mousedown", "mouseover", "mouseout", "mouseup",
"click", "dblclick", "touchstart", "touchend", "touchmove"];
for (i = 0; i < events.length; i++) {
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, events[i], cancelHandler));
}
// Workaround for Google bug that causes the cursor to change to a pointer
// when the mouse moves over a marker underneath InfoBox.
this.eventListeners_.push(google.maps.event.addDomListener(this.div_, "mouseover", function (e) {
this.style.cursor = "default";
}));
}
this.contextListener_ = google.maps.event.addDomListener(this.div_, "contextmenu", ignoreHandler);
/**
* This event is fired when the DIV containing the InfoBox's content is attached to the DOM.
* @name InfoBox#domready
* @event
*/
google.maps.event.trigger(this, "domready");
}
};
/**
* Returns the HTML <IMG> tag for the close box.
* @private
*/
InfoBox.prototype.getCloseBoxImg_ = function () {
var img = "";
if (this.closeBoxURL_ !== "") {
img = "<img";
img += " src='" + this.closeBoxURL_ + "'";
img += " align=right"; // Do this because Opera chokes on style='float: right;'
img += " style='";
img += " position: relative;"; // Required by MSIE
img += " cursor: pointer;";
img += " margin: " + this.closeBoxMargin_ + ";";
img += "'>";
}
return img;
};
/**
* Adds the click handler to the InfoBox close box.
* @private
*/
InfoBox.prototype.addClickHandler_ = function () {
var closeBox;
if (this.closeBoxURL_ !== "") {
closeBox = this.div_.firstChild;
this.closeListener_ = google.maps.event.addDomListener(closeBox, "click", this.getCloseClickHandler_());
} else {
this.closeListener_ = null;
}
};
/**
* Returns the function to call when the user clicks the close box of an InfoBox.
* @private
*/
InfoBox.prototype.getCloseClickHandler_ = function () {
var me = this;
return function (e) {
// 1.0.3 fix: Always prevent propagation of a close box click to the map:
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
/**
* This event is fired when the InfoBox's close box is clicked.
* @name InfoBox#closeclick
* @event
*/
google.maps.event.trigger(me, "closeclick");
me.close();
};
};
/**
* Pans the map so that the InfoBox appears entirely within the map's visible area.
* @private
*/
InfoBox.prototype.panBox_ = function (disablePan) {
var map;
var bounds;
var xOffset = 0, yOffset = 0;
if (!disablePan) {
map = this.getMap();
if (map instanceof google.maps.Map) { // Only pan if attached to map, not panorama
if (!map.getBounds().contains(this.position_)) {
// Marker not in visible area of map, so set center
// of map to the marker position first.
map.setCenter(this.position_);
}
bounds = map.getBounds();
var mapDiv = map.getDiv();
var mapWidth = mapDiv.offsetWidth;
var mapHeight = mapDiv.offsetHeight;
var iwOffsetX = this.pixelOffset_.width;
var iwOffsetY = this.pixelOffset_.height;
var iwWidth = this.div_.offsetWidth;
var iwHeight = this.div_.offsetHeight;
var padX = this.infoBoxClearance_.width;
var padY = this.infoBoxClearance_.height;
var pixPosition = this.getProjection().fromLatLngToContainerPixel(this.position_);
if (pixPosition.x < (-iwOffsetX + padX)) {
xOffset = pixPosition.x + iwOffsetX - padX;
} else if ((pixPosition.x + iwWidth + iwOffsetX + padX) > mapWidth) {
xOffset = pixPosition.x + iwWidth + iwOffsetX + padX - mapWidth;
}
if (this.alignBottom_) {
if (pixPosition.y < (-iwOffsetY + padY + iwHeight)) {
yOffset = pixPosition.y + iwOffsetY - padY - iwHeight;
} else if ((pixPosition.y + iwOffsetY + padY) > mapHeight) {
yOffset = pixPosition.y + iwOffsetY + padY - mapHeight;
}
} else {
if (pixPosition.y < (-iwOffsetY + padY)) {
yOffset = pixPosition.y + iwOffsetY - padY;
} else if ((pixPosition.y + iwHeight + iwOffsetY + padY) > mapHeight) {
yOffset = pixPosition.y + iwHeight + iwOffsetY + padY - mapHeight;
}
}
if (!(xOffset === 0 && yOffset === 0)) {
// Move the map to the shifted center.
//
var c = map.getCenter();
map.panBy(xOffset, yOffset);
}
}
}
};
/**
* Sets the style of the InfoBox by setting the style sheet and applying
* other specific styles requested.
* @private
*/
InfoBox.prototype.setBoxStyle_ = function () {
var i, boxStyle;
if (this.div_) {
// Apply style values from the style sheet defined in the boxClass parameter:
this.div_.className = this.boxClass_;
// Clear existing inline style values:
this.div_.style.cssText = "";
// Apply style values defined in the boxStyle parameter:
boxStyle = this.boxStyle_;
for (i in boxStyle) {
if (boxStyle.hasOwnProperty(i)) {
this.div_.style[i] = boxStyle[i];
}
}
// Fix up opacity style for benefit of MSIE:
//
if (typeof this.div_.style.opacity !== "undefined" && this.div_.style.opacity !== "") {
this.div_.style.filter = "alpha(opacity=" + (this.div_.style.opacity * 100) + ")";
}
// Apply required styles:
//
this.div_.style.position = "absolute";
this.div_.style.visibility = 'hidden';
if (this.zIndex_ !== null) {
this.div_.style.zIndex = this.zIndex_;
}
}
};
/**
* Get the widths of the borders of the InfoBox.
* @private
* @return {Object} widths object (top, bottom left, right)
*/
InfoBox.prototype.getBoxWidths_ = function () {
var computedStyle;
var bw = {top: 0, bottom: 0, left: 0, right: 0};
var box = this.div_;
if (document.defaultView && document.defaultView.getComputedStyle) {
computedStyle = box.ownerDocument.defaultView.getComputedStyle(box, "");
if (computedStyle) {
// The computed styles are always in pixel units (good!)
bw.top = parseInt(computedStyle.borderTopWidth, 10) || 0;
bw.bottom = parseInt(computedStyle.borderBottomWidth, 10) || 0;
bw.left = parseInt(computedStyle.borderLeftWidth, 10) || 0;
bw.right = parseInt(computedStyle.borderRightWidth, 10) || 0;
}
} else if (document.documentElement.currentStyle) { // MSIE
if (box.currentStyle) {
// The current styles may not be in pixel units, but assume they are (bad!)
bw.top = parseInt(box.currentStyle.borderTopWidth, 10) || 0;
bw.bottom = parseInt(box.currentStyle.borderBottomWidth, 10) || 0;
bw.left = parseInt(box.currentStyle.borderLeftWidth, 10) || 0;
bw.right = parseInt(box.currentStyle.borderRightWidth, 10) || 0;
}
}
return bw;
};
/**
* Invoked when <tt>close</tt> is called. Do not call it directly.
*/
InfoBox.prototype.onRemove = function () {
if (this.div_) {
this.div_.parentNode.removeChild(this.div_);
this.div_ = null;
}
};
/**
* Draws the InfoBox based on the current map projection and zoom level.
*/
InfoBox.prototype.draw = function () {
this.createInfoBoxDiv_();
var pixPosition = this.getProjection().fromLatLngToDivPixel(this.position_);
this.div_.style.left = (pixPosition.x + this.pixelOffset_.width) + "px";
if (this.alignBottom_) {
this.div_.style.bottom = -(pixPosition.y + this.pixelOffset_.height) + "px";
} else {
this.div_.style.top = (pixPosition.y + this.pixelOffset_.height) + "px";
}
if (this.isHidden_) {
this.div_.style.visibility = 'hidden';
} else {
this.div_.style.visibility = "visible";
}
};
/**
* Sets the options for the InfoBox. Note that changes to the <tt>maxWidth</tt>,
* <tt>closeBoxMargin</tt>, <tt>closeBoxURL</tt>, and <tt>enableEventPropagation</tt>
* properties have no affect until the current InfoBox is <tt>close</tt>d and a new one
* is <tt>open</tt>ed.
* @param {InfoBoxOptions} opt_opts
*/
InfoBox.prototype.setOptions = function (opt_opts) {
if (typeof opt_opts.boxClass !== "undefined") { // Must be first
this.boxClass_ = opt_opts.boxClass;
this.setBoxStyle_();
}
if (typeof opt_opts.boxStyle !== "undefined") { // Must be second
this.boxStyle_ = opt_opts.boxStyle;
this.setBoxStyle_();
}
if (typeof opt_opts.content !== "undefined") {
this.setContent(opt_opts.content);
}
if (typeof opt_opts.disableAutoPan !== "undefined") {
this.disableAutoPan_ = opt_opts.disableAutoPan;
}
if (typeof opt_opts.maxWidth !== "undefined") {
this.maxWidth_ = opt_opts.maxWidth;
}
if (typeof opt_opts.pixelOffset !== "undefined") {
this.pixelOffset_ = opt_opts.pixelOffset;
}
if (typeof opt_opts.alignBottom !== "undefined") {
this.alignBottom_ = opt_opts.alignBottom;
}
if (typeof opt_opts.position !== "undefined") {
this.setPosition(opt_opts.position);
}
if (typeof opt_opts.zIndex !== "undefined") {
this.setZIndex(opt_opts.zIndex);
}
if (typeof opt_opts.closeBoxMargin !== "undefined") {
this.closeBoxMargin_ = opt_opts.closeBoxMargin;
}
if (typeof opt_opts.closeBoxURL !== "undefined") {
this.closeBoxURL_ = opt_opts.closeBoxURL;
}
if (typeof opt_opts.infoBoxClearance !== "undefined") {
this.infoBoxClearance_ = opt_opts.infoBoxClearance;
}
if (typeof opt_opts.isHidden !== "undefined") {
this.isHidden_ = opt_opts.isHidden;
}
if (typeof opt_opts.visible !== "undefined") {
this.isHidden_ = !opt_opts.visible;
}
if (typeof opt_opts.enableEventPropagation !== "undefined") {
this.enableEventPropagation_ = opt_opts.enableEventPropagation;
}
if (this.div_) {
this.draw();
}
};
/**
* Sets the content of the InfoBox.
* The content can be plain text or an HTML DOM node.
* @param {string|Node} content
*/
InfoBox.prototype.setContent = function (content) {
this.content_ = content;
if (this.div_) {
if (this.closeListener_) {
google.maps.event.removeListener(this.closeListener_);
this.closeListener_ = null;
}
// Odd code required to make things work with MSIE.
//
if (!this.fixedWidthSet_) {
this.div_.style.width = "";
}
if (typeof content.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + content;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(content);
}
// Perverse code required to make things work with MSIE.
// (Ensures the close box does, in fact, float to the right.)
//
if (!this.fixedWidthSet_) {
this.div_.style.width = this.div_.offsetWidth + "px";
if (typeof content.nodeType === "undefined") {
this.div_.innerHTML = this.getCloseBoxImg_() + content;
} else {
this.div_.innerHTML = this.getCloseBoxImg_();
this.div_.appendChild(content);
}
}
this.addClickHandler_();
}
/**
* This event is fired when the content of the InfoBox changes.
* @name InfoBox#content_changed
* @event
*/
google.maps.event.trigger(this, "content_changed");
};
/**
* Sets the geographic location of the InfoBox.
* @param {LatLng} latlng
*/
InfoBox.prototype.setPosition = function (latlng) {
this.position_ = latlng;
if (this.div_) {
this.draw();
}
/**
* This event is fired when the position of the InfoBox changes.
* @name InfoBox#position_changed
* @event
*/
google.maps.event.trigger(this, "position_changed");
};
/**
* Sets the zIndex style for the InfoBox.
* @param {number} index
*/
InfoBox.prototype.setZIndex = function (index) {
this.zIndex_ = index;
if (this.div_) {
this.div_.style.zIndex = index;
}
/**
* This event is fired when the zIndex of the InfoBox changes.
* @name InfoBox#zindex_changed
* @event
*/
google.maps.event.trigger(this, "zindex_changed");
};
/**
* Sets the visibility of the InfoBox.
* @param {boolean} isVisible
*/
InfoBox.prototype.setVisible = function (isVisible) {
this.isHidden_ = !isVisible;
if (this.div_) {
this.div_.style.visibility = (this.isHidden_ ? "hidden" : "visible");
}
};
/**
* Returns the content of the InfoBox.
* @returns {string}
*/
InfoBox.prototype.getContent = function () {
return this.content_;
};
/**
* Returns the geographic location of the InfoBox.
* @returns {LatLng}
*/
InfoBox.prototype.getPosition = function () {
return this.position_;
};
/**
* Returns the zIndex for the InfoBox.
* @returns {number}
*/
InfoBox.prototype.getZIndex = function () {
return this.zIndex_;
};
/**
* Returns a flag indicating whether the InfoBox is visible.
* @returns {boolean}
*/
InfoBox.prototype.getVisible = function () {
var isVisible;
if ((typeof this.getMap() === "undefined") || (this.getMap() === null)) {
isVisible = false;
} else {
isVisible = !this.isHidden_;
}
return isVisible;
};
/**
* Shows the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
*/
InfoBox.prototype.show = function () {
this.isHidden_ = false;
if (this.div_) {
this.div_.style.visibility = "visible";
}
};
/**
* Hides the InfoBox. [Deprecated; use <tt>setVisible</tt> instead.]
*/
InfoBox.prototype.hide = function () {
this.isHidden_ = true;
if (this.div_) {
this.div_.style.visibility = "hidden";
}
};
/**
* Adds the InfoBox to the specified map or Street View panorama. If <tt>anchor</tt>
* (usually a <tt>google.maps.Marker</tt>) is specified, the position
* of the InfoBox is set to the position of the <tt>anchor</tt>. If the
* anchor is dragged to a new location, the InfoBox moves as well.
* @param {Map|StreetViewPanorama} map
* @param {MVCObject} [anchor]
*/
InfoBox.prototype.open = function (map, anchor) {
var me = this;
if (anchor) {
this.position_ = anchor.getPosition();
this.moveListener_ = google.maps.event.addListener(anchor, "position_changed", function () {
me.setPosition(this.getPosition());
});
}
this.setMap(map);
if (this.div_) {
this.panBox_();
}
};
/**
* Removes the InfoBox from the map.
*/
InfoBox.prototype.close = function () {
var i;
if (this.closeListener_) {
google.maps.event.removeListener(this.closeListener_);
this.closeListener_ = null;
}
if (this.eventListeners_) {
for (i = 0; i < this.eventListeners_.length; i++) {
google.maps.event.removeListener(this.eventListeners_[i]);
}
this.eventListeners_ = null;
}
if (this.moveListener_) {
google.maps.event.removeListener(this.moveListener_);
this.moveListener_ = null;
}
if (this.contextListener_) {
google.maps.event.removeListener(this.contextListener_);
this.contextListener_ = null;
}
this.setMap(null);
};;/**
* @name MarkerClustererPlus for Google Maps V3
* @version 2.1.1 [November 4, 2013]
* @author Gary Little
* @fileoverview
* The library creates and manages per-zoom-level clusters for large amounts of markers.
* <p>
* This is an enhanced V3 implementation of the
* <a href="http://gmaps-utility-library-dev.googlecode.com/svn/tags/markerclusterer/"
* >V2 MarkerClusterer</a> by Xiaoxi Wu. It is based on the
* <a href="http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclusterer/"
* >V3 MarkerClusterer</a> port by Luke Mahe. MarkerClustererPlus was created by Gary Little.
* <p>
* v2.0 release: MarkerClustererPlus v2.0 is backward compatible with MarkerClusterer v1.0. It
* adds support for the <code>ignoreHidden</code>, <code>title</code>, <code>batchSizeIE</code>,
* and <code>calculator</code> properties as well as support for four more events. It also allows
* greater control over the styling of the text that appears on the cluster marker. The
* documentation has been significantly improved and the overall code has been simplified and
* polished. Very large numbers of markers can now be managed without causing Javascript timeout
* errors on Internet Explorer. Note that the name of the <code>clusterclick</code> event has been
* deprecated. The new name is <code>click</code>, so please change your application code now.
*/
/**
* 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.
*/
/**
* @name ClusterIconStyle
* @class This class represents the object for values in the <code>styles</code> array passed
* to the {@link MarkerClusterer} constructor. The element in this array that is used to
* style the cluster icon is determined by calling the <code>calculator</code> function.
*
* @property {string} url The URL of the cluster icon image file. Required.
* @property {number} height The display height (in pixels) of the cluster icon. Required.
* @property {number} width The display width (in pixels) of the cluster icon. Required.
* @property {Array} [anchorText] The position (in pixels) from the center of the cluster icon to
* where the text label is to be centered and drawn. The format is <code>[yoffset, xoffset]</code>
* where <code>yoffset</code> increases as you go down from center and <code>xoffset</code>
* increases to the right of center. The default is <code>[0, 0]</code>.
* @property {Array} [anchorIcon] The anchor position (in pixels) of the cluster icon. This is the
* spot on the cluster icon that is to be aligned with the cluster position. The format is
* <code>[yoffset, xoffset]</code> where <code>yoffset</code> increases as you go down and
* <code>xoffset</code> increases to the right of the top-left corner of the icon. The default
* anchor position is the center of the cluster icon.
* @property {string} [textColor="black"] The color of the label text shown on the
* cluster icon.
* @property {number} [textSize=11] The size (in pixels) of the label text shown on the
* cluster icon.
* @property {string} [textDecoration="none"] The value of the CSS <code>text-decoration</code>
* property for the label text shown on the cluster icon.
* @property {string} [fontWeight="bold"] The value of the CSS <code>font-weight</code>
* property for the label text shown on the cluster icon.
* @property {string} [fontStyle="normal"] The value of the CSS <code>font-style</code>
* property for the label text shown on the cluster icon.
* @property {string} [fontFamily="Arial,sans-serif"] The value of the CSS <code>font-family</code>
* property for the label text shown on the cluster icon.
* @property {string} [backgroundPosition="0 0"] The position of the cluster icon image
* within the image defined by <code>url</code>. The format is <code>"xpos ypos"</code>
* (the same format as for the CSS <code>background-position</code> property). You must set
* this property appropriately when the image defined by <code>url</code> represents a sprite
* containing multiple images. Note that the position <i>must</i> be specified in px units.
*/
/**
* @name ClusterIconInfo
* @class This class is an object containing general information about a cluster icon. This is
* the object that a <code>calculator</code> function returns.
*
* @property {string} text The text of the label to be shown on the cluster icon.
* @property {number} index The index plus 1 of the element in the <code>styles</code>
* array to be used to style the cluster icon.
* @property {string} title The tooltip to display when the mouse moves over the cluster icon.
* If this value is <code>undefined</code> or <code>""</code>, <code>title</code> is set to the
* value of the <code>title</code> property passed to the MarkerClusterer.
*/
/**
* A cluster icon.
*
* @constructor
* @extends google.maps.OverlayView
* @param {Cluster} cluster The cluster with which the icon is to be associated.
* @param {Array} [styles] An array of {@link ClusterIconStyle} defining the cluster icons
* to use for various cluster sizes.
* @private
*/
function ClusterIcon(cluster, styles) {
cluster.getMarkerClusterer().extend(ClusterIcon, google.maps.OverlayView);
this.cluster_ = cluster;
this.className_ = cluster.getMarkerClusterer().getClusterClass();
this.styles_ = styles;
this.center_ = null;
this.div_ = null;
this.sums_ = null;
this.visible_ = false;
this.setMap(cluster.getMap()); // Note: this causes onAdd to be called
}
/**
* Adds the icon to the DOM.
*/
ClusterIcon.prototype.onAdd = function () {
var cClusterIcon = this;
var cMouseDownInCluster;
var cDraggingMapByCluster;
this.div_ = document.createElement("div");
this.div_.className = this.className_;
if (this.visible_) {
this.show();
}
this.getPanes().overlayMouseTarget.appendChild(this.div_);
// Fix for Issue 157
this.boundsChangedListener_ = google.maps.event.addListener(this.getMap(), "bounds_changed", function () {
cDraggingMapByCluster = cMouseDownInCluster;
});
google.maps.event.addDomListener(this.div_, "mousedown", function () {
cMouseDownInCluster = true;
cDraggingMapByCluster = false;
});
google.maps.event.addDomListener(this.div_, "click", function (e) {
cMouseDownInCluster = false;
if (!cDraggingMapByCluster) {
var theBounds;
var mz;
var mc = cClusterIcon.cluster_.getMarkerClusterer();
/**
* This event is fired when a cluster marker is clicked.
* @name MarkerClusterer#click
* @param {Cluster} c The cluster that was clicked.
* @event
*/
google.maps.event.trigger(mc, "click", cClusterIcon.cluster_);
google.maps.event.trigger(mc, "clusterclick", cClusterIcon.cluster_); // deprecated name
// The default click handler follows. Disable it by setting
// the zoomOnClick property to false.
if (mc.getZoomOnClick()) {
// Zoom into the cluster.
mz = mc.getMaxZoom();
theBounds = cClusterIcon.cluster_.getBounds();
mc.getMap().fitBounds(theBounds);
// There is a fix for Issue 170 here:
setTimeout(function () {
mc.getMap().fitBounds(theBounds);
// Don't zoom beyond the max zoom level
if (mz !== null && (mc.getMap().getZoom() > mz)) {
mc.getMap().setZoom(mz + 1);
}
}, 100);
}
// Prevent event propagation to the map:
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
}
});
google.maps.event.addDomListener(this.div_, "mouseover", function () {
var mc = cClusterIcon.cluster_.getMarkerClusterer();
/**
* This event is fired when the mouse moves over a cluster marker.
* @name MarkerClusterer#mouseover
* @param {Cluster} c The cluster that the mouse moved over.
* @event
*/
google.maps.event.trigger(mc, "mouseover", cClusterIcon.cluster_);
});
google.maps.event.addDomListener(this.div_, "mouseout", function () {
var mc = cClusterIcon.cluster_.getMarkerClusterer();
/**
* This event is fired when the mouse moves out of a cluster marker.
* @name MarkerClusterer#mouseout
* @param {Cluster} c The cluster that the mouse moved out of.
* @event
*/
google.maps.event.trigger(mc, "mouseout", cClusterIcon.cluster_);
});
};
/**
* Removes the icon from the DOM.
*/
ClusterIcon.prototype.onRemove = function () {
if (this.div_ && this.div_.parentNode) {
this.hide();
google.maps.event.removeListener(this.boundsChangedListener_);
google.maps.event.clearInstanceListeners(this.div_);
this.div_.parentNode.removeChild(this.div_);
this.div_ = null;
}
};
/**
* Draws the icon.
*/
ClusterIcon.prototype.draw = function () {
if (this.visible_) {
var pos = this.getPosFromLatLng_(this.center_);
this.div_.style.top = pos.y + "px";
this.div_.style.left = pos.x + "px";
}
};
/**
* Hides the icon.
*/
ClusterIcon.prototype.hide = function () {
if (this.div_) {
this.div_.style.display = "none";
}
this.visible_ = false;
};
/**
* Positions and shows the icon.
*/
ClusterIcon.prototype.show = function () {
if (this.div_) {
var img = "";
// NOTE: values must be specified in px units
var bp = this.backgroundPosition_.split(" ");
var spriteH = parseInt(bp[0].trim(), 10);
var spriteV = parseInt(bp[1].trim(), 10);
var pos = this.getPosFromLatLng_(this.center_);
this.div_.style.cssText = this.createCss(pos);
img = "<img src='" + this.url_ + "' style='position: absolute; top: " + spriteV + "px; left: " + spriteH + "px; ";
if (!this.cluster_.getMarkerClusterer().enableRetinaIcons_) {
img += "clip: rect(" + (-1 * spriteV) + "px, " + ((-1 * spriteH) + this.width_) + "px, " +
((-1 * spriteV) + this.height_) + "px, " + (-1 * spriteH) + "px);";
}
img += "'>";
this.div_.innerHTML = img + "<div style='" +
"position: absolute;" +
"top: " + this.anchorText_[0] + "px;" +
"left: " + this.anchorText_[1] + "px;" +
"color: " + this.textColor_ + ";" +
"font-size: " + this.textSize_ + "px;" +
"font-family: " + this.fontFamily_ + ";" +
"font-weight: " + this.fontWeight_ + ";" +
"font-style: " + this.fontStyle_ + ";" +
"text-decoration: " + this.textDecoration_ + ";" +
"text-align: center;" +
"width: " + this.width_ + "px;" +
"line-height:" + this.height_ + "px;" +
"'>" + this.sums_.text + "</div>";
if (typeof this.sums_.title === "undefined" || this.sums_.title === "") {
this.div_.title = this.cluster_.getMarkerClusterer().getTitle();
} else {
this.div_.title = this.sums_.title;
}
this.div_.style.display = "";
}
this.visible_ = true;
};
/**
* Sets the icon styles to the appropriate element in the styles array.
*
* @param {ClusterIconInfo} sums The icon label text and styles index.
*/
ClusterIcon.prototype.useStyle = function (sums) {
this.sums_ = sums;
var index = Math.max(0, sums.index - 1);
index = Math.min(this.styles_.length - 1, index);
var style = this.styles_[index];
this.url_ = style.url;
this.height_ = style.height;
this.width_ = style.width;
this.anchorText_ = style.anchorText || [0, 0];
this.anchorIcon_ = style.anchorIcon || [parseInt(this.height_ / 2, 10), parseInt(this.width_ / 2, 10)];
this.textColor_ = style.textColor || "black";
this.textSize_ = style.textSize || 11;
this.textDecoration_ = style.textDecoration || "none";
this.fontWeight_ = style.fontWeight || "bold";
this.fontStyle_ = style.fontStyle || "normal";
this.fontFamily_ = style.fontFamily || "Arial,sans-serif";
this.backgroundPosition_ = style.backgroundPosition || "0 0";
};
/**
* Sets the position at which to center the icon.
*
* @param {google.maps.LatLng} center The latlng to set as the center.
*/
ClusterIcon.prototype.setCenter = function (center) {
this.center_ = center;
};
/**
* Creates the cssText style parameter based on the position of the icon.
*
* @param {google.maps.Point} pos The position of the icon.
* @return {string} The CSS style text.
*/
ClusterIcon.prototype.createCss = function (pos) {
var style = [];
style.push("cursor: pointer;");
style.push("position: absolute; top: " + pos.y + "px; left: " + pos.x + "px;");
style.push("width: " + this.width_ + "px; height: " + this.height_ + "px;");
return style.join("");
};
/**
* Returns the position at which to place the DIV depending on the latlng.
*
* @param {google.maps.LatLng} latlng The position in latlng.
* @return {google.maps.Point} The position in pixels.
*/
ClusterIcon.prototype.getPosFromLatLng_ = function (latlng) {
var pos = this.getProjection().fromLatLngToDivPixel(latlng);
pos.x -= this.anchorIcon_[1];
pos.y -= this.anchorIcon_[0];
pos.x = parseInt(pos.x, 10);
pos.y = parseInt(pos.y, 10);
return pos;
};
/**
* Creates a single cluster that manages a group of proximate markers.
* Used internally, do not call this constructor directly.
* @constructor
* @param {MarkerClusterer} mc The <code>MarkerClusterer</code> object with which this
* cluster is associated.
*/
function Cluster(mc) {
this.markerClusterer_ = mc;
this.map_ = mc.getMap();
this.gridSize_ = mc.getGridSize();
this.minClusterSize_ = mc.getMinimumClusterSize();
this.averageCenter_ = mc.getAverageCenter();
this.markers_ = [];
this.center_ = null;
this.bounds_ = null;
this.clusterIcon_ = new ClusterIcon(this, mc.getStyles());
}
/**
* Returns the number of markers managed by the cluster. You can call this from
* a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
* for the <code>MarkerClusterer</code> object.
*
* @return {number} The number of markers in the cluster.
*/
Cluster.prototype.getSize = function () {
return this.markers_.length;
};
/**
* Returns the array of markers managed by the cluster. You can call this from
* a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
* for the <code>MarkerClusterer</code> object.
*
* @return {Array} The array of markers in the cluster.
*/
Cluster.prototype.getMarkers = function () {
return this.markers_;
};
/**
* Returns the center of the cluster. You can call this from
* a <code>click</code>, <code>mouseover</code>, or <code>mouseout</code> event handler
* for the <code>MarkerClusterer</code> object.
*
* @return {google.maps.LatLng} The center of the cluster.
*/
Cluster.prototype.getCenter = function () {
return this.center_;
};
/**
* Returns the map with which the cluster is associated.
*
* @return {google.maps.Map} The map.
* @ignore
*/
Cluster.prototype.getMap = function () {
return this.map_;
};
/**
* Returns the <code>MarkerClusterer</code> object with which the cluster is associated.
*
* @return {MarkerClusterer} The associated marker clusterer.
* @ignore
*/
Cluster.prototype.getMarkerClusterer = function () {
return this.markerClusterer_;
};
/**
* Returns the bounds of the cluster.
*
* @return {google.maps.LatLngBounds} the cluster bounds.
* @ignore
*/
Cluster.prototype.getBounds = function () {
var i;
var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
var markers = this.getMarkers();
for (i = 0; i < markers.length; i++) {
bounds.extend(markers[i].getPosition());
}
return bounds;
};
/**
* Removes the cluster from the map.
*
* @ignore
*/
Cluster.prototype.remove = function () {
this.clusterIcon_.setMap(null);
this.markers_ = [];
delete this.markers_;
};
/**
* Adds a marker to the cluster.
*
* @param {google.maps.Marker} marker The marker to be added.
* @return {boolean} True if the marker was added.
* @ignore
*/
Cluster.prototype.addMarker = function (marker) {
var i;
var mCount;
var mz;
if (this.isMarkerAlreadyAdded_(marker)) {
return false;
}
if (!this.center_) {
this.center_ = marker.getPosition();
this.calculateBounds_();
} else {
if (this.averageCenter_) {
var l = this.markers_.length + 1;
var lat = (this.center_.lat() * (l - 1) + marker.getPosition().lat()) / l;
var lng = (this.center_.lng() * (l - 1) + marker.getPosition().lng()) / l;
this.center_ = new google.maps.LatLng(lat, lng);
this.calculateBounds_();
}
}
marker.isAdded = true;
this.markers_.push(marker);
mCount = this.markers_.length;
mz = this.markerClusterer_.getMaxZoom();
if (mz !== null && this.map_.getZoom() > mz) {
// Zoomed in past max zoom, so show the marker.
if (marker.getMap() !== this.map_) {
marker.setMap(this.map_);
}
} else if (mCount < this.minClusterSize_) {
// Min cluster size not reached so show the marker.
if (marker.getMap() !== this.map_) {
marker.setMap(this.map_);
}
} else if (mCount === this.minClusterSize_) {
// Hide the markers that were showing.
for (i = 0; i < mCount; i++) {
this.markers_[i].setMap(null);
}
} else {
marker.setMap(null);
}
this.updateIcon_();
return true;
};
/**
* Determines if a marker lies within the cluster's bounds.
*
* @param {google.maps.Marker} marker The marker to check.
* @return {boolean} True if the marker lies in the bounds.
* @ignore
*/
Cluster.prototype.isMarkerInClusterBounds = function (marker) {
return this.bounds_.contains(marker.getPosition());
};
/**
* Calculates the extended bounds of the cluster with the grid.
*/
Cluster.prototype.calculateBounds_ = function () {
var bounds = new google.maps.LatLngBounds(this.center_, this.center_);
this.bounds_ = this.markerClusterer_.getExtendedBounds(bounds);
};
/**
* Updates the cluster icon.
*/
Cluster.prototype.updateIcon_ = function () {
var mCount = this.markers_.length;
var mz = this.markerClusterer_.getMaxZoom();
if (mz !== null && this.map_.getZoom() > mz) {
this.clusterIcon_.hide();
return;
}
if (mCount < this.minClusterSize_) {
// Min cluster size not yet reached.
this.clusterIcon_.hide();
return;
}
var numStyles = this.markerClusterer_.getStyles().length;
var sums = this.markerClusterer_.getCalculator()(this.markers_, numStyles);
this.clusterIcon_.setCenter(this.center_);
this.clusterIcon_.useStyle(sums);
this.clusterIcon_.show();
};
/**
* Determines if a marker has already been added to the cluster.
*
* @param {google.maps.Marker} marker The marker to check.
* @return {boolean} True if the marker has already been added.
*/
Cluster.prototype.isMarkerAlreadyAdded_ = function (marker) {
var i;
if (this.markers_.indexOf) {
return this.markers_.indexOf(marker) !== -1;
} else {
for (i = 0; i < this.markers_.length; i++) {
if (marker === this.markers_[i]) {
return true;
}
}
}
return false;
};
/**
* @name MarkerClustererOptions
* @class This class represents the optional parameter passed to
* the {@link MarkerClusterer} constructor.
* @property {number} [gridSize=60] The grid size of a cluster in pixels. The grid is a square.
* @property {number} [maxZoom=null] The maximum zoom level at which clustering is enabled or
* <code>null</code> if clustering is to be enabled at all zoom levels.
* @property {boolean} [zoomOnClick=true] Whether to zoom the map when a cluster marker is
* clicked. You may want to set this to <code>false</code> if you have installed a handler
* for the <code>click</code> event and it deals with zooming on its own.
* @property {boolean} [averageCenter=false] Whether the position of a cluster marker should be
* the average position of all markers in the cluster. If set to <code>false</code>, the
* cluster marker is positioned at the location of the first marker added to the cluster.
* @property {number} [minimumClusterSize=2] The minimum number of markers needed in a cluster
* before the markers are hidden and a cluster marker appears.
* @property {boolean} [ignoreHidden=false] Whether to ignore hidden markers in clusters. You
* may want to set this to <code>true</code> to ensure that hidden markers are not included
* in the marker count that appears on a cluster marker (this count is the value of the
* <code>text</code> property of the result returned by the default <code>calculator</code>).
* If set to <code>true</code> and you change the visibility of a marker being clustered, be
* sure to also call <code>MarkerClusterer.repaint()</code>.
* @property {string} [title=""] The tooltip to display when the mouse moves over a cluster
* marker. (Alternatively, you can use a custom <code>calculator</code> function to specify a
* different tooltip for each cluster marker.)
* @property {function} [calculator=MarkerClusterer.CALCULATOR] The function used to determine
* the text to be displayed on a cluster marker and the index indicating which style to use
* for the cluster marker. The input parameters for the function are (1) the array of markers
* represented by a cluster marker and (2) the number of cluster icon styles. It returns a
* {@link ClusterIconInfo} object. The default <code>calculator</code> returns a
* <code>text</code> property which is the number of markers in the cluster and an
* <code>index</code> property which is one higher than the lowest integer such that
* <code>10^i</code> exceeds the number of markers in the cluster, or the size of the styles
* array, whichever is less. The <code>styles</code> array element used has an index of
* <code>index</code> minus 1. For example, the default <code>calculator</code> returns a
* <code>text</code> value of <code>"125"</code> and an <code>index</code> of <code>3</code>
* for a cluster icon representing 125 markers so the element used in the <code>styles</code>
* array is <code>2</code>. A <code>calculator</code> may also return a <code>title</code>
* property that contains the text of the tooltip to be used for the cluster marker. If
* <code>title</code> is not defined, the tooltip is set to the value of the <code>title</code>
* property for the MarkerClusterer.
* @property {string} [clusterClass="cluster"] The name of the CSS class defining general styles
* for the cluster markers. Use this class to define CSS styles that are not set up by the code
* that processes the <code>styles</code> array.
* @property {Array} [styles] An array of {@link ClusterIconStyle} elements defining the styles
* of the cluster markers to be used. The element to be used to style a given cluster marker
* is determined by the function defined by the <code>calculator</code> property.
* The default is an array of {@link ClusterIconStyle} elements whose properties are derived
* from the values for <code>imagePath</code>, <code>imageExtension</code>, and
* <code>imageSizes</code>.
* @property {boolean} [enableRetinaIcons=false] Whether to allow the use of cluster icons that
* have sizes that are some multiple (typically double) of their actual display size. Icons such
* as these look better when viewed on high-resolution monitors such as Apple's Retina displays.
* Note: if this property is <code>true</code>, sprites cannot be used as cluster icons.
* @property {number} [batchSize=MarkerClusterer.BATCH_SIZE] Set this property to the
* number of markers to be processed in a single batch when using a browser other than
* Internet Explorer (for Internet Explorer, use the batchSizeIE property instead).
* @property {number} [batchSizeIE=MarkerClusterer.BATCH_SIZE_IE] When Internet Explorer is
* being used, markers are processed in several batches with a small delay inserted between
* each batch in an attempt to avoid Javascript timeout errors. Set this property to the
* number of markers to be processed in a single batch; select as high a number as you can
* without causing a timeout error in the browser. This number might need to be as low as 100
* if 15,000 markers are being managed, for example.
* @property {string} [imagePath=MarkerClusterer.IMAGE_PATH]
* The full URL of the root name of the group of image files to use for cluster icons.
* The complete file name is of the form <code>imagePath</code>n.<code>imageExtension</code>
* where n is the image file number (1, 2, etc.).
* @property {string} [imageExtension=MarkerClusterer.IMAGE_EXTENSION]
* The extension name for the cluster icon image files (e.g., <code>"png"</code> or
* <code>"jpg"</code>).
* @property {Array} [imageSizes=MarkerClusterer.IMAGE_SIZES]
* An array of numbers containing the widths of the group of
* <code>imagePath</code>n.<code>imageExtension</code> image files.
* (The images are assumed to be square.)
*/
/**
* Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}.
* @constructor
* @extends google.maps.OverlayView
* @param {google.maps.Map} map The Google map to attach to.
* @param {Array.<google.maps.Marker>} [opt_markers] The markers to be added to the cluster.
* @param {MarkerClustererOptions} [opt_options] The optional parameters.
*/
function MarkerClusterer(map, opt_markers, opt_options) {
// MarkerClusterer implements google.maps.OverlayView interface. We use the
// extend function to extend MarkerClusterer with google.maps.OverlayView
// because it might not always be available when the code is defined so we
// look for it at the last possible moment. If it doesn't exist now then
// there is no point going ahead :)
this.extend(MarkerClusterer, google.maps.OverlayView);
opt_markers = opt_markers || [];
opt_options = opt_options || {};
this.markers_ = [];
this.clusters_ = [];
this.listeners_ = [];
this.activeMap_ = null;
this.ready_ = false;
this.gridSize_ = opt_options.gridSize || 60;
this.minClusterSize_ = opt_options.minimumClusterSize || 2;
this.maxZoom_ = opt_options.maxZoom || null;
this.styles_ = opt_options.styles || [];
this.title_ = opt_options.title || "";
this.zoomOnClick_ = true;
if (opt_options.zoomOnClick !== undefined) {
this.zoomOnClick_ = opt_options.zoomOnClick;
}
this.averageCenter_ = false;
if (opt_options.averageCenter !== undefined) {
this.averageCenter_ = opt_options.averageCenter;
}
this.ignoreHidden_ = false;
if (opt_options.ignoreHidden !== undefined) {
this.ignoreHidden_ = opt_options.ignoreHidden;
}
this.enableRetinaIcons_ = false;
if (opt_options.enableRetinaIcons !== undefined) {
this.enableRetinaIcons_ = opt_options.enableRetinaIcons;
}
this.imagePath_ = opt_options.imagePath || MarkerClusterer.IMAGE_PATH;
this.imageExtension_ = opt_options.imageExtension || MarkerClusterer.IMAGE_EXTENSION;
this.imageSizes_ = opt_options.imageSizes || MarkerClusterer.IMAGE_SIZES;
this.calculator_ = opt_options.calculator || MarkerClusterer.CALCULATOR;
this.batchSize_ = opt_options.batchSize || MarkerClusterer.BATCH_SIZE;
this.batchSizeIE_ = opt_options.batchSizeIE || MarkerClusterer.BATCH_SIZE_IE;
this.clusterClass_ = opt_options.clusterClass || "cluster";
if (navigator.userAgent.toLowerCase().indexOf("msie") !== -1) {
// Try to avoid IE timeout when processing a huge number of markers:
this.batchSize_ = this.batchSizeIE_;
}
this.setupStyles_();
this.addMarkers(opt_markers, true);
this.setMap(map); // Note: this causes onAdd to be called
}
/**
* Implementation of the onAdd interface method.
* @ignore
*/
MarkerClusterer.prototype.onAdd = function () {
var cMarkerClusterer = this;
this.activeMap_ = this.getMap();
this.ready_ = true;
this.repaint();
// Add the map event listeners
this.listeners_ = [
google.maps.event.addListener(this.getMap(), "zoom_changed", function () {
cMarkerClusterer.resetViewport_(false);
// Workaround for this Google bug: when map is at level 0 and "-" of
// zoom slider is clicked, a "zoom_changed" event is fired even though
// the map doesn't zoom out any further. In this situation, no "idle"
// event is triggered so the cluster markers that have been removed
// do not get redrawn. Same goes for a zoom in at maxZoom.
if (this.getZoom() === (this.get("minZoom") || 0) || this.getZoom() === this.get("maxZoom")) {
google.maps.event.trigger(this, "idle");
}
}),
google.maps.event.addListener(this.getMap(), "idle", function () {
cMarkerClusterer.redraw_();
})
];
};
/**
* Implementation of the onRemove interface method.
* Removes map event listeners and all cluster icons from the DOM.
* All managed markers are also put back on the map.
* @ignore
*/
MarkerClusterer.prototype.onRemove = function () {
var i;
// Put all the managed markers back on the map:
for (i = 0; i < this.markers_.length; i++) {
if (this.markers_[i].getMap() !== this.activeMap_) {
this.markers_[i].setMap(this.activeMap_);
}
}
// Remove all clusters:
for (i = 0; i < this.clusters_.length; i++) {
this.clusters_[i].remove();
}
this.clusters_ = [];
// Remove map event listeners:
for (i = 0; i < this.listeners_.length; i++) {
google.maps.event.removeListener(this.listeners_[i]);
}
this.listeners_ = [];
this.activeMap_ = null;
this.ready_ = false;
};
/**
* Implementation of the draw interface method.
* @ignore
*/
MarkerClusterer.prototype.draw = function () {};
/**
* Sets up the styles object.
*/
MarkerClusterer.prototype.setupStyles_ = function () {
var i, size;
if (this.styles_.length > 0) {
return;
}
for (i = 0; i < this.imageSizes_.length; i++) {
size = this.imageSizes_[i];
this.styles_.push({
url: this.imagePath_ + (i + 1) + "." + this.imageExtension_,
height: size,
width: size
});
}
};
/**
* Fits the map to the bounds of the markers managed by the clusterer.
*/
MarkerClusterer.prototype.fitMapToMarkers = function () {
var i;
var markers = this.getMarkers();
var bounds = new google.maps.LatLngBounds();
for (i = 0; i < markers.length; i++) {
bounds.extend(markers[i].getPosition());
}
this.getMap().fitBounds(bounds);
};
/**
* Returns the value of the <code>gridSize</code> property.
*
* @return {number} The grid size.
*/
MarkerClusterer.prototype.getGridSize = function () {
return this.gridSize_;
};
/**
* Sets the value of the <code>gridSize</code> property.
*
* @param {number} gridSize The grid size.
*/
MarkerClusterer.prototype.setGridSize = function (gridSize) {
this.gridSize_ = gridSize;
};
/**
* Returns the value of the <code>minimumClusterSize</code> property.
*
* @return {number} The minimum cluster size.
*/
MarkerClusterer.prototype.getMinimumClusterSize = function () {
return this.minClusterSize_;
};
/**
* Sets the value of the <code>minimumClusterSize</code> property.
*
* @param {number} minimumClusterSize The minimum cluster size.
*/
MarkerClusterer.prototype.setMinimumClusterSize = function (minimumClusterSize) {
this.minClusterSize_ = minimumClusterSize;
};
/**
* Returns the value of the <code>maxZoom</code> property.
*
* @return {number} The maximum zoom level.
*/
MarkerClusterer.prototype.getMaxZoom = function () {
return this.maxZoom_;
};
/**
* Sets the value of the <code>maxZoom</code> property.
*
* @param {number} maxZoom The maximum zoom level.
*/
MarkerClusterer.prototype.setMaxZoom = function (maxZoom) {
this.maxZoom_ = maxZoom;
};
/**
* Returns the value of the <code>styles</code> property.
*
* @return {Array} The array of styles defining the cluster markers to be used.
*/
MarkerClusterer.prototype.getStyles = function () {
return this.styles_;
};
/**
* Sets the value of the <code>styles</code> property.
*
* @param {Array.<ClusterIconStyle>} styles The array of styles to use.
*/
MarkerClusterer.prototype.setStyles = function (styles) {
this.styles_ = styles;
};
/**
* Returns the value of the <code>title</code> property.
*
* @return {string} The content of the title text.
*/
MarkerClusterer.prototype.getTitle = function () {
return this.title_;
};
/**
* Sets the value of the <code>title</code> property.
*
* @param {string} title The value of the title property.
*/
MarkerClusterer.prototype.setTitle = function (title) {
this.title_ = title;
};
/**
* Returns the value of the <code>zoomOnClick</code> property.
*
* @return {boolean} True if zoomOnClick property is set.
*/
MarkerClusterer.prototype.getZoomOnClick = function () {
return this.zoomOnClick_;
};
/**
* Sets the value of the <code>zoomOnClick</code> property.
*
* @param {boolean} zoomOnClick The value of the zoomOnClick property.
*/
MarkerClusterer.prototype.setZoomOnClick = function (zoomOnClick) {
this.zoomOnClick_ = zoomOnClick;
};
/**
* Returns the value of the <code>averageCenter</code> property.
*
* @return {boolean} True if averageCenter property is set.
*/
MarkerClusterer.prototype.getAverageCenter = function () {
return this.averageCenter_;
};
/**
* Sets the value of the <code>averageCenter</code> property.
*
* @param {boolean} averageCenter The value of the averageCenter property.
*/
MarkerClusterer.prototype.setAverageCenter = function (averageCenter) {
this.averageCenter_ = averageCenter;
};
/**
* Returns the value of the <code>ignoreHidden</code> property.
*
* @return {boolean} True if ignoreHidden property is set.
*/
MarkerClusterer.prototype.getIgnoreHidden = function () {
return this.ignoreHidden_;
};
/**
* Sets the value of the <code>ignoreHidden</code> property.
*
* @param {boolean} ignoreHidden The value of the ignoreHidden property.
*/
MarkerClusterer.prototype.setIgnoreHidden = function (ignoreHidden) {
this.ignoreHidden_ = ignoreHidden;
};
/**
* Returns the value of the <code>enableRetinaIcons</code> property.
*
* @return {boolean} True if enableRetinaIcons property is set.
*/
MarkerClusterer.prototype.getEnableRetinaIcons = function () {
return this.enableRetinaIcons_;
};
/**
* Sets the value of the <code>enableRetinaIcons</code> property.
*
* @param {boolean} enableRetinaIcons The value of the enableRetinaIcons property.
*/
MarkerClusterer.prototype.setEnableRetinaIcons = function (enableRetinaIcons) {
this.enableRetinaIcons_ = enableRetinaIcons;
};
/**
* Returns the value of the <code>imageExtension</code> property.
*
* @return {string} The value of the imageExtension property.
*/
MarkerClusterer.prototype.getImageExtension = function () {
return this.imageExtension_;
};
/**
* Sets the value of the <code>imageExtension</code> property.
*
* @param {string} imageExtension The value of the imageExtension property.
*/
MarkerClusterer.prototype.setImageExtension = function (imageExtension) {
this.imageExtension_ = imageExtension;
};
/**
* Returns the value of the <code>imagePath</code> property.
*
* @return {string} The value of the imagePath property.
*/
MarkerClusterer.prototype.getImagePath = function () {
return this.imagePath_;
};
/**
* Sets the value of the <code>imagePath</code> property.
*
* @param {string} imagePath The value of the imagePath property.
*/
MarkerClusterer.prototype.setImagePath = function (imagePath) {
this.imagePath_ = imagePath;
};
/**
* Returns the value of the <code>imageSizes</code> property.
*
* @return {Array} The value of the imageSizes property.
*/
MarkerClusterer.prototype.getImageSizes = function () {
return this.imageSizes_;
};
/**
* Sets the value of the <code>imageSizes</code> property.
*
* @param {Array} imageSizes The value of the imageSizes property.
*/
MarkerClusterer.prototype.setImageSizes = function (imageSizes) {
this.imageSizes_ = imageSizes;
};
/**
* Returns the value of the <code>calculator</code> property.
*
* @return {function} the value of the calculator property.
*/
MarkerClusterer.prototype.getCalculator = function () {
return this.calculator_;
};
/**
* Sets the value of the <code>calculator</code> property.
*
* @param {function(Array.<google.maps.Marker>, number)} calculator The value
* of the calculator property.
*/
MarkerClusterer.prototype.setCalculator = function (calculator) {
this.calculator_ = calculator;
};
/**
* Returns the value of the <code>batchSizeIE</code> property.
*
* @return {number} the value of the batchSizeIE property.
*/
MarkerClusterer.prototype.getBatchSizeIE = function () {
return this.batchSizeIE_;
};
/**
* Sets the value of the <code>batchSizeIE</code> property.
*
* @param {number} batchSizeIE The value of the batchSizeIE property.
*/
MarkerClusterer.prototype.setBatchSizeIE = function (batchSizeIE) {
this.batchSizeIE_ = batchSizeIE;
};
/**
* Returns the value of the <code>clusterClass</code> property.
*
* @return {string} the value of the clusterClass property.
*/
MarkerClusterer.prototype.getClusterClass = function () {
return this.clusterClass_;
};
/**
* Sets the value of the <code>clusterClass</code> property.
*
* @param {string} clusterClass The value of the clusterClass property.
*/
MarkerClusterer.prototype.setClusterClass = function (clusterClass) {
this.clusterClass_ = clusterClass;
};
/**
* Returns the array of markers managed by the clusterer.
*
* @return {Array} The array of markers managed by the clusterer.
*/
MarkerClusterer.prototype.getMarkers = function () {
return this.markers_;
};
/**
* Returns the number of markers managed by the clusterer.
*
* @return {number} The number of markers.
*/
MarkerClusterer.prototype.getTotalMarkers = function () {
return this.markers_.length;
};
/**
* Returns the current array of clusters formed by the clusterer.
*
* @return {Array} The array of clusters formed by the clusterer.
*/
MarkerClusterer.prototype.getClusters = function () {
return this.clusters_;
};
/**
* Returns the number of clusters formed by the clusterer.
*
* @return {number} The number of clusters formed by the clusterer.
*/
MarkerClusterer.prototype.getTotalClusters = function () {
return this.clusters_.length;
};
/**
* Adds a marker to the clusterer. The clusters are redrawn unless
* <code>opt_nodraw</code> is set to <code>true</code>.
*
* @param {google.maps.Marker} marker The marker to add.
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
*/
MarkerClusterer.prototype.addMarker = function (marker, opt_nodraw) {
this.pushMarkerTo_(marker);
if (!opt_nodraw) {
this.redraw_();
}
};
/**
* Adds an array of markers to the clusterer. The clusters are redrawn unless
* <code>opt_nodraw</code> is set to <code>true</code>.
*
* @param {Array.<google.maps.Marker>} markers The markers to add.
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
*/
MarkerClusterer.prototype.addMarkers = function (markers, opt_nodraw) {
var key;
for (key in markers) {
if (markers.hasOwnProperty(key)) {
this.pushMarkerTo_(markers[key]);
}
}
if (!opt_nodraw) {
this.redraw_();
}
};
/**
* Pushes a marker to the clusterer.
*
* @param {google.maps.Marker} marker The marker to add.
*/
MarkerClusterer.prototype.pushMarkerTo_ = function (marker) {
// If the marker is draggable add a listener so we can update the clusters on the dragend:
if (marker.getDraggable()) {
var cMarkerClusterer = this;
google.maps.event.addListener(marker, "dragend", function () {
if (cMarkerClusterer.ready_) {
this.isAdded = false;
cMarkerClusterer.repaint();
}
});
}
marker.isAdded = false;
this.markers_.push(marker);
};
/**
* Removes a marker from the cluster. The clusters are redrawn unless
* <code>opt_nodraw</code> is set to <code>true</code>. Returns <code>true</code> if the
* marker was removed from the clusterer.
*
* @param {google.maps.Marker} marker The marker to remove.
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
* @return {boolean} True if the marker was removed from the clusterer.
*/
MarkerClusterer.prototype.removeMarker = function (marker, opt_nodraw) {
var removed = this.removeMarker_(marker);
if (!opt_nodraw && removed) {
this.repaint();
}
return removed;
};
/**
* Removes an array of markers from the cluster. The clusters are redrawn unless
* <code>opt_nodraw</code> is set to <code>true</code>. Returns <code>true</code> if markers
* were removed from the clusterer.
*
* @param {Array.<google.maps.Marker>} markers The markers to remove.
* @param {boolean} [opt_nodraw] Set to <code>true</code> to prevent redrawing.
* @return {boolean} True if markers were removed from the clusterer.
*/
MarkerClusterer.prototype.removeMarkers = function (markers, opt_nodraw) {
var i, r;
var removed = false;
for (i = 0; i < markers.length; i++) {
r = this.removeMarker_(markers[i]);
removed = removed || r;
}
if (!opt_nodraw && removed) {
this.repaint();
}
return removed;
};
/**
* Removes a marker and returns true if removed, false if not.
*
* @param {google.maps.Marker} marker The marker to remove
* @return {boolean} Whether the marker was removed or not
*/
MarkerClusterer.prototype.removeMarker_ = function (marker) {
var i;
var index = -1;
if (this.markers_.indexOf) {
index = this.markers_.indexOf(marker);
} else {
for (i = 0; i < this.markers_.length; i++) {
if (marker === this.markers_[i]) {
index = i;
break;
}
}
}
if (index === -1) {
// Marker is not in our list of markers, so do nothing:
return false;
}
marker.setMap(null);
this.markers_.splice(index, 1); // Remove the marker from the list of managed markers
return true;
};
/**
* Removes all clusters and markers from the map and also removes all markers
* managed by the clusterer.
*/
MarkerClusterer.prototype.clearMarkers = function () {
this.resetViewport_(true);
this.markers_ = [];
};
/**
* Recalculates and redraws all the marker clusters from scratch.
* Call this after changing any properties.
*/
MarkerClusterer.prototype.repaint = function () {
var oldClusters = this.clusters_.slice();
this.clusters_ = [];
this.resetViewport_(false);
this.redraw_();
// Remove the old clusters.
// Do it in a timeout to prevent blinking effect.
setTimeout(function () {
var i;
for (i = 0; i < oldClusters.length; i++) {
oldClusters[i].remove();
}
}, 0);
};
/**
* Returns the current bounds extended by the grid size.
*
* @param {google.maps.LatLngBounds} bounds The bounds to extend.
* @return {google.maps.LatLngBounds} The extended bounds.
* @ignore
*/
MarkerClusterer.prototype.getExtendedBounds = function (bounds) {
var projection = this.getProjection();
// Turn the bounds into latlng.
var tr = new google.maps.LatLng(bounds.getNorthEast().lat(),
bounds.getNorthEast().lng());
var bl = new google.maps.LatLng(bounds.getSouthWest().lat(),
bounds.getSouthWest().lng());
// Convert the points to pixels and the extend out by the grid size.
var trPix = projection.fromLatLngToDivPixel(tr);
trPix.x += this.gridSize_;
trPix.y -= this.gridSize_;
var blPix = projection.fromLatLngToDivPixel(bl);
blPix.x -= this.gridSize_;
blPix.y += this.gridSize_;
// Convert the pixel points back to LatLng
var ne = projection.fromDivPixelToLatLng(trPix);
var sw = projection.fromDivPixelToLatLng(blPix);
// Extend the bounds to contain the new bounds.
bounds.extend(ne);
bounds.extend(sw);
return bounds;
};
/**
* Redraws all the clusters.
*/
MarkerClusterer.prototype.redraw_ = function () {
this.createClusters_(0);
};
/**
* Removes all clusters from the map. The markers are also removed from the map
* if <code>opt_hide</code> is set to <code>true</code>.
*
* @param {boolean} [opt_hide] Set to <code>true</code> to also remove the markers
* from the map.
*/
MarkerClusterer.prototype.resetViewport_ = function (opt_hide) {
var i, marker;
// Remove all the clusters
for (i = 0; i < this.clusters_.length; i++) {
this.clusters_[i].remove();
}
this.clusters_ = [];
// Reset the markers to not be added and to be removed from the map.
for (i = 0; i < this.markers_.length; i++) {
marker = this.markers_[i];
marker.isAdded = false;
if (opt_hide) {
marker.setMap(null);
}
}
};
/**
* Calculates the distance between two latlng locations in km.
*
* @param {google.maps.LatLng} p1 The first lat lng point.
* @param {google.maps.LatLng} p2 The second lat lng point.
* @return {number} The distance between the two points in km.
* @see http://www.movable-type.co.uk/scripts/latlong.html
*/
MarkerClusterer.prototype.distanceBetweenPoints_ = function (p1, p2) {
var R = 6371; // Radius of the Earth in km
var dLat = (p2.lat() - p1.lat()) * Math.PI / 180;
var dLon = (p2.lng() - p1.lng()) * Math.PI / 180;
var a = Math.sin(dLat / 2) * Math.sin(dLat / 2) +
Math.cos(p1.lat() * Math.PI / 180) * Math.cos(p2.lat() * Math.PI / 180) *
Math.sin(dLon / 2) * Math.sin(dLon / 2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
var d = R * c;
return d;
};
/**
* Determines if a marker is contained in a bounds.
*
* @param {google.maps.Marker} marker The marker to check.
* @param {google.maps.LatLngBounds} bounds The bounds to check against.
* @return {boolean} True if the marker is in the bounds.
*/
MarkerClusterer.prototype.isMarkerInBounds_ = function (marker, bounds) {
return bounds.contains(marker.getPosition());
};
/**
* Adds a marker to a cluster, or creates a new cluster.
*
* @param {google.maps.Marker} marker The marker to add.
*/
MarkerClusterer.prototype.addToClosestCluster_ = function (marker) {
var i, d, cluster, center;
var distance = 40000; // Some large number
var clusterToAddTo = null;
for (i = 0; i < this.clusters_.length; i++) {
cluster = this.clusters_[i];
center = cluster.getCenter();
if (center) {
d = this.distanceBetweenPoints_(center, marker.getPosition());
if (d < distance) {
distance = d;
clusterToAddTo = cluster;
}
}
}
if (clusterToAddTo && clusterToAddTo.isMarkerInClusterBounds(marker)) {
clusterToAddTo.addMarker(marker);
} else {
cluster = new Cluster(this);
cluster.addMarker(marker);
this.clusters_.push(cluster);
}
};
/**
* Creates the clusters. This is done in batches to avoid timeout errors
* in some browsers when there is a huge number of markers.
*
* @param {number} iFirst The index of the first marker in the batch of
* markers to be added to clusters.
*/
MarkerClusterer.prototype.createClusters_ = function (iFirst) {
var i, marker;
var mapBounds;
var cMarkerClusterer = this;
if (!this.ready_) {
return;
}
// Cancel previous batch processing if we're working on the first batch:
if (iFirst === 0) {
/**
* This event is fired when the <code>MarkerClusterer</code> begins
* clustering markers.
* @name MarkerClusterer#clusteringbegin
* @param {MarkerClusterer} mc The MarkerClusterer whose markers are being clustered.
* @event
*/
google.maps.event.trigger(this, "clusteringbegin", this);
if (typeof this.timerRefStatic !== "undefined") {
clearTimeout(this.timerRefStatic);
delete this.timerRefStatic;
}
}
// Get our current map view bounds.
// Create a new bounds object so we don't affect the map.
//
// See Comments 9 & 11 on Issue 3651 relating to this workaround for a Google Maps bug:
if (this.getMap().getZoom() > 3) {
mapBounds = new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),
this.getMap().getBounds().getNorthEast());
} else {
mapBounds = new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472, -178.48388434375), new google.maps.LatLng(-85.08136444384544, 178.00048865625));
}
var bounds = this.getExtendedBounds(mapBounds);
var iLast = Math.min(iFirst + this.batchSize_, this.markers_.length);
for (i = iFirst; i < iLast; i++) {
marker = this.markers_[i];
if (!marker.isAdded && this.isMarkerInBounds_(marker, bounds)) {
if (!this.ignoreHidden_ || (this.ignoreHidden_ && marker.getVisible())) {
this.addToClosestCluster_(marker);
}
}
}
if (iLast < this.markers_.length) {
this.timerRefStatic = setTimeout(function () {
cMarkerClusterer.createClusters_(iLast);
}, 0);
} else {
delete this.timerRefStatic;
/**
* This event is fired when the <code>MarkerClusterer</code> stops
* clustering markers.
* @name MarkerClusterer#clusteringend
* @param {MarkerClusterer} mc The MarkerClusterer whose markers are being clustered.
* @event
*/
google.maps.event.trigger(this, "clusteringend", this);
}
};
/**
* Extends an object's prototype by another's.
*
* @param {Object} obj1 The object to be extended.
* @param {Object} obj2 The object to extend with.
* @return {Object} The new extended object.
* @ignore
*/
MarkerClusterer.prototype.extend = function (obj1, obj2) {
return (function (object) {
var property;
for (property in object.prototype) {
this.prototype[property] = object.prototype[property];
}
return this;
}).apply(obj1, [obj2]);
};
/**
* The default function for determining the label text and style
* for a cluster icon.
*
* @param {Array.<google.maps.Marker>} markers The array of markers represented by the cluster.
* @param {number} numStyles The number of marker styles available.
* @return {ClusterIconInfo} The information resource for the cluster.
* @constant
* @ignore
*/
MarkerClusterer.CALCULATOR = function (markers, numStyles) {
var index = 0;
var title = "";
var count = markers.length.toString();
var dv = count;
while (dv !== 0) {
dv = parseInt(dv / 10, 10);
index++;
}
index = Math.min(index, numStyles);
return {
text: count,
index: index,
title: title
};
};
/**
* The number of markers to process in one batch.
*
* @type {number}
* @constant
*/
MarkerClusterer.BATCH_SIZE = 2000;
/**
* The number of markers to process in one batch (IE only).
*
* @type {number}
* @constant
*/
MarkerClusterer.BATCH_SIZE_IE = 500;
/**
* The default root name for the marker cluster images.
*
* @type {string}
* @constant
*/
MarkerClusterer.IMAGE_PATH = "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclustererplus/images/m";
/**
* The default extension name for the marker cluster images.
*
* @type {string}
* @constant
*/
MarkerClusterer.IMAGE_EXTENSION = "png";
/**
* The default array of sizes for the marker cluster images.
*
* @type {Array.<number>}
* @constant
*/
MarkerClusterer.IMAGE_SIZES = [53, 56, 66, 78, 90];
if (typeof String.prototype.trim !== 'function') {
/**
* IE hack since trim() doesn't exist in all browsers
* @return {string} The string with removed whitespace
*/
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
;/**
* 1.1.9-patched
* @name MarkerWithLabel for V3
* @version 1.1.8 [February 26, 2013]
* @author Gary Little (inspired by code from Marc Ridey of Google).
* @copyright Copyright 2012 Gary Little [gary at luxcentral.com]
* @fileoverview MarkerWithLabel extends the Google Maps JavaScript API V3
* <code>google.maps.Marker</code> class.
* <p>
* MarkerWithLabel allows you to define markers with associated labels. As you would expect,
* if the marker is draggable, so too will be the label. In addition, a marker with a label
* responds to all mouse events in the same manner as a regular marker. It also fires mouse
* events and "property changed" events just as a regular marker would. Version 1.1 adds
* support for the raiseOnDrag feature introduced in API V3.3.
* <p>
* If you drag a marker by its label, you can cancel the drag and return the marker to its
* original position by pressing the <code>Esc</code> key. This doesn't work if you drag the marker
* itself because this feature is not (yet) supported in the <code>google.maps.Marker</code> class.
*/
/*!
*
* 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.
*/
/*jslint browser:true */
/*global document,google */
/**
* @param {Function} childCtor Child class.
* @param {Function} parentCtor Parent class.
*/
function inherits(childCtor, parentCtor) {
/** @constructor */
function tempCtor() {}
tempCtor.prototype = parentCtor.prototype;
childCtor.superClass_ = parentCtor.prototype;
childCtor.prototype = new tempCtor();
/** @override */
childCtor.prototype.constructor = childCtor;
}
/**
* This constructor creates a label and associates it with a marker.
* It is for the private use of the MarkerWithLabel class.
* @constructor
* @param {Marker} marker The marker with which the label is to be associated.
* @param {string} crossURL The URL of the cross image =.
* @param {string} handCursor The URL of the hand cursor.
* @private
*/
function MarkerLabel_(marker, crossURL, handCursorURL) {
this.marker_ = marker;
this.handCursorURL_ = marker.handCursorURL;
this.labelDiv_ = document.createElement("div");
this.labelDiv_.style.cssText = "position: absolute; overflow: hidden;";
// Set up the DIV for handling mouse events in the label. This DIV forms a transparent veil
// in the "overlayMouseTarget" pane, a veil that covers just the label. This is done so that
// events can be captured even if the label is in the shadow of a google.maps.InfoWindow.
// Code is included here to ensure the veil is always exactly the same size as the label.
this.eventDiv_ = document.createElement("div");
this.eventDiv_.style.cssText = this.labelDiv_.style.cssText;
// This is needed for proper behavior on MSIE:
this.eventDiv_.setAttribute("onselectstart", "return false;");
this.eventDiv_.setAttribute("ondragstart", "return false;");
// Get the DIV for the "X" to be displayed when the marker is raised.
this.crossDiv_ = MarkerLabel_.getSharedCross(crossURL);
}
inherits(MarkerLabel_, google.maps.OverlayView);
/**
* Returns the DIV for the cross used when dragging a marker when the
* raiseOnDrag parameter set to true. One cross is shared with all markers.
* @param {string} crossURL The URL of the cross image =.
* @private
*/
MarkerLabel_.getSharedCross = function (crossURL) {
var div;
if (typeof MarkerLabel_.getSharedCross.crossDiv === "undefined") {
div = document.createElement("img");
div.style.cssText = "position: absolute; z-index: 1000002; display: none;";
// Hopefully Google never changes the standard "X" attributes:
div.style.marginLeft = "-8px";
div.style.marginTop = "-9px";
div.src = crossURL;
MarkerLabel_.getSharedCross.crossDiv = div;
}
return MarkerLabel_.getSharedCross.crossDiv;
};
/**
* Adds the DIV representing the label to the DOM. This method is called
* automatically when the marker's <code>setMap</code> method is called.
* @private
*/
MarkerLabel_.prototype.onAdd = function () {
var me = this;
var cMouseIsDown = false;
var cDraggingLabel = false;
var cSavedZIndex;
var cLatOffset, cLngOffset;
var cIgnoreClick;
var cRaiseEnabled;
var cStartPosition;
var cStartCenter;
// Constants:
var cRaiseOffset = 20;
var cDraggingCursor = "url(" + this.handCursorURL_ + ")";
// Stops all processing of an event.
//
var cAbortEvent = function (e) {
if (e.preventDefault) {
e.preventDefault();
}
e.cancelBubble = true;
if (e.stopPropagation) {
e.stopPropagation();
}
};
var cStopBounce = function () {
me.marker_.setAnimation(null);
};
this.getPanes().overlayImage.appendChild(this.labelDiv_);
this.getPanes().overlayMouseTarget.appendChild(this.eventDiv_);
// One cross is shared with all markers, so only add it once:
if (typeof MarkerLabel_.getSharedCross.processed === "undefined") {
this.getPanes().overlayImage.appendChild(this.crossDiv_);
MarkerLabel_.getSharedCross.processed = true;
}
this.listeners_ = [
google.maps.event.addDomListener(this.eventDiv_, "mouseover", function (e) {
if (me.marker_.getDraggable() || me.marker_.getClickable()) {
this.style.cursor = "pointer";
google.maps.event.trigger(me.marker_, "mouseover", e);
}
}),
google.maps.event.addDomListener(this.eventDiv_, "mouseout", function (e) {
if ((me.marker_.getDraggable() || me.marker_.getClickable()) && !cDraggingLabel) {
this.style.cursor = me.marker_.getCursor();
google.maps.event.trigger(me.marker_, "mouseout", e);
}
}),
google.maps.event.addDomListener(this.eventDiv_, "mousedown", function (e) {
cDraggingLabel = false;
if (me.marker_.getDraggable()) {
cMouseIsDown = true;
this.style.cursor = cDraggingCursor;
}
if (me.marker_.getDraggable() || me.marker_.getClickable()) {
google.maps.event.trigger(me.marker_, "mousedown", e);
cAbortEvent(e); // Prevent map pan when starting a drag on a label
}
}),
google.maps.event.addDomListener(document, "mouseup", function (mEvent) {
var position;
if (cMouseIsDown) {
cMouseIsDown = false;
me.eventDiv_.style.cursor = "pointer";
google.maps.event.trigger(me.marker_, "mouseup", mEvent);
}
if (cDraggingLabel) {
if (cRaiseEnabled) { // Lower the marker & label
position = me.getProjection().fromLatLngToDivPixel(me.marker_.getPosition());
position.y += cRaiseOffset;
me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position));
// This is not the same bouncing style as when the marker portion is dragged,
// but it will have to do:
try { // Will fail if running Google Maps API earlier than V3.3
me.marker_.setAnimation(google.maps.Animation.BOUNCE);
setTimeout(cStopBounce, 1406);
} catch (e) {}
}
me.crossDiv_.style.display = "none";
me.marker_.setZIndex(cSavedZIndex);
cIgnoreClick = true; // Set flag to ignore the click event reported after a label drag
cDraggingLabel = false;
mEvent.latLng = me.marker_.getPosition();
google.maps.event.trigger(me.marker_, "dragend", mEvent);
}
}),
google.maps.event.addListener(me.marker_.getMap(), "mousemove", function (mEvent) {
var position;
if (cMouseIsDown) {
if (cDraggingLabel) {
// Change the reported location from the mouse position to the marker position:
mEvent.latLng = new google.maps.LatLng(mEvent.latLng.lat() - cLatOffset, mEvent.latLng.lng() - cLngOffset);
position = me.getProjection().fromLatLngToDivPixel(mEvent.latLng);
if (cRaiseEnabled) {
me.crossDiv_.style.left = position.x + "px";
me.crossDiv_.style.top = position.y + "px";
me.crossDiv_.style.display = "";
position.y -= cRaiseOffset;
}
me.marker_.setPosition(me.getProjection().fromDivPixelToLatLng(position));
if (cRaiseEnabled) { // Don't raise the veil; this hack needed to make MSIE act properly
me.eventDiv_.style.top = (position.y + cRaiseOffset) + "px";
}
google.maps.event.trigger(me.marker_, "drag", mEvent);
} else {
// Calculate offsets from the click point to the marker position:
cLatOffset = mEvent.latLng.lat() - me.marker_.getPosition().lat();
cLngOffset = mEvent.latLng.lng() - me.marker_.getPosition().lng();
cSavedZIndex = me.marker_.getZIndex();
cStartPosition = me.marker_.getPosition();
cStartCenter = me.marker_.getMap().getCenter();
cRaiseEnabled = me.marker_.get("raiseOnDrag");
cDraggingLabel = true;
me.marker_.setZIndex(1000000); // Moves the marker & label to the foreground during a drag
mEvent.latLng = me.marker_.getPosition();
google.maps.event.trigger(me.marker_, "dragstart", mEvent);
}
}
}),
google.maps.event.addDomListener(document, "keydown", function (e) {
if (cDraggingLabel) {
if (e.keyCode === 27) { // Esc key
cRaiseEnabled = false;
me.marker_.setPosition(cStartPosition);
me.marker_.getMap().setCenter(cStartCenter);
google.maps.event.trigger(document, "mouseup", e);
}
}
}),
google.maps.event.addDomListener(this.eventDiv_, "click", function (e) {
if (me.marker_.getDraggable() || me.marker_.getClickable()) {
if (cIgnoreClick) { // Ignore the click reported when a label drag ends
cIgnoreClick = false;
} else {
google.maps.event.trigger(me.marker_, "click", e);
cAbortEvent(e); // Prevent click from being passed on to map
}
}
}),
google.maps.event.addDomListener(this.eventDiv_, "dblclick", function (e) {
if (me.marker_.getDraggable() || me.marker_.getClickable()) {
google.maps.event.trigger(me.marker_, "dblclick", e);
cAbortEvent(e); // Prevent map zoom when double-clicking on a label
}
}),
google.maps.event.addListener(this.marker_, "dragstart", function (mEvent) {
if (!cDraggingLabel) {
cRaiseEnabled = this.get("raiseOnDrag");
}
}),
google.maps.event.addListener(this.marker_, "drag", function (mEvent) {
if (!cDraggingLabel) {
if (cRaiseEnabled) {
me.setPosition(cRaiseOffset);
// During a drag, the marker's z-index is temporarily set to 1000000 to
// ensure it appears above all other markers. Also set the label's z-index
// to 1000000 (plus or minus 1 depending on whether the label is supposed
// to be above or below the marker).
me.labelDiv_.style.zIndex = 1000000 + (this.get("labelInBackground") ? -1 : +1);
}
}
}),
google.maps.event.addListener(this.marker_, "dragend", function (mEvent) {
if (!cDraggingLabel) {
if (cRaiseEnabled) {
me.setPosition(0); // Also restores z-index of label
}
}
}),
google.maps.event.addListener(this.marker_, "position_changed", function () {
me.setPosition();
}),
google.maps.event.addListener(this.marker_, "zindex_changed", function () {
me.setZIndex();
}),
google.maps.event.addListener(this.marker_, "visible_changed", function () {
me.setVisible();
}),
google.maps.event.addListener(this.marker_, "labelvisible_changed", function () {
me.setVisible();
}),
google.maps.event.addListener(this.marker_, "title_changed", function () {
me.setTitle();
}),
google.maps.event.addListener(this.marker_, "labelcontent_changed", function () {
me.setContent();
}),
google.maps.event.addListener(this.marker_, "labelanchor_changed", function () {
me.setAnchor();
}),
google.maps.event.addListener(this.marker_, "labelclass_changed", function () {
me.setStyles();
}),
google.maps.event.addListener(this.marker_, "labelstyle_changed", function () {
me.setStyles();
})
];
};
/**
* Removes the DIV for the label from the DOM. It also removes all event handlers.
* This method is called automatically when the marker's <code>setMap(null)</code>
* method is called.
* @private
*/
MarkerLabel_.prototype.onRemove = function () {
var i;
if (this.labelDiv_.parentNode !== null)
this.labelDiv_.parentNode.removeChild(this.labelDiv_);
if (this.eventDiv_.parentNode !== null)
this.eventDiv_.parentNode.removeChild(this.eventDiv_);
// Remove event listeners:
for (i = 0; i < this.listeners_.length; i++) {
google.maps.event.removeListener(this.listeners_[i]);
}
};
/**
* Draws the label on the map.
* @private
*/
MarkerLabel_.prototype.draw = function () {
this.setContent();
this.setTitle();
this.setStyles();
};
/**
* Sets the content of the label.
* The content can be plain text or an HTML DOM node.
* @private
*/
MarkerLabel_.prototype.setContent = function () {
var content = this.marker_.get("labelContent");
if (typeof content.nodeType === "undefined") {
this.labelDiv_.innerHTML = content;
this.eventDiv_.innerHTML = this.labelDiv_.innerHTML;
} else {
this.labelDiv_.innerHTML = ""; // Remove current content
this.labelDiv_.appendChild(content);
content = content.cloneNode(true);
this.eventDiv_.appendChild(content);
}
};
/**
* Sets the content of the tool tip for the label. It is
* always set to be the same as for the marker itself.
* @private
*/
MarkerLabel_.prototype.setTitle = function () {
this.eventDiv_.title = this.marker_.getTitle() || "";
};
/**
* Sets the style of the label by setting the style sheet and applying
* other specific styles requested.
* @private
*/
MarkerLabel_.prototype.setStyles = function () {
var i, labelStyle;
// Apply style values from the style sheet defined in the labelClass parameter:
this.labelDiv_.className = this.marker_.get("labelClass");
this.eventDiv_.className = this.labelDiv_.className;
// Clear existing inline style values:
this.labelDiv_.style.cssText = "";
this.eventDiv_.style.cssText = "";
// Apply style values defined in the labelStyle parameter:
labelStyle = this.marker_.get("labelStyle");
for (i in labelStyle) {
if (labelStyle.hasOwnProperty(i)) {
this.labelDiv_.style[i] = labelStyle[i];
this.eventDiv_.style[i] = labelStyle[i];
}
}
this.setMandatoryStyles();
};
/**
* Sets the mandatory styles to the DIV representing the label as well as to the
* associated event DIV. This includes setting the DIV position, z-index, and visibility.
* @private
*/
MarkerLabel_.prototype.setMandatoryStyles = function () {
this.labelDiv_.style.position = "absolute";
this.labelDiv_.style.overflow = "hidden";
// Make sure the opacity setting causes the desired effect on MSIE:
if (typeof this.labelDiv_.style.opacity !== "undefined" && this.labelDiv_.style.opacity !== "") {
this.labelDiv_.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(opacity=" + (this.labelDiv_.style.opacity * 100) + ")\"";
this.labelDiv_.style.filter = "alpha(opacity=" + (this.labelDiv_.style.opacity * 100) + ")";
}
this.eventDiv_.style.position = this.labelDiv_.style.position;
this.eventDiv_.style.overflow = this.labelDiv_.style.overflow;
this.eventDiv_.style.opacity = 0.01; // Don't use 0; DIV won't be clickable on MSIE
this.eventDiv_.style.MsFilter = "\"progid:DXImageTransform.Microsoft.Alpha(opacity=1)\"";
this.eventDiv_.style.filter = "alpha(opacity=1)"; // For MSIE
this.setAnchor();
this.setPosition(); // This also updates z-index, if necessary.
this.setVisible();
};
/**
* Sets the anchor point of the label.
* @private
*/
MarkerLabel_.prototype.setAnchor = function () {
var anchor = this.marker_.get("labelAnchor");
this.labelDiv_.style.marginLeft = -anchor.x + "px";
this.labelDiv_.style.marginTop = -anchor.y + "px";
this.eventDiv_.style.marginLeft = -anchor.x + "px";
this.eventDiv_.style.marginTop = -anchor.y + "px";
};
/**
* Sets the position of the label. The z-index is also updated, if necessary.
* @private
*/
MarkerLabel_.prototype.setPosition = function (yOffset) {
var position = this.getProjection().fromLatLngToDivPixel(this.marker_.getPosition());
if (typeof yOffset === "undefined") {
yOffset = 0;
}
this.labelDiv_.style.left = Math.round(position.x) + "px";
this.labelDiv_.style.top = Math.round(position.y - yOffset) + "px";
this.eventDiv_.style.left = this.labelDiv_.style.left;
this.eventDiv_.style.top = this.labelDiv_.style.top;
this.setZIndex();
};
/**
* Sets the z-index of the label. If the marker's z-index property has not been defined, the z-index
* of the label is set to the vertical coordinate of the label. This is in keeping with the default
* stacking order for Google Maps: markers to the south are in front of markers to the north.
* @private
*/
MarkerLabel_.prototype.setZIndex = function () {
var zAdjust = (this.marker_.get("labelInBackground") ? -1 : +1);
if (typeof this.marker_.getZIndex() === "undefined") {
this.labelDiv_.style.zIndex = parseInt(this.labelDiv_.style.top, 10) + zAdjust;
this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex;
} else {
this.labelDiv_.style.zIndex = this.marker_.getZIndex() + zAdjust;
this.eventDiv_.style.zIndex = this.labelDiv_.style.zIndex;
}
};
/**
* Sets the visibility of the label. The label is visible only if the marker itself is
* visible (i.e., its visible property is true) and the labelVisible property is true.
* @private
*/
MarkerLabel_.prototype.setVisible = function () {
if (this.marker_.get("labelVisible")) {
this.labelDiv_.style.display = this.marker_.getVisible() ? "block" : "none";
} else {
this.labelDiv_.style.display = "none";
}
this.eventDiv_.style.display = this.labelDiv_.style.display;
};
/**
* @name MarkerWithLabelOptions
* @class This class represents the optional parameter passed to the {@link MarkerWithLabel} constructor.
* The properties available are the same as for <code>google.maps.Marker</code> with the addition
* of the properties listed below. To change any of these additional properties after the labeled
* marker has been created, call <code>google.maps.Marker.set(propertyName, propertyValue)</code>.
* <p>
* When any of these properties changes, a property changed event is fired. The names of these
* events are derived from the name of the property and are of the form <code>propertyname_changed</code>.
* For example, if the content of the label changes, a <code>labelcontent_changed</code> event
* is fired.
* <p>
* @property {string|Node} [labelContent] The content of the label (plain text or an HTML DOM node).
* @property {Point} [labelAnchor] By default, a label is drawn with its anchor point at (0,0) so
* that its top left corner is positioned at the anchor point of the associated marker. Use this
* property to change the anchor point of the label. For example, to center a 50px-wide label
* beneath a marker, specify a <code>labelAnchor</code> of <code>google.maps.Point(25, 0)</code>.
* (Note: x-values increase to the right and y-values increase to the top.)
* @property {string} [labelClass] The name of the CSS class defining the styles for the label.
* Note that style values for <code>position</code>, <code>overflow</code>, <code>top</code>,
* <code>left</code>, <code>zIndex</code>, <code>display</code>, <code>marginLeft</code>, and
* <code>marginTop</code> are ignored; these styles are for internal use only.
* @property {Object} [labelStyle] An object literal whose properties define specific CSS
* style values to be applied to the label. Style values defined here override those that may
* be defined in the <code>labelClass</code> style sheet. If this property is changed after the
* label has been created, all previously set styles (except those defined in the style sheet)
* are removed from the label before the new style values are applied.
* Note that style values for <code>position</code>, <code>overflow</code>, <code>top</code>,
* <code>left</code>, <code>zIndex</code>, <code>display</code>, <code>marginLeft</code>, and
* <code>marginTop</code> are ignored; these styles are for internal use only.
* @property {boolean} [labelInBackground] A flag indicating whether a label that overlaps its
* associated marker should appear in the background (i.e., in a plane below the marker).
* The default is <code>false</code>, which causes the label to appear in the foreground.
* @property {boolean} [labelVisible] A flag indicating whether the label is to be visible.
* The default is <code>true</code>. Note that even if <code>labelVisible</code> is
* <code>true</code>, the label will <i>not</i> be visible unless the associated marker is also
* visible (i.e., unless the marker's <code>visible</code> property is <code>true</code>).
* @property {boolean} [raiseOnDrag] A flag indicating whether the label and marker are to be
* raised when the marker is dragged. The default is <code>true</code>. If a draggable marker is
* being created and a version of Google Maps API earlier than V3.3 is being used, this property
* must be set to <code>false</code>.
* @property {boolean} [optimized] A flag indicating whether rendering is to be optimized for the
* marker. <b>Important: The optimized rendering technique is not supported by MarkerWithLabel,
* so the value of this parameter is always forced to <code>false</code>.
* @property {string} [crossImage="http://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png"]
* The URL of the cross image to be displayed while dragging a marker.
* @property {string} [handCursor="http://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur"]
* The URL of the cursor to be displayed while dragging a marker.
*/
/**
* Creates a MarkerWithLabel with the options specified in {@link MarkerWithLabelOptions}.
* @constructor
* @param {MarkerWithLabelOptions} [opt_options] The optional parameters.
*/
function MarkerWithLabel(opt_options) {
opt_options = opt_options || {};
opt_options.labelContent = opt_options.labelContent || "";
opt_options.labelAnchor = opt_options.labelAnchor || new google.maps.Point(0, 0);
opt_options.labelClass = opt_options.labelClass || "markerLabels";
opt_options.labelStyle = opt_options.labelStyle || {};
opt_options.labelInBackground = opt_options.labelInBackground || false;
if (typeof opt_options.labelVisible === "undefined") {
opt_options.labelVisible = true;
}
if (typeof opt_options.raiseOnDrag === "undefined") {
opt_options.raiseOnDrag = true;
}
if (typeof opt_options.clickable === "undefined") {
opt_options.clickable = true;
}
if (typeof opt_options.draggable === "undefined") {
opt_options.draggable = false;
}
if (typeof opt_options.optimized === "undefined") {
opt_options.optimized = false;
}
opt_options.crossImage = opt_options.crossImage || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/drag_cross_67_16.png";
opt_options.handCursor = opt_options.handCursor || "http" + (document.location.protocol === "https:" ? "s" : "") + "://maps.gstatic.com/intl/en_us/mapfiles/closedhand_8_8.cur";
opt_options.optimized = false; // Optimized rendering is not supported
this.label = new MarkerLabel_(this, opt_options.crossImage, opt_options.handCursor); // Bind the label to the marker
// Call the parent constructor. It calls Marker.setValues to initialize, so all
// the new parameters are conveniently saved and can be accessed with get/set.
// Marker.set triggers a property changed event (called "propertyname_changed")
// that the marker label listens for in order to react to state changes.
google.maps.Marker.apply(this, arguments);
}
inherits(MarkerWithLabel, google.maps.Marker);
/**
* Overrides the standard Marker setMap function.
* @param {Map} theMap The map to which the marker is to be added.
* @private
*/
MarkerWithLabel.prototype.setMap = function (theMap) {
// Call the inherited function...
google.maps.Marker.prototype.setMap.apply(this, arguments);
// ... then deal with the label:
this.label.setMap(theMap);
};
|
ajax/libs/mobx-react/0.2.1/index.js
|
dc-js/cdnjs
|
(function() {
function mrFactory(mobservable, ReactDep, ReactNativeDep) {
if (!mobservable)
throw new Error("mobservable-react requires the Mobservable package.")
var React = ReactNativeDep || ReactDep;
if (!React)
throw new Error("mobservable-react requires either React or ReactNative to be available");
var isTracking = false;
// WeakMap<Node, Object>;
var componentByNodeRegistery = typeof WeakMap !== "undefined" ? new WeakMap() : undefined;
var renderReporter = new mobservable._.SimpleEventEmitter();
function reportRendering(component) {
// TODO: Fix in 0.14: React.findDOMNode is deprecated. Please use ReactDOM.findDOMNode from require('react-dom') instead.
var node = React.findDOMNode(component);
if (node)
componentByNodeRegistery.set(node, component);
renderReporter.emit({
event: 'render',
renderTime: component.__$mobRenderEnd - component.__$mobRenderStart,
totalTime: Date.now() - component.__$mobRenderStart,
component: component,
node: node
});
}
var reactiveMixin = {
componentWillMount: function() {
var baseRender = this.render;
this.__$mobDependencies = [];
this.render = function() {
if (isTracking)
this.__$mobRenderStart = Date.now();
// invoke the old render function and in the mean time track all dependencies using
// 'observe'.
// when the dependencies change, the function is triggered, but we don't want to
// rerender because that would ignore the normal React lifecycle,
// so instead we dispose the current observer and trigger a force update.
var hasRendered = false;
var rendering;
this.__$mobDisposer = mobservable.observe(function reactiveRender() {
if (!hasRendered) {
hasRendered = true;
rendering = baseRender.call(this);
} else {
this.__$mobDisposer();
React.Component.prototype.forceUpdate.call(this);
}
}, this);
// make sure views are not disposed between the clean-up of the observer and the next render
// (invoked through force update)
this.$mobservable = this.__$mobDisposer.$mobservable;
var newDependencies = this.$mobservable.observing.map(function(dep) {
dep.setRefCount(+1);
return dep;
});
this.__$mobDependencies.forEach(function(dep) {
dep.setRefCount(-1);
});
this.__$mobDependencies = newDependencies;
if (isTracking)
this.__$mobRenderEnd = Date.now();
return rendering;
}
},
componentWillUnmount: function() {
this.__$mobDisposer && this.__$mobDisposer();
this.__$mobDependencies.forEach(function(dep) {
dep.setRefCount(-1);
});
delete this.$mobservable;
if (isTracking) {
// TODO: Fix in 0.14: React.findDOMNode is deprecated. Please use ReactDOM.findDOMNode from require('react-dom') instead.
var node = React.findDOMNode(this);
if (node) {
componentByNodeRegistery.delete(node);
renderReporter.emit({
event: 'destroy',
component: this,
node: node
});
}
}
},
componentDidMount: function() {
if (isTracking)
reportRendering(this);
},
componentDidUpdate: function() {
if (isTracking)
reportRendering(this);
},
shouldComponentUpdate: function(nextProps, nextState) {
// update on any state changes (as is the default)
if (this.state !== nextState)
return true;
// update if props are shallowly not equal, inspired by PureRenderMixin
var keys = Object.keys(this.props);
var key;
if (keys.length !== Object.keys(nextProps).length)
return true;
for(var i = keys.length -1; i >= 0, key = keys[i]; i--) {
var newValue = nextProps[key];
if (newValue !== this.props[key]) {
return true;
} else if (newValue && typeof newValue === "object" && !mobservable.isReactive(newValue)) {
/**
* If the newValue is still the same object, but that object is not reactive,
* fallback to the default React behavior: update, because the object *might* have changed.
* If you need the non default behavior, just use the React pure render mixin, as that one
* will work fine with mobservable as well, instead of the default implementation of
* reactiveComponent.
*/
return true;
}
}
return false;
}
}
function patch(target, funcName) {
var base = target[funcName];
var mixinFunc = reactiveMixin[funcName];
target[funcName] = function() {
base && base.apply(this, arguments);
mixinFunc.apply(this, arguments);
}
}
function reactiveComponent(componentClass) {
// If it is function but doesn't seem to be a react class constructor,
// wrap it to a react class automatically
if (typeof componentClass === "function" && !componentClass.prototype.render && !componentClass.isReactClass && !React.Component.isPrototypeOf(componentClass)) {
return reactiveComponent(React.createClass({
displayName: componentClass.name,
render: function() {
return componentClass.call(this, this.props);
}
}));
}
if (!componentClass)
throw new Error("Please pass a valid component to 'reactiveComponent'");
var target = componentClass.prototype || componentClass;
[
"componentWillMount",
"componentWillUnmount",
"componentDidMount",
"componentDidUpdate"
].forEach(function(funcName) {
patch(target, funcName)
});
if (!target.shouldComponentUpdate)
target.shouldComponentUpdate = reactiveMixin.shouldComponentUpdate;
return componentClass;
}
function trackComponents() {
if (typeof WeakMap === "undefined")
throw new Error("tracking components is not supported in this browser");
if (!isTracking)
isTracking = true;
}
return ({
reactiveComponent: reactiveComponent,
renderReporter: renderReporter,
componentByNodeRegistery: componentByNodeRegistery,
trackComponents: trackComponents
});
}
// UMD
if (typeof define === 'function' && define.amd) {
define('mobservable-react', ['mobservable', 'react', 'react-native'], mrFactory);
} else if (typeof exports === 'object') {
module.exports = mrFactory(
require('mobservable'),
require('react'),
function () {
try {
return require('react');
}
catch (e) {
return null;
}
}(),
function() {
try {
return require('react-native');
}
catch (e) {
return null;
}
}()
);
} else {
this.mobservableReact = mrFactory(this['mobservable'], this['React'], this['ReactNative']);
}
})();
|
test/specs/collections/Message/MessageItem-test.js
|
mohammed88/Semantic-UI-React
|
import React from 'react'
import MessageItem from 'src/collections/Message/MessageItem'
import * as common from 'test/specs/commonTests'
describe('MessageItem', () => {
common.isConformant(MessageItem)
common.implementsCreateMethod(MessageItem)
common.rendersChildren(MessageItem)
it('renders an li tag', () => {
shallow(<MessageItem />)
.should.have.tagName('li')
})
})
|
src/Parser/RetributionPaladin/Modules/Items/AshesToDust.js
|
mwwscott0/WoWAnalyzer
|
import React from 'react';
import SPELLS from 'common/SPELLS';
import ITEMS from 'common/ITEMS';
import { formatNumber } from 'common/format';
import Module from 'Parser/Core/Module';
import Combatants from 'Parser/Core/Modules/Combatants';
import Enemies from 'Parser/Core/Modules/Enemies';
import GetDamageBonus from '../PaladinCore/GetDamageBonus';
const ASHES_TO_DUST_MODIFIER = 0.15;
class AshesToDust extends Module {
static dependencies = {
combatants: Combatants,
enemies: Enemies,
};
damageDone = 0;
on_initialized() {
this.active = this.combatants.selected.hasShoulder(ITEMS.ASHES_TO_DUST.id);
}
on_byPlayer_damage(event) {
const enemy = this.enemies.getEntity(event);
if (!enemy) {
return;
}
else if(enemy.hasBuff(SPELLS.WAKE_OF_ASHES.id)) {
this.damageDone += GetDamageBonus(event, ASHES_TO_DUST_MODIFIER);
}
}
item() {
return {
item: ITEMS.ASHES_TO_DUST,
result: (<dfn data-tip={`
The effective damage contributed by Ashes to Dust.<br/>
Damage: ${this.owner.formatItemDamageDone(this.damageDone)}<br/>
Total Damage: ${formatNumber(this.damageDone)}`}>
{this.owner.formatItemDamageDone(this.damageDone)}
</dfn>),
};
}
}
export default AshesToDust;
|
src/components/App.js
|
lakdred/Campanella-worldlinepack
|
import React, { Component } from 'react';
export default class App extends Component {
render () {
return (
<h1>Hello Camapanella!</h1>
);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.